Swift

Controlling App Fonts in Swift

Hi! After I added custom fonts to my Swift – IOS project, I had some problems to reach my custom fonts.All I did was to add .otf folders to under the resources folder in my project. Then I added them via info.plist under — Fonts provided by application–. But then somehow project did not recognize some of my .otf fonts. So I wanted to reach all fonts that I can use for my project. Then I added below function to my project in somewhere just to make it run:

 //   TO GET  FONT NAMES

        for family: String in UIFont.familyNames()

        {

            print("\(family)")

            for names: String in UIFont.fontNamesForFamilyName(family)

            {

                print("NAMES == \(names)")

            }

        }

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s