0

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?

Natsathorn
  • 1,384
  • 11
  • 23
  • Just update description, please have a look. – Natsathorn Nov 13 '19 at 12:40
  • You cannot download an arbitrary font for system wide use. Installed fonts must be approved by Apple. – matt Nov 13 '19 at 13:23
  • @matt I see. Even though it is my font, I still need to bundle it with my application and use `CTFontManagerRegisterFontURLs` method to install it to the user's phone right? – Natsathorn Nov 13 '19 at 13:32
  • as mat noted, you cannot install font. I note that this answer denotes a poor knowledge of Apple ecosystem: reading apple docs it's cleanly written about font management. – ingconti Nov 13 '19 at 13:41

0 Answers0