Skip to content

Commit

Permalink
#19 update to swift 4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
marekmatula committed Dec 11, 2018
1 parent e9ccc40 commit d87fc69
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 17 deletions.
10 changes: 7 additions & 3 deletions Example/FontIcons.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0720;
LastUpgradeCheck = 0920;
LastUpgradeCheck = 1010;
ORGANIZATIONNAME = CocoaPods;
TargetAttributes = {
607FACCF1AFB9204008FA782 = {
Expand Down Expand Up @@ -537,12 +537,14 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = 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_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
Expand Down Expand Up @@ -576,7 +578,7 @@
OTHER_SWIFT_FLAGS = "$(inherited)";
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
Expand All @@ -592,12 +594,14 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = 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_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
Expand All @@ -623,7 +627,7 @@
OTHER_SWIFT_FLAGS = "$(inherited)";
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
VALIDATE_PRODUCT = YES;
};
name = Release;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0920"
LastUpgradeVersion = "1010"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down Expand Up @@ -40,7 +40,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
Expand Down Expand Up @@ -70,7 +69,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
4 changes: 2 additions & 2 deletions FontIcons.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Pod::Spec.new do |s|
s.name = "FontIcons"
s.version = "1.4.4"
s.version = "1.5.0"
s.summary = "Swift Font icon library"

# This description is used to generate tags and improve search results.
Expand All @@ -30,7 +30,7 @@ Easy extensible to other fonts.

s.platform = :ios, '8.0'
s.requires_arc = true
# s.pod_target_xcconfig = { 'SWIFT_VERSION' => '4.0' }
# s.pod_target_xcconfig = { 'SWIFT_VERSION' => '4.2' }

s.subspec 'Core' do |core|
core.source_files = 'Pod/Classes/FontIcons.swift', 'Pod/Classes/Extensions.swift'
Expand Down
16 changes: 8 additions & 8 deletions Pod/Classes/Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ public extension UIBarButtonItem {
func setFontIconText(prefix: String, icon: FontEnum, postfix: String, size: CGFloat) {

let font = FontLoader.getFont(icon, iconSize: size)
setTitleTextAttributes([NSAttributedStringKey.font: font], for: .normal)
setTitleTextAttributes([NSAttributedStringKey.font: font], for: .highlighted)
setTitleTextAttributes([NSAttributedStringKey.font: font], for: .disabled)
setTitleTextAttributes([NSAttributedString.Key.font: font], for: .normal)
setTitleTextAttributes([NSAttributedString.Key.font: font], for: .highlighted)
setTitleTextAttributes([NSAttributedString.Key.font: font], for: .disabled)
#if giOS8OrGreater
setTitleTextAttributes([NSFontAttributeName: font], for: .focused)
#endif
Expand All @@ -32,17 +32,17 @@ public extension UIBarButtonItem {

public extension UIButton {

func setFontIcon(_ icon: FontEnum, forState: UIControlState) {
func setFontIcon(_ icon: FontEnum, forState: UIControl.State) {
if let label = titleLabel {
setFontIcon(icon, size: label.font.pointSize, forState: forState)
}
}

func setFontIcon(_ icon: FontEnum, size:CGFloat, forState: UIControlState) {
func setFontIcon(_ icon: FontEnum, size:CGFloat, forState: UIControl.State) {
setFontIconText(prefix: "", icon: icon, postfix: "", size: size, forState: forState)
}

func setFontIconText(prefix: String, icon: FontEnum, postfix: String, size: CGFloat, forState: UIControlState) {
func setFontIconText(prefix: String, icon: FontEnum, postfix: String, size: CGFloat, forState: UIControl.State) {

let font = FontLoader.getFont(icon, iconSize: size)

Expand Down Expand Up @@ -92,7 +92,7 @@ public extension UISegmentedControl {

let font = FontLoader.getFont(icon, iconSize: defaultFontIconSize)

setTitleTextAttributes([NSAttributedStringKey.font: font], for: UIControlState())
setTitleTextAttributes([NSAttributedString.Key.font: font], for: UIControl.State())
setTitle(icon.unicode(), forSegmentAt: segment)
}
}
Expand All @@ -110,7 +110,7 @@ public extension UIImage {
let fontSize = min(size.width / fontAspectRatio, size.height)

let font = FontLoader.getFont(icon, iconSize: fontSize)
let attributes = [NSAttributedStringKey.font: font, NSAttributedStringKey.foregroundColor: textColor, NSAttributedStringKey.backgroundColor: backgroundColor, NSAttributedStringKey.paragraphStyle: paragraph]
let attributes = [NSAttributedString.Key.font: font, NSAttributedString.Key.foregroundColor: textColor, NSAttributedString.Key.backgroundColor: backgroundColor, NSAttributedString.Key.paragraphStyle: paragraph]

let attributedString = NSAttributedString(string: icon.unicode(), attributes: attributes)
UIGraphicsBeginImageContextWithOptions(size, false , 0.0)
Expand Down
2 changes: 1 addition & 1 deletion Pod/Classes/FontIcons.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ open class FontLoader {
}
}

open static func loadFont(_ fontName:String, bundleName: String) {
public static func loadFont(_ fontName:String, bundleName: String) {

let bundle = Bundle(for: FontLoader.self)
var fontURL : URL?
Expand Down

0 comments on commit d87fc69

Please sign in to comment.