From d8e70eb18e7300a5e0fb3e6e2bc1826473b95d48 Mon Sep 17 00:00:00 2001 From: Saurabh Rane Date: Thu, 30 Mar 2017 15:30:15 -0500 Subject: [PATCH] Solving Issue with Font Loading --- README.md | 2 +- Source/SwiftIcons.swift | 9 +- SwiftIcons.podspec | 2 +- SwiftIcons/Base.lproj/Main.storyboard | 2 +- docs/index.html | 125 +++++++++++++------------- 5 files changed, 73 insertions(+), 67 deletions(-) diff --git a/README.md b/README.md index 6ed8b6d..b67f7a6 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,7 @@ Add the following lines to your `Podfile`: ```ruby target 'YourProject' do use_frameworks! - pod 'SwiftIcons', '~> 1.0.1' + pod 'SwiftIcons', '~> 1.0.2' end ``` diff --git a/Source/SwiftIcons.swift b/Source/SwiftIcons.swift index b74b722..7766ba3 100644 --- a/Source/SwiftIcons.swift +++ b/Source/SwiftIcons.swift @@ -682,7 +682,14 @@ private class FontLoader { if UIFont.fontNames(forFamilyName: familyName).count == 0 { let bundle = Bundle(for: FontLoader.self) - let fontURL = bundle.url(forResource: fileName, withExtension: "ttf")! + var fontURL: URL! + let identifier = bundle.bundleIdentifier + + if (identifier?.hasPrefix("org.cocoapods"))! { + fontURL = bundle.url(forResource: fileName, withExtension: "ttf", subdirectory: "SwiftIcons.bundle") + } else { + fontURL = bundle.url(forResource: fileName, withExtension: "ttf")! + } let data = try! Data(contentsOf: fontURL) let provider = CGDataProvider(data: data as CFData) diff --git a/SwiftIcons.podspec b/SwiftIcons.podspec index b836a67..d4214c5 100644 --- a/SwiftIcons.podspec +++ b/SwiftIcons.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "SwiftIcons" - s.version = "1.0.1" + s.version = "1.0.2" s.summary = 'SwiftIcons - A library for using different font icons' s.description = 'SwiftIcons library helps you use icons from any of these font icons - Dripicons, Emoji, FontAwesome, Ionicons, Linearicons, Map-icons, Material icons, Open iconic, State face icons, Weather icons' diff --git a/SwiftIcons/Base.lproj/Main.storyboard b/SwiftIcons/Base.lproj/Main.storyboard index 9651a43..c23dd42 100644 --- a/SwiftIcons/Base.lproj/Main.storyboard +++ b/SwiftIcons/Base.lproj/Main.storyboard @@ -48,7 +48,7 @@ -