diff --git a/Example/FontIcons.xcodeproj/project.pbxproj b/Example/FontIcons.xcodeproj/project.pbxproj index e8303b9..6622910 100644 --- a/Example/FontIcons.xcodeproj/project.pbxproj +++ b/Example/FontIcons.xcodeproj/project.pbxproj @@ -300,18 +300,18 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0720; - LastUpgradeCheck = 0800; + LastUpgradeCheck = 0920; ORGANIZATIONNAME = CocoaPods; TargetAttributes = { 607FACCF1AFB9204008FA782 = { CreatedOnToolsVersion = 6.3.1; - DevelopmentTeam = V6SD56ATEW; - LastSwiftMigration = 0800; + DevelopmentTeam = 26UE33584E; + LastSwiftMigration = 0920; }; 607FACE41AFB9204008FA782 = { CreatedOnToolsVersion = 6.3.1; DevelopmentTeam = 64ZAN7QS6N; - LastSwiftMigration = 0800; + LastSwiftMigration = 0920; TestTargetID = 607FACCF1AFB9204008FA782; }; }; @@ -533,14 +533,20 @@ CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; @@ -581,14 +587,20 @@ CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; @@ -620,13 +632,14 @@ buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = "$(inherited)"; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - DEVELOPMENT_TEAM = V6SD56ATEW; + DEVELOPMENT_TEAM = 26UE33584E; INFOPLIST_FILE = FontIcons/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; MODULE_NAME = ExampleApp; PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = Default; + SWIFT_VERSION = 4.0; }; name = Debug; }; @@ -636,13 +649,14 @@ buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = "$(inherited)"; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - DEVELOPMENT_TEAM = V6SD56ATEW; + DEVELOPMENT_TEAM = 26UE33584E; INFOPLIST_FILE = FontIcons/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; MODULE_NAME = ExampleApp; PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = Default; + SWIFT_VERSION = 4.0; }; name = Release; }; @@ -665,7 +679,8 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = Default; + SWIFT_VERSION = 4.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/FontIcons_Example.app/FontIcons_Example"; }; name = Debug; @@ -685,7 +700,8 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = Default; + SWIFT_VERSION = 4.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/FontIcons_Example.app/FontIcons_Example"; }; name = Release; diff --git a/Example/FontIcons.xcodeproj/xcshareddata/xcschemes/FontIcons-Example.xcscheme b/Example/FontIcons.xcodeproj/xcshareddata/xcschemes/FontIcons-Example.xcscheme index d981646..73fae1a 100644 --- a/Example/FontIcons.xcodeproj/xcshareddata/xcschemes/FontIcons-Example.xcscheme +++ b/Example/FontIcons.xcodeproj/xcshareddata/xcschemes/FontIcons-Example.xcscheme @@ -1,6 +1,6 @@ String { - let first = String(text.characters.prefix(1)).lowercased() - let other = String(text.characters.dropFirst()) + let first = String(text.prefix(1)).lowercased() + let other = String(text.dropFirst()) return first + other } diff --git a/Example/Podfile b/Example/Podfile index 390b3b4..3b88038 100644 --- a/Example/Podfile +++ b/Example/Podfile @@ -14,7 +14,8 @@ end post_install do |installer| installer.pods_project.targets.each do |target| target.build_configurations.each do |config| - config.build_settings['SWIFT_VERSION'] = '3.2' + config.build_settings['SWIFT_VERSION'] = '4.0' end end end + diff --git a/Example/Podfile.lock b/Example/Podfile.lock index 70b4b68..5ac9192 100644 --- a/Example/Podfile.lock +++ b/Example/Podfile.lock @@ -23,8 +23,8 @@ EXTERNAL SOURCES: :path: ../ SPEC CHECKSUMS: - FontIcons: 21cfaf760b251d5ae9439830d3953b53e9750dc2 + FontIcons: d24b4b759e678266638d6f973b8621b73a44ce60 -PODFILE CHECKSUM: 2aad07d3d6d10ddb5a0f9237472a74846743e25a +PODFILE CHECKSUM: ed146b582b93723cf874940f9b9ddd6dfbdd2815 -COCOAPODS: 1.3.1 +COCOAPODS: 1.4.0 diff --git a/Pod/Classes/Extensions.swift b/Pod/Classes/Extensions.swift index 1c6c9b5..9cba4f7 100644 --- a/Pod/Classes/Extensions.swift +++ b/Pod/Classes/Extensions.swift @@ -9,20 +9,20 @@ import Foundation import UIKit -private let defaultSize:CGFloat = 23.0 +public let defaultFontIconSize:CGFloat = 23.0 public extension UIBarButtonItem { - func setFontIcon(_ icon: FontEnum, size: CGFloat = defaultSize) { + func setFontIcon(_ icon: FontEnum, size: CGFloat = defaultFontIconSize) { setFontIconText(prefix: "", icon: icon, postfix: "", size: size) } func setFontIconText(prefix: String, icon: FontEnum, postfix: String, size: CGFloat) { let font = FontLoader.getFont(icon, iconSize: size) - setTitleTextAttributes([NSFontAttributeName: font], for: .normal) - setTitleTextAttributes([NSFontAttributeName: font], for: .highlighted) - setTitleTextAttributes([NSFontAttributeName: font], for: .disabled) + setTitleTextAttributes([NSAttributedStringKey.font: font], for: .normal) + setTitleTextAttributes([NSAttributedStringKey.font: font], for: .highlighted) + setTitleTextAttributes([NSAttributedStringKey.font: font], for: .disabled) #if giOS8OrGreater setTitleTextAttributes([NSFontAttributeName: font], for: .focused) #endif @@ -56,7 +56,7 @@ public extension UIButton { public extension UILabel { - func setFontIcon(_ icon: FontEnum, size: CGFloat = defaultSize) { + func setFontIcon(_ icon: FontEnum, size: CGFloat = defaultFontIconSize) { setFontIconText(prefix: "", icon: icon, postfix: "", size: size) } @@ -90,9 +90,9 @@ public extension UISegmentedControl { public func setFontIcon(_ icon: FontEnum, forSegmentAtIndex segment: Int) { - let font = FontLoader.getFont(icon, iconSize: defaultSize) + let font = FontLoader.getFont(icon, iconSize: defaultFontIconSize) - setTitleTextAttributes([NSFontAttributeName: font], for: UIControlState()) + setTitleTextAttributes([NSAttributedStringKey.font: font], for: UIControlState()) setTitle(icon.unicode(), forSegmentAt: segment) } } @@ -110,7 +110,7 @@ public extension UIImage { let fontSize = min(size.width / fontAspectRatio, size.height) let font = FontLoader.getFont(icon, iconSize: fontSize) - let attributes = [NSFontAttributeName: font, NSForegroundColorAttributeName: textColor, NSBackgroundColorAttributeName: backgroundColor, NSParagraphStyleAttributeName: paragraph] + let attributes = [NSAttributedStringKey.font: font, NSAttributedStringKey.foregroundColor: textColor, NSAttributedStringKey.backgroundColor: backgroundColor, NSAttributedStringKey.paragraphStyle: paragraph] let attributedString = NSAttributedString(string: icon.unicode(), attributes: attributes) UIGraphicsBeginImageContextWithOptions(size, false , 0.0) diff --git a/Pod/Classes/FontIcons.swift b/Pod/Classes/FontIcons.swift index 588f71c..3da5df7 100644 --- a/Pod/Classes/FontIcons.swift +++ b/Pod/Classes/FontIcons.swift @@ -43,7 +43,7 @@ open class FontLoader { let font = CGFont(provider!) var error: Unmanaged? - if !CTFontManagerRegisterGraphicsFont(font, &error) { + if !CTFontManagerRegisterGraphicsFont(font!, &error) { let errorDescription: CFString = CFErrorCopyDescription(error!.takeUnretainedValue()) let nsError = error!.takeUnretainedValue() as AnyObject as! NSError