Skip to content

Commit

Permalink
swift 4.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
叶增峰 authored and 叶增峰 committed Dec 7, 2018
1 parent 98fabad commit 7c679e5
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 14 deletions.
5 changes: 3 additions & 2 deletions IconFont.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@
TargetAttributes = {
2FDC1D681FE3C0C300BD86B8 = {
CreatedOnToolsVersion = 9.1;
LastSwiftMigration = 1010;
ProvisioningStyle = Automatic;
};
};
Expand Down Expand Up @@ -409,7 +410,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.yzf.IconFont;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand All @@ -425,7 +426,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.yzf.IconFont;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>IconFont.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
</dict>
</plist>
14 changes: 7 additions & 7 deletions IconFont/Code/Extensions/UIImage+Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ import UIKit
extension UIImage {

public static func iconFont(fontSize: CGFloat, icon: IconFontType, color: UIColor? = nil) -> UIImage {
var attributes = [NSAttributedStringKey: Any]()
attributes[NSAttributedStringKey.font] = UIFont(iconFont: icon, size: fontSize)
var attributes = [NSAttributedString.Key: Any]()
attributes[NSAttributedString.Key.font] = UIFont(iconFont: icon, size: fontSize)
if let color = color {
attributes[NSAttributedStringKey.foregroundColor] = color
attributes[NSAttributedString.Key.foregroundColor] = color
}
let attributedString = NSAttributedString(string: icon.unicode, attributes: attributes)

Expand All @@ -33,10 +33,10 @@ extension UIImage {
}

public static func iconFont(imageSize: CGSize, icon: IconFontType, color: UIColor? = nil) -> UIImage {
var attributes = [NSAttributedStringKey: Any]()
attributes[NSAttributedStringKey.font] = UIFont(iconFont: icon, size: 1)
var attributes = [NSAttributedString.Key: Any]()
attributes[NSAttributedString.Key.font] = UIFont(iconFont: icon, size: 1)
if let color = color {
attributes[NSAttributedStringKey.foregroundColor] = color
attributes[NSAttributedString.Key.foregroundColor] = color
}
var attributedString = NSAttributedString(string: icon.unicode, attributes: attributes)

Expand All @@ -61,7 +61,7 @@ extension UIImage {
anchorRect.size.width = scaledWidth
anchorRect.size.height = scaledHeight

attributes[NSAttributedStringKey.font] = UIFont(iconFont: icon, size: scale)
attributes[NSAttributedString.Key.font] = UIFont(iconFont: icon, size: scale)
attributedString = NSAttributedString(string: icon.unicode, attributes: attributes)

UIGraphicsBeginImageContextWithOptions(imageSize, false, UIScreen.main.scale)
Expand Down
8 changes: 4 additions & 4 deletions IconFont/Code/Protocols/IconFontProtocols.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ protocol IconFontExtensionsType {
}

extension IconFontExtensionsType {
func attributes(size fontSize: CGFloat, icon: IconFontType, color: UIColor?) -> [NSAttributedStringKey: Any] {
var attributes = [NSAttributedStringKey: Any]()
attributes[NSAttributedStringKey.font] = UIFont(iconFont: icon, size: fontSize)
func attributes(size fontSize: CGFloat, icon: IconFontType, color: UIColor?) -> [NSAttributedString.Key: Any] {
var attributes = [NSAttributedString.Key: Any]()
attributes[NSAttributedString.Key.font] = UIFont(iconFont: icon, size: fontSize)
if let color = color {
attributes[NSAttributedStringKey.foregroundColor] = color
attributes[NSAttributedString.Key.foregroundColor] = color
}

return attributes
Expand Down
2 changes: 1 addition & 1 deletion IconFont/Example/Other/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?


func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
Expand Down

0 comments on commit 7c679e5

Please sign in to comment.