Reputation: 753
Imagine I have this custom font font.ttf
And I have two projects. Project A in /projects/A
and project B in /projects/B
I don't want to copy paste this font among projects.
I created a cocoa touch framework and added the font.ttf
to that. Then reused that framework in projects A and B. But it doesn't work. Is it possible?
Upvotes: 4
Views: 240
Reputation: 100503
According to this thread, you can try
let bundle = Bundle(identifier: "frameworkIdentifier")!
let url = bundle.url(forResource: "fontName", withExtension: "ttf")!
if let dataProvider = CGDataProvider(url: url as CFURL) {
let font = CGFont(dataProvider)
print(font)
}
//
//
Upvotes: 1