diff --git a/CHANGELOG.md b/CHANGELOG.md index af652e9..0f392b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# 4.2 (2019-05-12) + +- Update to Swift 5 (no actual source changes). +- Fixes crashing on strings like `` with dynamic attributes. + # 4.1 (2019-01-26) Update to Swift 4.2. diff --git a/Example/Podfile.lock b/Example/Podfile.lock index 8d78e95..3b371ef 100644 --- a/Example/Podfile.lock +++ b/Example/Podfile.lock @@ -4,10 +4,10 @@ PODS: - OCMock (3.4.3) - Quick (2.1.0) - Specta (1.0.7) - - ZSWTaggedString (4.1): - - ZSWTaggedString/Core (= 4.1) - - ZSWTaggedString/Core (4.1) - - ZSWTaggedString/Swift (4.1): + - ZSWTaggedString (4.2): + - ZSWTaggedString/Core (= 4.2) + - ZSWTaggedString/Core (4.2) + - ZSWTaggedString/Swift (4.2): - ZSWTaggedString/Core DEPENDENCIES: @@ -37,7 +37,7 @@ SPEC CHECKSUMS: OCMock: 43565190abc78977ad44a61c0d20d7f0784d35ab Quick: 4be43f6634acfa727dd106bdf3929ce125ffa79d Specta: 3e1bd89c3517421982dc4d1c992503e48bd5fe66 - ZSWTaggedString: c29edd1ccf2ae30a356d56382cfec6cf06bbd70f + ZSWTaggedString: 1a6aab3143188634c1e5dfe9383ce754c1fb5fe2 PODFILE CHECKSUM: 3e8e33953f0073437731a654c10dcc1880b9439e diff --git a/Example/Pods/Local Podspecs/ZSWTaggedString.podspec.json b/Example/Pods/Local Podspecs/ZSWTaggedString.podspec.json index b06fbdb..08d8d28 100644 --- a/Example/Pods/Local Podspecs/ZSWTaggedString.podspec.json +++ b/Example/Pods/Local Podspecs/ZSWTaggedString.podspec.json @@ -1,6 +1,6 @@ { "name": "ZSWTaggedString", - "version": "4.1", + "version": "4.2", "summary": "Converts a String (or NSString) with tags (like HTML) into an NSAttributedString", "description": "Tags in a ZSWTaggedString are like HTML, except you define what they mean.\nRead more: https://github.com/zacwest/ZSWTaggedString", "homepage": "https://github.com/zacwest/ZSWTaggedString", @@ -10,7 +10,7 @@ }, "source": { "git": "https://github.com/zacwest/ZSWTaggedString.git", - "tag": "4.1" + "tag": "4.2" }, "social_media_url": "https://twitter.com/zacwest", "requires_arc": true, @@ -24,7 +24,7 @@ "APPLICATION_EXTENSION_API_ONLY": "YES" }, "module_map": "ZSWTaggedString/Classes/ZSWTaggedString.modulemap", - "swift_version": "4.2", + "swift_version": "5.0", "subspecs": [ { "name": "Core", diff --git a/Example/Pods/Manifest.lock b/Example/Pods/Manifest.lock index 8d78e95..3b371ef 100644 --- a/Example/Pods/Manifest.lock +++ b/Example/Pods/Manifest.lock @@ -4,10 +4,10 @@ PODS: - OCMock (3.4.3) - Quick (2.1.0) - Specta (1.0.7) - - ZSWTaggedString (4.1): - - ZSWTaggedString/Core (= 4.1) - - ZSWTaggedString/Core (4.1) - - ZSWTaggedString/Swift (4.1): + - ZSWTaggedString (4.2): + - ZSWTaggedString/Core (= 4.2) + - ZSWTaggedString/Core (4.2) + - ZSWTaggedString/Swift (4.2): - ZSWTaggedString/Core DEPENDENCIES: @@ -37,7 +37,7 @@ SPEC CHECKSUMS: OCMock: 43565190abc78977ad44a61c0d20d7f0784d35ab Quick: 4be43f6634acfa727dd106bdf3929ce125ffa79d Specta: 3e1bd89c3517421982dc4d1c992503e48bd5fe66 - ZSWTaggedString: c29edd1ccf2ae30a356d56382cfec6cf06bbd70f + ZSWTaggedString: 1a6aab3143188634c1e5dfe9383ce754c1fb5fe2 PODFILE CHECKSUM: 3e8e33953f0073437731a654c10dcc1880b9439e diff --git a/Example/Pods/Pods.xcodeproj/project.pbxproj b/Example/Pods/Pods.xcodeproj/project.pbxproj index ce3b2c5..003c8ee 100644 --- a/Example/Pods/Pods.xcodeproj/project.pbxproj +++ b/Example/Pods/Pods.xcodeproj/project.pbxproj @@ -2028,41 +2028,9 @@ }; name = Release; }; - 1C1FC8A29DD967B88AF76358D3A85B54 /* Release */ = { + 0E80AC076567308AE66FC2E0EF75CEC9 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 3C54102318B671D33A15F922447CCFF0 /* OCMock.xcconfig */; - buildSettings = { - CODE_SIGN_IDENTITY = ""; - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - GCC_PREFIX_HEADER = "Target Support Files/OCMock/OCMock-prefix.pch"; - INFOPLIST_FILE = "Target Support Files/OCMock/OCMock-Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MODULEMAP_FILE = "Target Support Files/OCMock/OCMock.modulemap"; - PRODUCT_MODULE_NAME = OCMock; - PRODUCT_NAME = OCMock; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; - SWIFT_VERSION = 4.2; - TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Release; - }; - 24190DBB9D1F931EC4CCAFC7558C4A6B /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 6652FD1E0CE8D9D74217D32D3E9165E5 /* Quick.xcconfig */; + baseConfigurationReference = 2E8B2C50AF455BBC60BDDFD84685D607 /* Specta.xcconfig */; buildSettings = { CODE_SIGN_IDENTITY = ""; "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; @@ -2073,24 +2041,23 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; - GCC_PREFIX_HEADER = "Target Support Files/Quick/Quick-prefix.pch"; - INFOPLIST_FILE = "Target Support Files/Quick/Quick-Info.plist"; + GCC_PREFIX_HEADER = "Target Support Files/Specta/Specta-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/Specta/Specta-Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MODULEMAP_FILE = "Target Support Files/Quick/Quick.modulemap"; - PRODUCT_MODULE_NAME = Quick; - PRODUCT_NAME = Quick; + MODULEMAP_FILE = "Target Support Files/Specta/Specta.modulemap"; + PRODUCT_MODULE_NAME = Specta; + PRODUCT_NAME = Specta; SDKROOT = iphoneos; SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; - name = Release; + name = Debug; }; 2D6A65327F1FC565E63668AE8D630ECC /* Release */ = { isa = XCBuildConfiguration; @@ -2124,9 +2091,9 @@ }; name = Release; }; - 2E9E13730126599F86C63FBB5291E5CD /* Debug */ = { + 3D354562773FAB46FB7E8A99C4EBC588 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = C49EA77F5D9DEAE7FF266159EC85E2C8 /* Expecta.xcconfig */; + baseConfigurationReference = 3C54102318B671D33A15F922447CCFF0 /* OCMock.xcconfig */; buildSettings = { CODE_SIGN_IDENTITY = ""; "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; @@ -2137,18 +2104,18 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; - GCC_PREFIX_HEADER = "Target Support Files/Expecta/Expecta-prefix.pch"; - INFOPLIST_FILE = "Target Support Files/Expecta/Expecta-Info.plist"; + GCC_PREFIX_HEADER = "Target Support Files/OCMock/OCMock-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/OCMock/OCMock-Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MODULEMAP_FILE = "Target Support Files/Expecta/Expecta.modulemap"; - PRODUCT_MODULE_NAME = Expecta; - PRODUCT_NAME = Expecta; + MODULEMAP_FILE = "Target Support Files/OCMock/OCMock.modulemap"; + PRODUCT_MODULE_NAME = OCMock; + PRODUCT_NAME = OCMock; SDKROOT = iphoneos; SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -2219,41 +2186,21 @@ }; name = Debug; }; - 4451386B5A83F989E1B24DE7D990257D /* Debug */ = { + 4EA2494965A79A33E69F9FC597345784 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 3C54102318B671D33A15F922447CCFF0 /* OCMock.xcconfig */; - buildSettings = { - CODE_SIGN_IDENTITY = ""; - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - GCC_PREFIX_HEADER = "Target Support Files/OCMock/OCMock-prefix.pch"; - INFOPLIST_FILE = "Target Support Files/OCMock/OCMock-Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MODULEMAP_FILE = "Target Support Files/OCMock/OCMock.modulemap"; - PRODUCT_MODULE_NAME = OCMock; - PRODUCT_NAME = OCMock; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; - SWIFT_VERSION = 4.2; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Debug; - }; - 5ACDDB8F6A44698F549BF06E6495D0D1 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = C49EA77F5D9DEAE7FF266159EC85E2C8 /* Expecta.xcconfig */; + baseConfigurationReference = D5D2F374CD1C611FCBE5D46C0955ED82 /* ZSWTaggedString.xcconfig */; buildSettings = { + CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES; + CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_IMPLICIT_SIGN_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; CODE_SIGN_IDENTITY = ""; "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; @@ -2263,18 +2210,45 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; - GCC_PREFIX_HEADER = "Target Support Files/Expecta/Expecta-prefix.pch"; - INFOPLIST_FILE = "Target Support Files/Expecta/Expecta-Info.plist"; + ENABLE_TESTABILITY = YES; + GCC_PREFIX_HEADER = "Target Support Files/ZSWTaggedString/ZSWTaggedString-prefix.pch"; + GCC_TREAT_WARNINGS_AS_ERRORS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = YES; + GCC_WARN_ABOUT_INVALID_OFFSETOF_MACRO = YES; + GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; + GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_CHECK_SWITCH_STATEMENTS = YES; + GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = YES; + GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; + GCC_WARN_MISSING_PARENTHESES = YES; + GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES; + GCC_WARN_SHADOW = YES; + GCC_WARN_SIGN_COMPARE = YES; + GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_LABEL = YES; + GCC_WARN_UNUSED_VALUE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + INFOPLIST_FILE = "Target Support Files/ZSWTaggedString/ZSWTaggedString-Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MODULEMAP_FILE = "Target Support Files/Expecta/Expecta.modulemap"; - PRODUCT_MODULE_NAME = Expecta; - PRODUCT_NAME = Expecta; + MODULEMAP_FILE = "Target Support Files/ZSWTaggedString/ZSWTaggedString.modulemap"; + OTHER_CFLAGS = ( + "$(inherited)", + "-Wextra -Wno-unused-parameter -Wformat=2 -Wunreachable-code", + ); + PRODUCT_MODULE_NAME = ZSWTaggedString; + PRODUCT_NAME = ZSWTaggedString; + RUN_CLANG_STATIC_ANALYZER = YES; SDKROOT = iphoneos; SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; @@ -2282,7 +2256,7 @@ }; name = Release; }; - 6746CCBC5282D3325D9FC38ADD75A7DD /* Release */ = { + 5BB0222DBADCC53949772E7E19AE0F6F /* Debug */ = { isa = XCBuildConfiguration; baseConfigurationReference = D5D2F374CD1C611FCBE5D46C0955ED82 /* ZSWTaggedString.xcconfig */; buildSettings = { @@ -2344,13 +2318,12 @@ SDKROOT = iphoneos; SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; - name = Release; + name = Debug; }; 6E0A5742216040693A927CDF09FF226A /* Release */ = { isa = XCBuildConfiguration; @@ -2386,6 +2359,100 @@ }; name = Release; }; + 71A7F6BC479A3285918781CAD90D2DC8 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = C49EA77F5D9DEAE7FF266159EC85E2C8 /* Expecta.xcconfig */; + buildSettings = { + CODE_SIGN_IDENTITY = ""; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + GCC_PREFIX_HEADER = "Target Support Files/Expecta/Expecta-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/Expecta/Expecta-Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MODULEMAP_FILE = "Target Support Files/Expecta/Expecta.modulemap"; + PRODUCT_MODULE_NAME = Expecta; + PRODUCT_NAME = Expecta; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + 76ACCE1AA85E30BEC6292FE92F0C108F /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 6652FD1E0CE8D9D74217D32D3E9165E5 /* Quick.xcconfig */; + buildSettings = { + CODE_SIGN_IDENTITY = ""; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + GCC_PREFIX_HEADER = "Target Support Files/Quick/Quick-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/Quick/Quick-Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MODULEMAP_FILE = "Target Support Files/Quick/Quick.modulemap"; + PRODUCT_MODULE_NAME = Quick; + PRODUCT_NAME = Quick; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + 7C54A34795DFCCB17B84A8AFD2D2E6EE /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 6652FD1E0CE8D9D74217D32D3E9165E5 /* Quick.xcconfig */; + buildSettings = { + CODE_SIGN_IDENTITY = ""; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + GCC_PREFIX_HEADER = "Target Support Files/Quick/Quick-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/Quick/Quick-Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MODULEMAP_FILE = "Target Support Files/Quick/Quick.modulemap"; + PRODUCT_MODULE_NAME = Quick; + PRODUCT_NAME = Quick; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; 8B5B486688C61BB19DC3D9BEF62C8BB6 /* Debug */ = { isa = XCBuildConfiguration; baseConfigurationReference = 062879E55988160EB4F9B80F990320BD /* Pods-ZSWTaggedString.debug.xcconfig */; @@ -2419,9 +2486,9 @@ }; name = Debug; }; - CB50AF06BDF6D88E7BEA3B0B936BDE3E /* Release */ = { + AE3B2A4DBBF0BF9AB8C77051A942AC15 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 2E8B2C50AF455BBC60BDDFD84685D607 /* Specta.xcconfig */; + baseConfigurationReference = 3C54102318B671D33A15F922447CCFF0 /* OCMock.xcconfig */; buildSettings = { CODE_SIGN_IDENTITY = ""; "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; @@ -2432,18 +2499,18 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; - GCC_PREFIX_HEADER = "Target Support Files/Specta/Specta-prefix.pch"; - INFOPLIST_FILE = "Target Support Files/Specta/Specta-Info.plist"; + GCC_PREFIX_HEADER = "Target Support Files/OCMock/OCMock-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/OCMock/OCMock-Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MODULEMAP_FILE = "Target Support Files/Specta/Specta.modulemap"; - PRODUCT_MODULE_NAME = Specta; - PRODUCT_NAME = Specta; + MODULEMAP_FILE = "Target Support Files/OCMock/OCMock.modulemap"; + PRODUCT_MODULE_NAME = OCMock; + PRODUCT_NAME = OCMock; SDKROOT = iphoneos; SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; @@ -2451,21 +2518,10 @@ }; name = Release; }; - CD32731CC5A65BF6C93C078BC16BF5FF /* Debug */ = { + B4FCD81BB1DDE95EC29DF5C1E6B29C60 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = D5D2F374CD1C611FCBE5D46C0955ED82 /* ZSWTaggedString.xcconfig */; + baseConfigurationReference = C49EA77F5D9DEAE7FF266159EC85E2C8 /* Expecta.xcconfig */; buildSettings = { - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; CODE_SIGN_IDENTITY = ""; "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; @@ -2475,50 +2531,24 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_TESTABILITY = YES; - GCC_PREFIX_HEADER = "Target Support Files/ZSWTaggedString/ZSWTaggedString-prefix.pch"; - GCC_TREAT_WARNINGS_AS_ERRORS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = YES; - GCC_WARN_ABOUT_INVALID_OFFSETOF_MACRO = YES; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES; - GCC_WARN_ABOUT_MISSING_NEWLINE = YES; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_CHECK_SWITCH_STATEMENTS = YES; - GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = YES; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; - GCC_WARN_MISSING_PARENTHESES = YES; - GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES; - GCC_WARN_SHADOW = YES; - GCC_WARN_SIGN_COMPARE = YES; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_LABEL = YES; - GCC_WARN_UNUSED_VALUE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - INFOPLIST_FILE = "Target Support Files/ZSWTaggedString/ZSWTaggedString-Info.plist"; + GCC_PREFIX_HEADER = "Target Support Files/Expecta/Expecta-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/Expecta/Expecta-Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MODULEMAP_FILE = "Target Support Files/ZSWTaggedString/ZSWTaggedString.modulemap"; - OTHER_CFLAGS = ( - "$(inherited)", - "-Wextra -Wno-unused-parameter -Wformat=2 -Wunreachable-code", - ); - PRODUCT_MODULE_NAME = ZSWTaggedString; - PRODUCT_NAME = ZSWTaggedString; - RUN_CLANG_STATIC_ANALYZER = YES; + MODULEMAP_FILE = "Target Support Files/Expecta/Expecta.modulemap"; + PRODUCT_MODULE_NAME = Expecta; + PRODUCT_NAME = Expecta; SDKROOT = iphoneos; SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; - name = Debug; + name = Release; }; CF389F750F700469742970304E1E1BC5 /* Debug */ = { isa = XCBuildConfiguration; @@ -2551,7 +2581,7 @@ }; name = Debug; }; - D8E11673E5EEBB9FFC37D1998B8E08ED /* Debug */ = { + D9AC85A247D784CB3A1BBF04DC987B24 /* Release */ = { isa = XCBuildConfiguration; baseConfigurationReference = 2E8B2C50AF455BBC60BDDFD84685D607 /* Specta.xcconfig */; buildSettings = { @@ -2575,43 +2605,13 @@ SDKROOT = iphoneos; SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; - SWIFT_VERSION = 4.2; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Debug; - }; - DF75967A4C13CE982D27824B86995E1A /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 6652FD1E0CE8D9D74217D32D3E9165E5 /* Quick.xcconfig */; - buildSettings = { - CODE_SIGN_IDENTITY = ""; - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - GCC_PREFIX_HEADER = "Target Support Files/Quick/Quick-prefix.pch"; - INFOPLIST_FILE = "Target Support Files/Quick/Quick-Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MODULEMAP_FILE = "Target Support Files/Quick/Quick.modulemap"; - PRODUCT_MODULE_NAME = Quick; - PRODUCT_NAME = Quick; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; - name = Debug; + name = Release; }; /* End XCBuildConfiguration section */ @@ -2619,8 +2619,8 @@ 05735A000CC026B0DDF6079670849B43 /* Build configuration list for PBXNativeTarget "Expecta" */ = { isa = XCConfigurationList; buildConfigurations = ( - 2E9E13730126599F86C63FBB5291E5CD /* Debug */, - 5ACDDB8F6A44698F549BF06E6495D0D1 /* Release */, + 71A7F6BC479A3285918781CAD90D2DC8 /* Debug */, + B4FCD81BB1DDE95EC29DF5C1E6B29C60 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; @@ -2628,8 +2628,8 @@ 24A2CEA88340FBA4740AB883A9332669 /* Build configuration list for PBXNativeTarget "Specta" */ = { isa = XCConfigurationList; buildConfigurations = ( - D8E11673E5EEBB9FFC37D1998B8E08ED /* Debug */, - CB50AF06BDF6D88E7BEA3B0B936BDE3E /* Release */, + 0E80AC076567308AE66FC2E0EF75CEC9 /* Debug */, + D9AC85A247D784CB3A1BBF04DC987B24 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; @@ -2646,8 +2646,8 @@ 6657101AD796685A06D1B49AFB27967C /* Build configuration list for PBXNativeTarget "OCMock" */ = { isa = XCConfigurationList; buildConfigurations = ( - 4451386B5A83F989E1B24DE7D990257D /* Debug */, - 1C1FC8A29DD967B88AF76358D3A85B54 /* Release */, + 3D354562773FAB46FB7E8A99C4EBC588 /* Debug */, + AE3B2A4DBBF0BF9AB8C77051A942AC15 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; @@ -2655,8 +2655,8 @@ 8FC8876FB3E049100840DF09CD26F682 /* Build configuration list for PBXNativeTarget "ZSWTaggedString" */ = { isa = XCConfigurationList; buildConfigurations = ( - CD32731CC5A65BF6C93C078BC16BF5FF /* Debug */, - 6746CCBC5282D3325D9FC38ADD75A7DD /* Release */, + 5BB0222DBADCC53949772E7E19AE0F6F /* Debug */, + 4EA2494965A79A33E69F9FC597345784 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; @@ -2673,8 +2673,8 @@ A11DC6DEF4CD1F4F897227FB00507B92 /* Build configuration list for PBXNativeTarget "Quick" */ = { isa = XCConfigurationList; buildConfigurations = ( - DF75967A4C13CE982D27824B86995E1A /* Debug */, - 24190DBB9D1F931EC4CCAFC7558C4A6B /* Release */, + 7C54A34795DFCCB17B84A8AFD2D2E6EE /* Debug */, + 76ACCE1AA85E30BEC6292FE92F0C108F /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; diff --git a/Example/Pods/Target Support Files/ZSWTaggedString/ZSWTaggedString-Info.plist b/Example/Pods/Target Support Files/ZSWTaggedString/ZSWTaggedString-Info.plist index c26f36f..6631be7 100644 --- a/Example/Pods/Target Support Files/ZSWTaggedString/ZSWTaggedString-Info.plist +++ b/Example/Pods/Target Support Files/ZSWTaggedString/ZSWTaggedString-Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 4.1.0 + 4.2.0 CFBundleSignature ???? CFBundleVersion diff --git a/Example/Tests/Tests/ZSWStringParserSpec.m b/Example/Tests/Tests/ZSWStringParserSpec.m index 920e526..bb71506 100644 --- a/Example/Tests/Tests/ZSWStringParserSpec.m +++ b/Example/Tests/Tests/ZSWStringParserSpec.m @@ -57,6 +57,30 @@ mockOptions = [OCMockObject mockForClass:[ZSWTaggedStringOptions class]]; }); + it(@"should handle a tag with no strings", ^{ + ZSWTaggedString *taggedString = [ZSWTaggedString stringWithString:@""]; + + NSArray *tags; + [[mockOptions expect] _private_updateAttributedString:OCMOCK_ANY + updatedWithTags:[OCMArg capture:&tags]]; + + NSError *error; + + id string = [[ZSWStringParser stringWithTaggedString:taggedString + options:mockOptions + returnClass:[NSAttributedString class] + error:&error] string]; + + expect(string).to.equal(@""); + expect(error).to.beNil(); + expect(tags).to.haveCountOf(1); + + ZSWStringParserTag *tag = tags.firstObject; + expect(tag.tagName).to.equal(@"cattail"); + expect(tag.tagRange.location).to.equal(0); + expect(tag.tagRange.length).to.equal(0); + }); + it(@"should handle a string with no tags", ^{ ZSWTaggedString *taggedString = [ZSWTaggedString stringWithString:@"no more timothy hay!"]; diff --git a/Example/Tests/Tests/ZSWTaggedStringOptionsSpec.m b/Example/Tests/Tests/ZSWTaggedStringOptionsSpec.m index 098b34b..5876023 100644 --- a/Example/Tests/Tests/ZSWTaggedStringOptionsSpec.m +++ b/Example/Tests/Tests/ZSWTaggedStringOptionsSpec.m @@ -331,6 +331,31 @@ expect(string).to.equal([[NSAttributedString alloc] initWithString:@"santa claus" attributes:nil]); }); + + it(@"should handle empty string after tags are removed", ^{ + // effectively this is "" + ZSWTaggedStringOptions *options = [ZSWTaggedStringOptions optionsWithBaseAttributes:@{ + NSFontAttributeName: [UIFont systemFontOfSize:12.0] + }]; + NSMutableAttributedString *string = [[NSMutableAttributedString alloc] initWithString:@"" attributes:nil]; + ZSWStringParserTag *tag1 = [[ZSWStringParserTag alloc] initWithTagName:@"null" startLocation:0]; + [tag1 updateWithTag:[[ZSWStringParserTag alloc] initWithTagName:@"/null" startLocation:0]]; + + ZSWStringParserTag *tag2 = [[ZSWStringParserTag alloc] initWithTagName:@"blah" startLocation:0]; + [tag2 updateWithTag:[[ZSWStringParserTag alloc] initWithTagName:@"/blah" startLocation:0]]; + + [options setDynamicAttributes:^NSDictionary * _Nonnull(NSString * _Nonnull tagName, NSDictionary * _Nonnull tagAttributes, NSDictionary * _Nonnull existingStringAttributes) { + return @{ NSForegroundColorAttributeName: [UIColor redColor] }; + } forTagName:@"null"]; + + [options setAttributes:@{ NSForegroundColorAttributeName: [UIColor redColor] } + forTagName:@"blah"]; + + [options _private_updateAttributedString:string updatedWithTags:@[ tag1, tag2 ]]; + + expect(string).to.equal([[NSAttributedString alloc] initWithString:@"" attributes:nil]); + + }); describe(@"when a string contains multiple of the same type", ^{ __block ZSWTaggedStringOptions *options; diff --git a/Example/ZSWTaggedString.xcodeproj/project.pbxproj b/Example/ZSWTaggedString.xcodeproj/project.pbxproj index 01ac5fc..f037242 100644 --- a/Example/ZSWTaggedString.xcodeproj/project.pbxproj +++ b/Example/ZSWTaggedString.xcodeproj/project.pbxproj @@ -199,7 +199,7 @@ ORGANIZATIONNAME = "Zachary West"; TargetAttributes = { 6003F5AD195388D20070C39A = { - LastSwiftMigration = 1010; + LastSwiftMigration = 1020; TestTargetID = 6003F589195388D20070C39A; }; }; @@ -209,6 +209,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, Base, ); @@ -396,7 +397,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Tests/Tests/ZSWTaggedString-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; TEST_HOST = "$(BUNDLE_LOADER)"; WRAPPER_EXTENSION = xctest; }; @@ -418,7 +419,7 @@ PRODUCT_MODULE_NAME = "$(PRODUCT_NAME:c99extidentifier)Test"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Tests/Tests/ZSWTaggedString-Bridging-Header.h"; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; TEST_HOST = "$(BUNDLE_LOADER)"; WRAPPER_EXTENSION = xctest; }; diff --git a/Example/ZSWTaggedString.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Example/ZSWTaggedString.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/Example/ZSWTaggedString.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/ZSWTaggedString.podspec b/ZSWTaggedString.podspec index c72f4cb..b21ba9d 100644 --- a/ZSWTaggedString.podspec +++ b/ZSWTaggedString.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "ZSWTaggedString" - s.version = "4.1" + s.version = "4.2" s.summary = "Converts a String (or NSString) with tags (like HTML) into an NSAttributedString" s.description = <<-DESC Tags in a ZSWTaggedString are like HTML, except you define what they mean. @@ -21,7 +21,7 @@ Pod::Spec.new do |s| s.default_subspecs = 'Core' s.pod_target_xcconfig = { 'APPLICATION_EXTENSION_API_ONLY' => 'YES' } s.module_map = 'ZSWTaggedString/Classes/ZSWTaggedString.modulemap' - s.swift_version = '4.2' + s.swift_version = '5.0' s.subspec 'Core' do |core| core.source_files = 'ZSWTaggedString/Classes/**/*.{h,m}', 'ZSWTaggedString/Private/**/*.{h,m}' diff --git a/ZSWTaggedString/Classes/ZSWTaggedStringOptions.m b/ZSWTaggedString/Classes/ZSWTaggedStringOptions.m index 8e125d0..2652faf 100644 --- a/ZSWTaggedString/Classes/ZSWTaggedStringOptions.m +++ b/ZSWTaggedString/Classes/ZSWTaggedStringOptions.m @@ -139,6 +139,14 @@ - (void)_private_updateAttributedString:(NSMutableAttributedString *)string updatedWithTags:(NSArray *)tags { NSParameterAssert([string isKindOfClass:[NSMutableAttributedString class]]); + if (string.length == 0) { + // For example, a string like '' has no content, so we can 't + // adjust what's inside based on tags. All we can do is base attributes. + // For dynamic attributes below, we may end up calling out of bounds trying + // to get existing attributes at index 0, which doesn't exist. + return; + } + [string setAttributes:self.baseAttributes range:NSMakeRange(0, string.length)]; ZSWTaggedStringAttribute *unknownTagWrapper = self._private_unknownTagWrapper;