From this question, he asked for how to make his user able to use their preferred font in his application. But mine is different. My question is about how do I install a downloaded font to iOS system? I want my user to be able to use the font installed from my application in other application like Pages.
I'm trying to create an app that downloads and installs my font to IOS system. So, the user can use my font in other application like other font store app do.
Now, I can download the TTF font from my server and save it to device local.
Here is my download code.
let url = URL(string: "https://www.example.com/font.ttf")!
let task = URLSession.shared.downloadTask(with: url) {
localURL, urlResponse, error in
if let localURL = localURL {
do {
let documentsURL = try
FileManager.default.url(for: .documentDirectory,
in: .userDomainMask,
appropriateFor: nil,
create: false)
let savedURL = documentsURL.appendingPathComponent("font.ttf")
try FileManager.default.moveItem(at: localURL, to: savedURL)
} catch {
print ("file error: \(error)")
}
}
}
task.resume()
How can I install font to the system?