From 4a9a38f145054f74e1e34810e25dc71b99f6453c Mon Sep 17 00:00:00 2001 From: Mark Turner Date: Thu, 13 Apr 2017 14:07:51 +1000 Subject: [PATCH 1/7] Added ability to set the line spacing. --- ...leAttributedString+ChainedAttributes.swift | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/ChainedAttributedString/NSMutableAttributedString+ChainedAttributes.swift b/ChainedAttributedString/NSMutableAttributedString+ChainedAttributes.swift index 1eac828..2177aa2 100644 --- a/ChainedAttributedString/NSMutableAttributedString+ChainedAttributes.swift +++ b/ChainedAttributedString/NSMutableAttributedString+ChainedAttributes.swift @@ -220,6 +220,31 @@ public extension NSMutableAttributedString { return self } + /** + This function adds paragraphy style with line spacing to attributed string. + + - warning: If text passed in "text" parameter is not found, attribute will be applied to whole attributed string. Only first occurence of "text" is styled. + + - parameter value - CGFloat which should be applied as linespacing to the paragraph style + - parameter text - String for which the paragraph style will be applied to (optional, default = whole attributed string) + + - returns: Modified NSMutableAttributedString + */ + func lineSpacing(_ value:CGFloat, forText text:String? = nil) -> NSMutableAttributedString { + + var attributeRange:NSRange? = nil + if let textForAttribute = text { + attributeRange = self.getRangeOfStringInSelf(textForAttribute) + } + + let paragraphStyle = NSMutableParagraphStyle() + paragraphStyle.lineSpacing = value + + self.applyAttribute(NSParagraphStyleAttributeName, withValue: paragraphStyle as AnyObject, forRange: attributeRange) + + return self + } + // MARK: Clear attributes /** From 3de9a1a48071784d5ef67a16291a432919f10309 Mon Sep 17 00:00:00 2001 From: Mark Turner Date: Thu, 13 Apr 2017 14:08:01 +1000 Subject: [PATCH 2/7] Updating example project to set the line spacing. --- Example/Example/ViewController.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Example/Example/ViewController.swift b/Example/Example/ViewController.swift index c197ff6..52428d0 100644 --- a/Example/Example/ViewController.swift +++ b/Example/Example/ViewController.swift @@ -20,13 +20,14 @@ class ViewController: UIViewController { let one = "Test".attributedString() + "One".attributedString() //apply attributes - self.exampleLabel.attributedText = "This sample text shows chained attributes".attributedString() + self.exampleLabel.attributedText = "This sample text shows chained attributes\nWith line spacing as an option".attributedString() .textColor(UIColor.red, forText: "sample") .font(UIFont.boldSystemFont(ofSize: 20), forText: "This") .kernSpacing(-1, forText: "text") .strikeThrough(2, forText: "shows") .strikeThroughColor(UIColor.blue) .underline(2, forText: "attributes") + .lineSpacing(10) } From 9bf0540e492f875940b9f401c97b9b1457ad5cc7 Mon Sep 17 00:00:00 2001 From: Mark Turner Date: Thu, 20 Jul 2017 11:30:21 +0100 Subject: [PATCH 3/7] Added ability to set the paragraph alignment. --- ...leAttributedString+ChainedAttributes.swift | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/ChainedAttributedString/NSMutableAttributedString+ChainedAttributes.swift b/ChainedAttributedString/NSMutableAttributedString+ChainedAttributes.swift index 1eac828..e7ad517 100644 --- a/ChainedAttributedString/NSMutableAttributedString+ChainedAttributes.swift +++ b/ChainedAttributedString/NSMutableAttributedString+ChainedAttributes.swift @@ -220,6 +220,31 @@ public extension NSMutableAttributedString { return self } + /** + This function adds paragraph style with text alignment attributed string. + + - warning: If text passed in "text" parameter is not found, attribute will be applied to whole attributed string. Only first occurence of "text" is styled. + + - parameter alignment - NSTextAlignment which should be applied as alignment to the paragraph style + - parameter text - String for which the paragraph style will be applied to (optional, default = whole attributed string) + + - returns: Modified NSMutableAttributedString + */ + func alignment(_ alignment:NSTextAlignment, forText text:String? = nil) -> NSMutableAttributedString { + + var attributeRange:NSRange? = nil + if let textForAttribute = text { + attributeRange = self.getRangeOfStringInSelf(textForAttribute) + } + + let paragraphStyle = NSMutableParagraphStyle() + paragraphStyle.alignment = .center + + self.applyAttribute(NSParagraphStyleAttributeName, withValue: paragraphStyle as AnyObject, forRange: attributeRange) + + return self + } + // MARK: Clear attributes /** From 6a2219a449e5f72afb4bf96476491390eb46985c Mon Sep 17 00:00:00 2001 From: Mark Turner Date: Thu, 20 Jul 2017 11:30:44 +0100 Subject: [PATCH 4/7] Updating example project to set the paragraph alignment. --- Example/Example/ViewController.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Example/Example/ViewController.swift b/Example/Example/ViewController.swift index c197ff6..137b843 100644 --- a/Example/Example/ViewController.swift +++ b/Example/Example/ViewController.swift @@ -27,7 +27,7 @@ class ViewController: UIViewController { .strikeThrough(2, forText: "shows") .strikeThroughColor(UIColor.blue) .underline(2, forText: "attributes") - + .alignment(.center) } } From 36a24670207d67cc1884ef93c0b7f8221352df8f Mon Sep 17 00:00:00 2001 From: Mark Turner Date: Thu, 20 Jul 2017 11:43:40 +0100 Subject: [PATCH 5/7] Added ability to set paragraph style. --- ...utableAttributedString+ChainedAttributes.swift | 15 +++++++++++++++ Example/Example/ViewController.swift | 8 ++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/ChainedAttributedString/NSMutableAttributedString+ChainedAttributes.swift b/ChainedAttributedString/NSMutableAttributedString+ChainedAttributes.swift index dfb342d..14dd0c8 100644 --- a/ChainedAttributedString/NSMutableAttributedString+ChainedAttributes.swift +++ b/ChainedAttributedString/NSMutableAttributedString+ChainedAttributes.swift @@ -245,6 +245,21 @@ public extension NSMutableAttributedString { return self } + /** + This function adds paragraphy style to attributed string. + */ + + func paragraphStyle(_ paragraphStyle:NSParagraphStyle, forText text:String? = nil) -> NSMutableAttributedString { + var attributeRange:NSRange? = nil + if let textForAttribute = text { + attributeRange = self.getRangeOfStringInSelf(textForAttribute) + } + + self.applyAttribute(NSParagraphStyleAttributeName, withValue: paragraphStyle as AnyObject, forRange: attributeRange) + + return self + } + /** This function adds paragraph style with text alignment attributed string. diff --git a/Example/Example/ViewController.swift b/Example/Example/ViewController.swift index 8b24172..9a5de40 100644 --- a/Example/Example/ViewController.swift +++ b/Example/Example/ViewController.swift @@ -27,8 +27,12 @@ class ViewController: UIViewController { .strikeThrough(2, forText: "shows") .strikeThroughColor(UIColor.blue) .underline(2, forText: "attributes") - .lineSpacing(10) - .alignment(.center) + .paragraphStyle({ + let paragraphStyle = NSMutableParagraphStyle() + paragraphStyle.lineSpacing = 30 + paragraphStyle.alignment = .center + return paragraphStyle + }()) } } From af98b90982bc62f5df178b63226a3e63cc9eb4d1 Mon Sep 17 00:00:00 2001 From: Maxim Anisimov Date: Thu, 28 Sep 2017 15:47:20 +0300 Subject: [PATCH 6/7] Convert to Swift 4 --- ...leAttributedString+ChainedAttributes.swift | 26 +++++++------- Example/Example.xcodeproj/project.pbxproj | 27 ++++++++++++--- .../AppIcon.appiconset/Contents.json | 30 ++++++++++++++++ ...leAttributedString+ChainedAttributes.swift | 20 +++++------ Example/Example/ViewController.swift | 2 +- Example/Pods/Pods.xcodeproj/project.pbxproj | 34 +++++++++++++++++-- 6 files changed, 108 insertions(+), 31 deletions(-) diff --git a/ChainedAttributedString/NSMutableAttributedString+ChainedAttributes.swift b/ChainedAttributedString/NSMutableAttributedString+ChainedAttributes.swift index 14dd0c8..bbb5366 100644 --- a/ChainedAttributedString/NSMutableAttributedString+ChainedAttributes.swift +++ b/ChainedAttributedString/NSMutableAttributedString+ChainedAttributes.swift @@ -31,7 +31,7 @@ public extension NSMutableAttributedString { attributeRange = self.getRangeOfStringInSelf(textForAttribute) } - self.applyAttribute(NSForegroundColorAttributeName, withValue: value, forRange: attributeRange) + self.applyAttribute(NSAttributedStringKey.foregroundColor, withValue: value, forRange: attributeRange) return self } @@ -54,7 +54,7 @@ public extension NSMutableAttributedString { attributeRange = self.getRangeOfStringInSelf(textForAttribute) } - self.applyAttribute(NSFontAttributeName, withValue: value, forRange: attributeRange) + self.applyAttribute(NSAttributedStringKey.font, withValue: value, forRange: attributeRange) return self } @@ -77,7 +77,7 @@ public extension NSMutableAttributedString { attributeRange = self.getRangeOfStringInSelf(textForAttribute) } - self.applyAttribute(NSBackgroundColorAttributeName, withValue: value, forRange: attributeRange) + self.applyAttribute(NSAttributedStringKey.backgroundColor, withValue: value, forRange: attributeRange) return self } @@ -100,7 +100,7 @@ public extension NSMutableAttributedString { attributeRange = self.getRangeOfStringInSelf(textForAttribute) } - self.applyAttribute(NSKernAttributeName, withValue: value as AnyObject, forRange: attributeRange) + self.applyAttribute(NSAttributedStringKey.kern, withValue: value as AnyObject, forRange: attributeRange) return self } @@ -123,7 +123,7 @@ public extension NSMutableAttributedString { attributeRange = self.getRangeOfStringInSelf(textForAttribute) } - self.applyAttribute(NSUnderlineStyleAttributeName, withValue: value as AnyObject, forRange: attributeRange) + self.applyAttribute(NSAttributedStringKey.underlineStyle, withValue: value as AnyObject, forRange: attributeRange) return self } @@ -146,7 +146,7 @@ public extension NSMutableAttributedString { attributeRange = self.getRangeOfStringInSelf(textForAttribute) } - self.applyAttribute(NSUnderlineColorAttributeName, withValue: value, forRange: attributeRange) + self.applyAttribute(NSAttributedStringKey.underlineColor, withValue: value, forRange: attributeRange) return self } @@ -169,7 +169,7 @@ public extension NSMutableAttributedString { attributeRange = self.getRangeOfStringInSelf(textForAttribute) } - self.applyAttribute(NSStrikethroughStyleAttributeName, withValue: value as AnyObject, forRange: attributeRange) + self.applyAttribute(NSAttributedStringKey.strikethroughStyle, withValue: value as AnyObject, forRange: attributeRange) return self } @@ -192,7 +192,7 @@ public extension NSMutableAttributedString { attributeRange = self.getRangeOfStringInSelf(textForAttribute) } - self.applyAttribute(NSStrikethroughColorAttributeName, withValue: value, forRange: attributeRange) + self.applyAttribute(NSAttributedStringKey.strikethroughColor, withValue: value, forRange: attributeRange) return self } @@ -215,7 +215,7 @@ public extension NSMutableAttributedString { attributeRange = self.getRangeOfStringInSelf(textForAttribute) } - self.applyAttribute(NSLinkAttributeName, withValue: value as AnyObject, forRange: attributeRange) + self.applyAttribute(NSAttributedStringKey.link, withValue: value as AnyObject, forRange: attributeRange) return self } @@ -240,7 +240,7 @@ public extension NSMutableAttributedString { let paragraphStyle = NSMutableParagraphStyle() paragraphStyle.lineSpacing = value - self.applyAttribute(NSParagraphStyleAttributeName, withValue: paragraphStyle as AnyObject, forRange: attributeRange) + self.applyAttribute(NSAttributedStringKey.paragraphStyle, withValue: paragraphStyle as AnyObject, forRange: attributeRange) return self } @@ -255,7 +255,7 @@ public extension NSMutableAttributedString { attributeRange = self.getRangeOfStringInSelf(textForAttribute) } - self.applyAttribute(NSParagraphStyleAttributeName, withValue: paragraphStyle as AnyObject, forRange: attributeRange) + self.applyAttribute(NSAttributedStringKey.paragraphStyle, withValue: paragraphStyle as AnyObject, forRange: attributeRange) return self } @@ -280,7 +280,7 @@ public extension NSMutableAttributedString { let paragraphStyle = NSMutableParagraphStyle() paragraphStyle.alignment = .center - self.applyAttribute(NSParagraphStyleAttributeName, withValue: paragraphStyle as AnyObject, forRange: attributeRange) + self.applyAttribute(NSAttributedStringKey.paragraphStyle, withValue: paragraphStyle as AnyObject, forRange: attributeRange) return self } @@ -314,7 +314,7 @@ public extension NSMutableAttributedString { // MARK: Applying attributes - fileprivate func applyAttribute(_ attributeName:String, withValue value:AnyObject, forRange range:NSRange? = nil) { + fileprivate func applyAttribute(_ attributeName: NSAttributedStringKey, withValue value: AnyObject, forRange range: NSRange? = nil) { let attributeRange = range ?? self.getRangeOfSelf() self.addAttribute(attributeName, value: value, range: attributeRange) diff --git a/Example/Example.xcodeproj/project.pbxproj b/Example/Example.xcodeproj/project.pbxproj index 147288c..567aca0 100644 --- a/Example/Example.xcodeproj/project.pbxproj +++ b/Example/Example.xcodeproj/project.pbxproj @@ -127,12 +127,12 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0730; - LastUpgradeCheck = 0730; + LastUpgradeCheck = 0900; ORGANIZATIONNAME = Example; TargetAttributes = { E0C323FD1D2463D000712168 = { CreatedOnToolsVersion = 7.3; - LastSwiftMigration = 0800; + LastSwiftMigration = 0900; ProvisioningStyle = Manual; }; }; @@ -260,13 +260,21 @@ 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; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; @@ -306,13 +314,21 @@ 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; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; @@ -331,6 +347,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 9.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; }; @@ -340,6 +357,7 @@ isa = XCBuildConfiguration; baseConfigurationReference = 1B5DE12EDCA817CEB23756C0 /* Pods-Example.debug.xcconfig */; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Example/Info.plist; @@ -347,7 +365,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.example.Example; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.0; }; name = Debug; }; @@ -355,6 +373,7 @@ isa = XCBuildConfiguration; baseConfigurationReference = FA3411A5A628154C440137FA /* Pods-Example.release.xcconfig */; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Example/Info.plist; @@ -362,7 +381,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.example.Example; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.0; }; name = Release; }; diff --git a/Example/Example/Assets.xcassets/AppIcon.appiconset/Contents.json b/Example/Example/Assets.xcassets/AppIcon.appiconset/Contents.json index 36d2c80..d8db8d6 100644 --- a/Example/Example/Assets.xcassets/AppIcon.appiconset/Contents.json +++ b/Example/Example/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -1,5 +1,15 @@ { "images" : [ + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "3x" + }, { "idiom" : "iphone", "size" : "29x29", @@ -30,6 +40,16 @@ "size" : "60x60", "scale" : "3x" }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "2x" + }, { "idiom" : "ipad", "size" : "29x29", @@ -59,6 +79,16 @@ "idiom" : "ipad", "size" : "76x76", "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "83.5x83.5", + "scale" : "2x" + }, + { + "idiom" : "ios-marketing", + "size" : "1024x1024", + "scale" : "1x" } ], "info" : { diff --git a/Example/Example/NSMutableAttributedString+ChainedAttributes.swift b/Example/Example/NSMutableAttributedString+ChainedAttributes.swift index 1eac828..2805955 100644 --- a/Example/Example/NSMutableAttributedString+ChainedAttributes.swift +++ b/Example/Example/NSMutableAttributedString+ChainedAttributes.swift @@ -31,7 +31,7 @@ public extension NSMutableAttributedString { attributeRange = self.getRangeOfStringInSelf(textForAttribute) } - self.applyAttribute(NSForegroundColorAttributeName, withValue: value, forRange: attributeRange) + self.applyAttribute(NSAttributedStringKey.foregroundColor, withValue: value, forRange: attributeRange) return self } @@ -54,7 +54,7 @@ public extension NSMutableAttributedString { attributeRange = self.getRangeOfStringInSelf(textForAttribute) } - self.applyAttribute(NSFontAttributeName, withValue: value, forRange: attributeRange) + self.applyAttribute(NSAttributedStringKey.font, withValue: value, forRange: attributeRange) return self } @@ -77,7 +77,7 @@ public extension NSMutableAttributedString { attributeRange = self.getRangeOfStringInSelf(textForAttribute) } - self.applyAttribute(NSBackgroundColorAttributeName, withValue: value, forRange: attributeRange) + self.applyAttribute(NSAttributedStringKey.backgroundColor, withValue: value, forRange: attributeRange) return self } @@ -100,7 +100,7 @@ public extension NSMutableAttributedString { attributeRange = self.getRangeOfStringInSelf(textForAttribute) } - self.applyAttribute(NSKernAttributeName, withValue: value as AnyObject, forRange: attributeRange) + self.applyAttribute(NSAttributedStringKey.kern, withValue: value as AnyObject, forRange: attributeRange) return self } @@ -123,7 +123,7 @@ public extension NSMutableAttributedString { attributeRange = self.getRangeOfStringInSelf(textForAttribute) } - self.applyAttribute(NSUnderlineStyleAttributeName, withValue: value as AnyObject, forRange: attributeRange) + self.applyAttribute(NSAttributedStringKey.underlineStyle, withValue: value as AnyObject, forRange: attributeRange) return self } @@ -146,7 +146,7 @@ public extension NSMutableAttributedString { attributeRange = self.getRangeOfStringInSelf(textForAttribute) } - self.applyAttribute(NSUnderlineColorAttributeName, withValue: value, forRange: attributeRange) + self.applyAttribute(NSAttributedStringKey.underlineColor, withValue: value, forRange: attributeRange) return self } @@ -169,7 +169,7 @@ public extension NSMutableAttributedString { attributeRange = self.getRangeOfStringInSelf(textForAttribute) } - self.applyAttribute(NSStrikethroughStyleAttributeName, withValue: value as AnyObject, forRange: attributeRange) + self.applyAttribute(NSAttributedStringKey.strikethroughStyle, withValue: value as AnyObject, forRange: attributeRange) return self } @@ -192,7 +192,7 @@ public extension NSMutableAttributedString { attributeRange = self.getRangeOfStringInSelf(textForAttribute) } - self.applyAttribute(NSStrikethroughColorAttributeName, withValue: value, forRange: attributeRange) + self.applyAttribute(NSAttributedStringKey.strikethroughColor, withValue: value, forRange: attributeRange) return self } @@ -215,7 +215,7 @@ public extension NSMutableAttributedString { attributeRange = self.getRangeOfStringInSelf(textForAttribute) } - self.applyAttribute(NSLinkAttributeName, withValue: value as AnyObject, forRange: attributeRange) + self.applyAttribute(NSAttributedStringKey.link, withValue: value as AnyObject, forRange: attributeRange) return self } @@ -249,7 +249,7 @@ public extension NSMutableAttributedString { // MARK: Applying attributes - fileprivate func applyAttribute(_ attributeName:String, withValue value:AnyObject, forRange range:NSRange? = nil) { + fileprivate func applyAttribute(_ attributeName: NSAttributedStringKey, withValue value: AnyObject, forRange range: NSRange? = nil) { let attributeRange = range ?? self.getRangeOfSelf() self.addAttribute(attributeName, value: value, range: attributeRange) diff --git a/Example/Example/ViewController.swift b/Example/Example/ViewController.swift index 9a5de40..92ef783 100644 --- a/Example/Example/ViewController.swift +++ b/Example/Example/ViewController.swift @@ -17,7 +17,7 @@ class ViewController: UIViewController { super.viewDidLoad() //join strings - let one = "Test".attributedString() + "One".attributedString() + _ = "Test".attributedString() + "One".attributedString() //apply attributes self.exampleLabel.attributedText = "This sample text shows chained attributes\nWith line spacing as an option".attributedString() diff --git a/Example/Pods/Pods.xcodeproj/project.pbxproj b/Example/Pods/Pods.xcodeproj/project.pbxproj index 07d1718..5f440f1 100644 --- a/Example/Pods/Pods.xcodeproj/project.pbxproj +++ b/Example/Pods/Pods.xcodeproj/project.pbxproj @@ -242,7 +242,12 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0730; - LastUpgradeCheck = 0700; + LastUpgradeCheck = 0900; + TargetAttributes = { + 00BE248DC4A5943C771442D86059BDFD = { + LastSwiftMigration = 0900; + }; + }; }; buildConfigurationList = 2D8E8EC45A3A1A1D94AE762CB5028504 /* Build configuration list for PBXProject "Pods" */; compatibilityVersion = "Xcode 3.2"; @@ -319,7 +324,7 @@ PRODUCT_NAME = ChainedAttributedString; SDKROOT = iphoneos; SKIP_INSTALL = YES; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.0; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -330,6 +335,7 @@ isa = XCBuildConfiguration; baseConfigurationReference = 149054C495E8EC590CAB4C524133016F /* Pods-Example.debug.xcconfig */; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; @@ -366,6 +372,7 @@ isa = XCBuildConfiguration; baseConfigurationReference = E512A5F985F876750237FD237C3AEEDA /* Pods-Example.release.xcconfig */; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; @@ -406,20 +413,30 @@ 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; 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; + 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; CODE_SIGNING_REQUIRED = NO; COPY_PHASE_STRIP = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "POD_CONFIGURATION_DEBUG=1", @@ -450,19 +467,29 @@ 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; 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; + 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; CODE_SIGNING_REQUIRED = NO; COPY_PHASE_STRIP = YES; ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; GCC_PREPROCESSOR_DEFINITIONS = ( "POD_CONFIGURATION_RELEASE=1", "$(inherited)", @@ -476,6 +503,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 9.0; PROVISIONING_PROFILE_SPECIFIER = NO_SIGNING/; STRIP_INSTALLED_PRODUCT = NO; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SYMROOT = "${SRCROOT}/../build"; VALIDATE_PRODUCT = YES; }; @@ -507,7 +535,7 @@ SDKROOT = iphoneos; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.0; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; From 1abef5f55c58c3dae5704502aaf10b0b465b01a7 Mon Sep 17 00:00:00 2001 From: Maxim Anisimov Date: Thu, 20 Sep 2018 09:46:57 +0300 Subject: [PATCH 7/7] Convert to Swift 4.2 --- ...leAttributedString+ChainedAttributes.swift | 26 +++++++++---------- Example/Example.xcodeproj/project.pbxproj | 12 ++++++--- .../xcshareddata/IDEWorkspaceChecks.plist | 8 ++++++ Example/Example/AppDelegate.swift | 2 +- ...leAttributedString+ChainedAttributes.swift | 20 +++++++------- Example/Pods/Pods.xcodeproj/project.pbxproj | 12 ++++++--- 6 files changed, 48 insertions(+), 32 deletions(-) create mode 100644 Example/Example.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/ChainedAttributedString/NSMutableAttributedString+ChainedAttributes.swift b/ChainedAttributedString/NSMutableAttributedString+ChainedAttributes.swift index bbb5366..e720ebb 100644 --- a/ChainedAttributedString/NSMutableAttributedString+ChainedAttributes.swift +++ b/ChainedAttributedString/NSMutableAttributedString+ChainedAttributes.swift @@ -31,7 +31,7 @@ public extension NSMutableAttributedString { attributeRange = self.getRangeOfStringInSelf(textForAttribute) } - self.applyAttribute(NSAttributedStringKey.foregroundColor, withValue: value, forRange: attributeRange) + self.applyAttribute(NSAttributedString.Key.foregroundColor, withValue: value, forRange: attributeRange) return self } @@ -54,7 +54,7 @@ public extension NSMutableAttributedString { attributeRange = self.getRangeOfStringInSelf(textForAttribute) } - self.applyAttribute(NSAttributedStringKey.font, withValue: value, forRange: attributeRange) + self.applyAttribute(NSAttributedString.Key.font, withValue: value, forRange: attributeRange) return self } @@ -77,7 +77,7 @@ public extension NSMutableAttributedString { attributeRange = self.getRangeOfStringInSelf(textForAttribute) } - self.applyAttribute(NSAttributedStringKey.backgroundColor, withValue: value, forRange: attributeRange) + self.applyAttribute(NSAttributedString.Key.backgroundColor, withValue: value, forRange: attributeRange) return self } @@ -100,7 +100,7 @@ public extension NSMutableAttributedString { attributeRange = self.getRangeOfStringInSelf(textForAttribute) } - self.applyAttribute(NSAttributedStringKey.kern, withValue: value as AnyObject, forRange: attributeRange) + self.applyAttribute(NSAttributedString.Key.kern, withValue: value as AnyObject, forRange: attributeRange) return self } @@ -123,7 +123,7 @@ public extension NSMutableAttributedString { attributeRange = self.getRangeOfStringInSelf(textForAttribute) } - self.applyAttribute(NSAttributedStringKey.underlineStyle, withValue: value as AnyObject, forRange: attributeRange) + self.applyAttribute(NSAttributedString.Key.underlineStyle, withValue: value as AnyObject, forRange: attributeRange) return self } @@ -146,7 +146,7 @@ public extension NSMutableAttributedString { attributeRange = self.getRangeOfStringInSelf(textForAttribute) } - self.applyAttribute(NSAttributedStringKey.underlineColor, withValue: value, forRange: attributeRange) + self.applyAttribute(NSAttributedString.Key.underlineColor, withValue: value, forRange: attributeRange) return self } @@ -169,7 +169,7 @@ public extension NSMutableAttributedString { attributeRange = self.getRangeOfStringInSelf(textForAttribute) } - self.applyAttribute(NSAttributedStringKey.strikethroughStyle, withValue: value as AnyObject, forRange: attributeRange) + self.applyAttribute(NSAttributedString.Key.strikethroughStyle, withValue: value as AnyObject, forRange: attributeRange) return self } @@ -192,7 +192,7 @@ public extension NSMutableAttributedString { attributeRange = self.getRangeOfStringInSelf(textForAttribute) } - self.applyAttribute(NSAttributedStringKey.strikethroughColor, withValue: value, forRange: attributeRange) + self.applyAttribute(NSAttributedString.Key.strikethroughColor, withValue: value, forRange: attributeRange) return self } @@ -215,7 +215,7 @@ public extension NSMutableAttributedString { attributeRange = self.getRangeOfStringInSelf(textForAttribute) } - self.applyAttribute(NSAttributedStringKey.link, withValue: value as AnyObject, forRange: attributeRange) + self.applyAttribute(NSAttributedString.Key.link, withValue: value as AnyObject, forRange: attributeRange) return self } @@ -240,7 +240,7 @@ public extension NSMutableAttributedString { let paragraphStyle = NSMutableParagraphStyle() paragraphStyle.lineSpacing = value - self.applyAttribute(NSAttributedStringKey.paragraphStyle, withValue: paragraphStyle as AnyObject, forRange: attributeRange) + self.applyAttribute(NSAttributedString.Key.paragraphStyle, withValue: paragraphStyle as AnyObject, forRange: attributeRange) return self } @@ -255,7 +255,7 @@ public extension NSMutableAttributedString { attributeRange = self.getRangeOfStringInSelf(textForAttribute) } - self.applyAttribute(NSAttributedStringKey.paragraphStyle, withValue: paragraphStyle as AnyObject, forRange: attributeRange) + self.applyAttribute(NSAttributedString.Key.paragraphStyle, withValue: paragraphStyle as AnyObject, forRange: attributeRange) return self } @@ -280,7 +280,7 @@ public extension NSMutableAttributedString { let paragraphStyle = NSMutableParagraphStyle() paragraphStyle.alignment = .center - self.applyAttribute(NSAttributedStringKey.paragraphStyle, withValue: paragraphStyle as AnyObject, forRange: attributeRange) + self.applyAttribute(NSAttributedString.Key.paragraphStyle, withValue: paragraphStyle as AnyObject, forRange: attributeRange) return self } @@ -314,7 +314,7 @@ public extension NSMutableAttributedString { // MARK: Applying attributes - fileprivate func applyAttribute(_ attributeName: NSAttributedStringKey, withValue value: AnyObject, forRange range: NSRange? = nil) { + fileprivate func applyAttribute(_ attributeName: NSAttributedString.Key, withValue value: AnyObject, forRange range: NSRange? = nil) { let attributeRange = range ?? self.getRangeOfSelf() self.addAttribute(attributeName, value: value, range: attributeRange) diff --git a/Example/Example.xcodeproj/project.pbxproj b/Example/Example.xcodeproj/project.pbxproj index 567aca0..61f82b5 100644 --- a/Example/Example.xcodeproj/project.pbxproj +++ b/Example/Example.xcodeproj/project.pbxproj @@ -127,12 +127,12 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0730; - LastUpgradeCheck = 0900; + LastUpgradeCheck = 1000; ORGANIZATIONNAME = Example; TargetAttributes = { E0C323FD1D2463D000712168 = { CreatedOnToolsVersion = 7.3; - LastSwiftMigration = 0900; + LastSwiftMigration = 1000; ProvisioningStyle = Manual; }; }; @@ -264,12 +264,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; @@ -318,12 +320,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; @@ -365,7 +369,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.example.Example; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; }; name = Debug; }; @@ -381,7 +385,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.example.Example; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; }; name = Release; }; diff --git a/Example/Example.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Example/Example.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/Example/Example.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/Example/Example/AppDelegate.swift b/Example/Example/AppDelegate.swift index 205056c..0673675 100644 --- a/Example/Example/AppDelegate.swift +++ b/Example/Example/AppDelegate.swift @@ -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 } diff --git a/Example/Example/NSMutableAttributedString+ChainedAttributes.swift b/Example/Example/NSMutableAttributedString+ChainedAttributes.swift index 2805955..2268efc 100644 --- a/Example/Example/NSMutableAttributedString+ChainedAttributes.swift +++ b/Example/Example/NSMutableAttributedString+ChainedAttributes.swift @@ -31,7 +31,7 @@ public extension NSMutableAttributedString { attributeRange = self.getRangeOfStringInSelf(textForAttribute) } - self.applyAttribute(NSAttributedStringKey.foregroundColor, withValue: value, forRange: attributeRange) + self.applyAttribute(NSAttributedString.Key.foregroundColor, withValue: value, forRange: attributeRange) return self } @@ -54,7 +54,7 @@ public extension NSMutableAttributedString { attributeRange = self.getRangeOfStringInSelf(textForAttribute) } - self.applyAttribute(NSAttributedStringKey.font, withValue: value, forRange: attributeRange) + self.applyAttribute(NSAttributedString.Key.font, withValue: value, forRange: attributeRange) return self } @@ -77,7 +77,7 @@ public extension NSMutableAttributedString { attributeRange = self.getRangeOfStringInSelf(textForAttribute) } - self.applyAttribute(NSAttributedStringKey.backgroundColor, withValue: value, forRange: attributeRange) + self.applyAttribute(NSAttributedString.Key.backgroundColor, withValue: value, forRange: attributeRange) return self } @@ -100,7 +100,7 @@ public extension NSMutableAttributedString { attributeRange = self.getRangeOfStringInSelf(textForAttribute) } - self.applyAttribute(NSAttributedStringKey.kern, withValue: value as AnyObject, forRange: attributeRange) + self.applyAttribute(NSAttributedString.Key.kern, withValue: value as AnyObject, forRange: attributeRange) return self } @@ -123,7 +123,7 @@ public extension NSMutableAttributedString { attributeRange = self.getRangeOfStringInSelf(textForAttribute) } - self.applyAttribute(NSAttributedStringKey.underlineStyle, withValue: value as AnyObject, forRange: attributeRange) + self.applyAttribute(NSAttributedString.Key.underlineStyle, withValue: value as AnyObject, forRange: attributeRange) return self } @@ -146,7 +146,7 @@ public extension NSMutableAttributedString { attributeRange = self.getRangeOfStringInSelf(textForAttribute) } - self.applyAttribute(NSAttributedStringKey.underlineColor, withValue: value, forRange: attributeRange) + self.applyAttribute(NSAttributedString.Key.underlineColor, withValue: value, forRange: attributeRange) return self } @@ -169,7 +169,7 @@ public extension NSMutableAttributedString { attributeRange = self.getRangeOfStringInSelf(textForAttribute) } - self.applyAttribute(NSAttributedStringKey.strikethroughStyle, withValue: value as AnyObject, forRange: attributeRange) + self.applyAttribute(NSAttributedString.Key.strikethroughStyle, withValue: value as AnyObject, forRange: attributeRange) return self } @@ -192,7 +192,7 @@ public extension NSMutableAttributedString { attributeRange = self.getRangeOfStringInSelf(textForAttribute) } - self.applyAttribute(NSAttributedStringKey.strikethroughColor, withValue: value, forRange: attributeRange) + self.applyAttribute(NSAttributedString.Key.strikethroughColor, withValue: value, forRange: attributeRange) return self } @@ -215,7 +215,7 @@ public extension NSMutableAttributedString { attributeRange = self.getRangeOfStringInSelf(textForAttribute) } - self.applyAttribute(NSAttributedStringKey.link, withValue: value as AnyObject, forRange: attributeRange) + self.applyAttribute(NSAttributedString.Key.link, withValue: value as AnyObject, forRange: attributeRange) return self } @@ -249,7 +249,7 @@ public extension NSMutableAttributedString { // MARK: Applying attributes - fileprivate func applyAttribute(_ attributeName: NSAttributedStringKey, withValue value: AnyObject, forRange range: NSRange? = nil) { + fileprivate func applyAttribute(_ attributeName: NSAttributedString.Key, withValue value: AnyObject, forRange range: NSRange? = nil) { let attributeRange = range ?? self.getRangeOfSelf() self.addAttribute(attributeName, value: value, range: attributeRange) diff --git a/Example/Pods/Pods.xcodeproj/project.pbxproj b/Example/Pods/Pods.xcodeproj/project.pbxproj index 5f440f1..2f1ea5f 100644 --- a/Example/Pods/Pods.xcodeproj/project.pbxproj +++ b/Example/Pods/Pods.xcodeproj/project.pbxproj @@ -242,10 +242,10 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0730; - LastUpgradeCheck = 0900; + LastUpgradeCheck = 1000; TargetAttributes = { 00BE248DC4A5943C771442D86059BDFD = { - LastSwiftMigration = 0900; + LastSwiftMigration = 1000; }; }; }; @@ -324,7 +324,7 @@ PRODUCT_NAME = ChainedAttributedString; SDKROOT = iphoneos; SKIP_INSTALL = YES; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -417,12 +417,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; 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; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; @@ -471,12 +473,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; 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; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; @@ -535,7 +539,7 @@ SDKROOT = iphoneos; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = "";