From d94ee74fdc2faac6b62a0b6243e4401cb0f23ec1 Mon Sep 17 00:00:00 2001 From: Ryan Gartin Date: Tue, 10 Apr 2018 01:25:20 -0400 Subject: [PATCH 1/5] Update for swift 4.1 --- Icomoon.xcodeproj/project.pbxproj | 30 ++++++++++---- .../xcshareddata/xcschemes/Icomoon.xcscheme | 2 +- Icomoon/Icomoon.swift | 40 ++++++++++++------- Icomoon/Info.plist | 2 +- 4 files changed, 50 insertions(+), 24 deletions(-) diff --git a/Icomoon.xcodeproj/project.pbxproj b/Icomoon.xcodeproj/project.pbxproj index 2388ec8..4ce501c 100644 --- a/Icomoon.xcodeproj/project.pbxproj +++ b/Icomoon.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 46; + objectVersion = 48; objects = { /* Begin PBXBuildFile section */ @@ -99,7 +99,7 @@ 8FFB56221C2D7BFB00D2BE62 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0800; + LastUpgradeCheck = 0930; ORGANIZATIONNAME = Optonaut; TargetAttributes = { 8FFB562A1C2D7BFB00D2BE62 = { @@ -109,7 +109,7 @@ }; }; buildConfigurationList = 8FFB56251C2D7BFB00D2BE62 /* Build configuration list for PBXProject "Icomoon" */; - compatibilityVersion = "Xcode 3.2"; + compatibilityVersion = "Xcode 8.0"; developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( @@ -158,14 +158,22 @@ CLANG_CXX_LIBRARY = "compiler-default"; 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_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; + CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; @@ -196,7 +204,7 @@ OTHER_CFLAGS = "-fembed-bitcode"; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.0; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -212,14 +220,22 @@ CLANG_CXX_LIBRARY = "compiler-default"; 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_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; + CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; @@ -243,7 +259,7 @@ OTHER_CFLAGS = "-fembed-bitcode"; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.0; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; @@ -270,7 +286,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3; + SWIFT_VERSION = 4.0; TARGETED_DEVICE_FAMILY = 1; }; name = Debug; @@ -294,7 +310,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.optonaut.Icomoon; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.0; TARGETED_DEVICE_FAMILY = 1; }; name = Release; diff --git a/Icomoon.xcodeproj/xcshareddata/xcschemes/Icomoon.xcscheme b/Icomoon.xcodeproj/xcshareddata/xcschemes/Icomoon.xcscheme index 5943313..764d9e6 100644 --- a/Icomoon.xcodeproj/xcshareddata/xcschemes/Icomoon.xcscheme +++ b/Icomoon.xcodeproj/xcshareddata/xcschemes/Icomoon.xcscheme @@ -1,6 +1,6 @@ ? - if !CTFontManagerRegisterGraphicsFont(font, &error) { - let errorDescription: CFString = CFErrorCopyDescription(error!.takeUnretainedValue()) - let nsError = error!.takeUnretainedValue() as AnyObject as! NSError - NSException(name: NSExceptionName.internalInconsistencyException, reason: errorDescription as String, userInfo: [NSUnderlyingErrorKey: nsError]).raise() - } + else { return } + + var error: Unmanaged? + if !CTFontManagerRegisterGraphicsFont(font, &error) { + let errorDescription: CFString = CFErrorCopyDescription(error!.takeUnretainedValue()) + let nsError = error!.takeUnretainedValue() as AnyObject as! NSError + NSException(name: NSExceptionName.internalInconsistencyException, reason: errorDescription as String, userInfo: [NSUnderlyingErrorKey: nsError]).raise() } + } } @@ -48,9 +50,9 @@ public extension UIImage { paragraph.lineBreakMode = .byWordWrapping paragraph.alignment = .center let attributes = [ - NSFontAttributeName: UIFont.iconOfSize(fontSize), - NSForegroundColorAttributeName: textColor, - NSParagraphStyleAttributeName: paragraph + NSAttributedStringKey.font: UIFont.iconOfSize(fontSize), + NSAttributedStringKey.foregroundColor: textColor, + NSAttributedStringKey.paragraphStyle: paragraph ] let attributedString = NSAttributedString(string: String.iconWithName(name) as String, attributes: attributes) let stringSize = sizeOfAttributeString(attributedString) @@ -69,7 +71,15 @@ public extension UIImage { let fontAspectRatio: CGFloat = 1.28571429 let fontSize = min(size.width / fontAspectRatio, size.height) - let attributedString = NSAttributedString(string: String.iconWithName(name) as String, attributes: [NSFontAttributeName: UIFont.iconOfSize(fontSize), NSForegroundColorAttributeName: textColor, NSBackgroundColorAttributeName: backgroundColor, NSParagraphStyleAttributeName: paragraph]) + let attributedString = NSAttributedString( + string: String.iconWithName(name) as String, + attributes: [ + NSAttributedStringKey.font: UIFont.iconOfSize(fontSize), + NSAttributedStringKey.foregroundColor: textColor, + NSAttributedStringKey.backgroundColor: backgroundColor, + NSAttributedStringKey.paragraphStyle: paragraph + ] + ) UIGraphicsBeginImageContextWithOptions(size, false , 0.0) attributedString.draw(in: CGRect(x: 0, y: (size.height - fontSize) / 2, width: size.width, height: fontSize)) let image = UIGraphicsGetImageFromCurrentImageContext() @@ -80,7 +90,7 @@ public extension UIImage { public extension String { public static func iconWithName(_ name: Icon) -> String { - return name.rawValue.substring(to: name.rawValue.characters.index(name.rawValue.startIndex, offsetBy: 1)) + return String(name.rawValue[..CFBundlePackageType FMWK CFBundleShortVersionString - 1.0 + 2.0 CFBundleVersion $(CURRENT_PROJECT_VERSION) From 14d867f9c4378ef3bdd773825fe08813d3d4499b Mon Sep 17 00:00:00 2001 From: nitrag Date: Tue, 1 May 2018 02:00:16 -0400 Subject: [PATCH 2/5] Update README.md Fix missing step, must check "Run script when installing" or else simulator builds will fail --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 289ca68..02e2a58 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ searchIcon.font = UIFont.iconOfSize(30) ### Strip Architectures -![](http://i.imgur.com/gmXJXPg.jpg) +![](https://imgur.com/a/43bb3Dh.jpg) In order to submit to App Store, you'll need to automatically strip unsupported Architectures. Add this Run Script to you Build Phases, AFTER *Embed Frameworks*: From f8d04956339706913b72c51bdde2999434cd533f Mon Sep 17 00:00:00 2001 From: Ryan Gartin Date: Fri, 29 Mar 2019 11:44:54 -0400 Subject: [PATCH 3/5] update for swift 5 --- Icomoon.xcodeproj/project.pbxproj | 5 +++-- .../xcshareddata/IDEWorkspaceChecks.plist | 8 ++++++++ Icomoon/Icomoon.swift | 14 +++++++------- 3 files changed, 18 insertions(+), 9 deletions(-) create mode 100644 Icomoon.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/Icomoon.xcodeproj/project.pbxproj b/Icomoon.xcodeproj/project.pbxproj index 4ce501c..2e7cf71 100644 --- a/Icomoon.xcodeproj/project.pbxproj +++ b/Icomoon.xcodeproj/project.pbxproj @@ -113,6 +113,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, ); mainGroup = 8FFB56211C2D7BFB00D2BE62; @@ -286,7 +287,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 1; }; name = Debug; @@ -310,7 +311,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.optonaut.Icomoon; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 1; }; name = Release; diff --git a/Icomoon.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Icomoon.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/Icomoon.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/Icomoon/Icomoon.swift b/Icomoon/Icomoon.swift index 7d5abca..6682f44 100644 --- a/Icomoon/Icomoon.swift +++ b/Icomoon/Icomoon.swift @@ -50,9 +50,9 @@ public extension UIImage { paragraph.lineBreakMode = .byWordWrapping paragraph.alignment = .center let attributes = [ - NSAttributedStringKey.font: UIFont.iconOfSize(fontSize), - NSAttributedStringKey.foregroundColor: textColor, - NSAttributedStringKey.paragraphStyle: paragraph + NSAttributedString.Key.font: UIFont.iconOfSize(fontSize), + NSAttributedString.Key.foregroundColor: textColor, + NSAttributedString.Key.paragraphStyle: paragraph ] let attributedString = NSAttributedString(string: String.iconWithName(name) as String, attributes: attributes) let stringSize = sizeOfAttributeString(attributedString) @@ -74,10 +74,10 @@ public extension UIImage { let attributedString = NSAttributedString( string: String.iconWithName(name) as String, attributes: [ - NSAttributedStringKey.font: UIFont.iconOfSize(fontSize), - NSAttributedStringKey.foregroundColor: textColor, - NSAttributedStringKey.backgroundColor: backgroundColor, - NSAttributedStringKey.paragraphStyle: paragraph + NSAttributedString.Key.font: UIFont.iconOfSize(fontSize), + NSAttributedString.Key.foregroundColor: textColor, + NSAttributedString.Key.backgroundColor: backgroundColor, + NSAttributedString.Key.paragraphStyle: paragraph ] ) UIGraphicsBeginImageContextWithOptions(size, false , 0.0) From 486d75aa34b03fea0e1026ce28ea565508c6dbd5 Mon Sep 17 00:00:00 2001 From: Ryan Gartin Date: Sun, 22 Sep 2019 16:20:56 -0400 Subject: [PATCH 4/5] Swift 5.1, XCode 11 --- Icomoon.xcodeproj/project.pbxproj | 12 +++++++----- .../xcshareddata/xcschemes/Icomoon.xcscheme | 6 +----- Icomoon/Icomoon.swift | 8 ++++---- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/Icomoon.xcodeproj/project.pbxproj b/Icomoon.xcodeproj/project.pbxproj index 2e7cf71..75ca316 100644 --- a/Icomoon.xcodeproj/project.pbxproj +++ b/Icomoon.xcodeproj/project.pbxproj @@ -99,7 +99,7 @@ 8FFB56221C2D7BFB00D2BE62 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0930; + LastUpgradeCheck = 1100; ORGANIZATIONNAME = Optonaut; TargetAttributes = { 8FFB562A1C2D7BFB00D2BE62 = { @@ -110,11 +110,11 @@ }; buildConfigurationList = 8FFB56251C2D7BFB00D2BE62 /* Build configuration list for PBXProject "Icomoon" */; compatibilityVersion = "Xcode 8.0"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( - English, en, + Base, ); mainGroup = 8FFB56211C2D7BFB00D2BE62; productRefGroup = 8FFB562C1C2D7BFB00D2BE62 /* Products */; @@ -155,6 +155,7 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; BITCODE_GENERATION_MODE = bitcode; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "compiler-default"; CLANG_CXX_LIBRARY = "compiler-default"; CLANG_ENABLE_MODULES = YES; @@ -217,6 +218,7 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; BITCODE_GENERATION_MODE = bitcode; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "compiler-default"; CLANG_CXX_LIBRARY = "compiler-default"; CLANG_ENABLE_MODULES = YES; @@ -288,7 +290,7 @@ SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = 1; + TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; }; @@ -312,7 +314,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = 1; + TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; }; diff --git a/Icomoon.xcodeproj/xcshareddata/xcschemes/Icomoon.xcscheme b/Icomoon.xcodeproj/xcshareddata/xcschemes/Icomoon.xcscheme index 764d9e6..fd80370 100644 --- a/Icomoon.xcodeproj/xcshareddata/xcschemes/Icomoon.xcscheme +++ b/Icomoon.xcodeproj/xcshareddata/xcschemes/Icomoon.xcscheme @@ -1,6 +1,6 @@ - - - - UIFont { + static func iconOfSize(_ fontSize: CGFloat) -> UIFont { if !_loaded { if UIFont.fontNames(forFamilyName: Font.FontName).count == 0 { FontLoader.loadFont() @@ -45,7 +45,7 @@ public extension UIFont { } public extension UIImage { - public static func iconWithName(_ name: Icon, textColor: UIColor, fontSize: CGFloat, offset: CGSize = CGSize.zero) -> UIImage { + static func iconWithName(_ name: Icon, textColor: UIColor, fontSize: CGFloat, offset: CGSize = CGSize.zero) -> UIImage { let paragraph = NSMutableParagraphStyle() paragraph.lineBreakMode = .byWordWrapping paragraph.alignment = .center @@ -63,7 +63,7 @@ public extension UIImage { UIGraphicsEndImageContext() return image! } - public static func icomoonIcon(name: Icon, textColor: UIColor, size: CGSize, backgroundColor: UIColor = UIColor.clear) -> UIImage { + static func icomoonIcon(name: Icon, textColor: UIColor, size: CGSize, backgroundColor: UIColor = UIColor.clear) -> UIImage { let paragraph = NSMutableParagraphStyle() paragraph.alignment = NSTextAlignment.center @@ -89,7 +89,7 @@ public extension UIImage { } public extension String { - public static func iconWithName(_ name: Icon) -> String { + static func iconWithName(_ name: Icon) -> String { return String(name.rawValue[.. Date: Tue, 12 Nov 2019 23:08:54 -0500 Subject: [PATCH 5/5] Bump swift version --- Icomoon.xcodeproj/project.pbxproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Icomoon.xcodeproj/project.pbxproj b/Icomoon.xcodeproj/project.pbxproj index 75ca316..2e3899e 100644 --- a/Icomoon.xcodeproj/project.pbxproj +++ b/Icomoon.xcodeproj/project.pbxproj @@ -206,7 +206,7 @@ OTHER_CFLAGS = "-fembed-bitcode"; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -262,7 +262,7 @@ OTHER_CFLAGS = "-fembed-bitcode"; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic";