From 364118586b88d81b191a1f18ae22512df3db1634 Mon Sep 17 00:00:00 2001 From: bsorrentino Date: Sun, 15 May 2016 22:13:32 +0200 Subject: [PATCH 01/12] fix cli for compatibility with xcodeproj 1.0.0 --- cli/parser.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cli/parser.rb b/cli/parser.rb index 9f16244..55eca09 100644 --- a/cli/parser.rb +++ b/cli/parser.rb @@ -5,7 +5,8 @@ class Parser def self.parse(plist_path) puts "SettingsKit: Parsing #{plist_path}..." - plist = Xcodeproj::PlistHelper.read(plist_path) + # plist = Xcodeproj::PlistHelper.read(plist_path) + plist = Xcodeproj::Plist.read_from_path(plist_path) keys = plist["PreferenceSpecifiers"].map { |i| i["Key"] }.compact.sort Renderer.new(keys) end From b911af9b3bad60911da695a7f38992bf1286cde9 Mon Sep 17 00:00:00 2001 From: bsorrentino Date: Thu, 20 Oct 2016 12:02:27 +0200 Subject: [PATCH 02/12] update to swift2.3 --- SettingsKit.podspec | 6 +++++- SettingsKit.xcodeproj/project.pbxproj | 17 ++++++++++++++++- .../xcshareddata/xcschemes/SettingsKit.xcscheme | 2 +- .../xcschemes/SettingsKitTests.xcscheme | 2 +- 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/SettingsKit.podspec b/SettingsKit.podspec index 79fa2a8..566f851 100644 --- a/SettingsKit.podspec +++ b/SettingsKit.podspec @@ -14,8 +14,12 @@ Pod::Spec.new do |s| s.author = { "Dan Trenz" => "dtrenz@gmail.com" } s.source = { :git => "https://github.com/dtrenz/SettingsKit.git", :tag => s.version.to_s } s.social_media_url = "https://twitter.com/dtrenz" - s.platform = :ios, "8.3" + #s.platform = :ios, "8.3" s.requires_arc = true s.source_files = [ "Sources/**/*", "cli/**/*", "build" ] s.preserve_paths = [ "cli/**/*", "build" ] + + s.ios.deployment_target = '8.3' + s.osx.deployment_target = '10.11' + s.tvos.deployment_target = '9.0' end diff --git a/SettingsKit.xcodeproj/project.pbxproj b/SettingsKit.xcodeproj/project.pbxproj index c65ecfe..d650fa6 100644 --- a/SettingsKit.xcodeproj/project.pbxproj +++ b/SettingsKit.xcodeproj/project.pbxproj @@ -182,14 +182,16 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0720; - LastUpgradeCheck = 0720; + LastUpgradeCheck = 0800; ORGANIZATIONNAME = "Dan Trenz"; TargetAttributes = { C5D7BD921C80B5FD0061D9DD = { CreatedOnToolsVersion = 7.2; + LastSwiftMigration = 0800; }; C5D7BDBB1C80BA040061D9DD = { CreatedOnToolsVersion = 7.2; + LastSwiftMigration = 0800; }; }; }; @@ -301,8 +303,10 @@ 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_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; @@ -349,8 +353,10 @@ 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_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; @@ -370,6 +376,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 9.2; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; @@ -381,6 +388,7 @@ isa = XCBuildConfiguration; buildSettings = { CLANG_ENABLE_MODULES = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; @@ -392,6 +400,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 2.3; }; name = Debug; }; @@ -399,6 +408,7 @@ isa = XCBuildConfiguration; buildSettings = { CLANG_ENABLE_MODULES = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; @@ -409,6 +419,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.dtrenz.SettingsKit; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; + SWIFT_VERSION = 2.3; }; name = Release; }; @@ -416,10 +427,12 @@ isa = XCBuildConfiguration; baseConfigurationReference = 4412B3D0A0055F6A6A496486 /* Pods-SettingsKitTests.debug.xcconfig */; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; INFOPLIST_FILE = Tests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.dtrenz.SettingsKitTests; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 2.3; }; name = Debug; }; @@ -427,10 +440,12 @@ isa = XCBuildConfiguration; baseConfigurationReference = 29E698A8BD2666F3874BE529 /* Pods-SettingsKitTests.release.xcconfig */; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; INFOPLIST_FILE = Tests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.dtrenz.SettingsKitTests; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 2.3; }; name = Release; }; diff --git a/SettingsKit.xcodeproj/xcshareddata/xcschemes/SettingsKit.xcscheme b/SettingsKit.xcodeproj/xcshareddata/xcschemes/SettingsKit.xcscheme index 8f3958e..3466f36 100644 --- a/SettingsKit.xcodeproj/xcshareddata/xcschemes/SettingsKit.xcscheme +++ b/SettingsKit.xcodeproj/xcshareddata/xcschemes/SettingsKit.xcscheme @@ -1,6 +1,6 @@ Date: Thu, 20 Oct 2016 12:05:59 +0200 Subject: [PATCH 03/12] update to swift2.3 --- SettingsKit.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SettingsKit.podspec b/SettingsKit.podspec index 566f851..1b98a58 100644 --- a/SettingsKit.podspec +++ b/SettingsKit.podspec @@ -12,7 +12,7 @@ Pod::Spec.new do |s| s.homepage = "https://github.com/dtrenz/SettingsKit" s.license = "Apache 2.0" s.author = { "Dan Trenz" => "dtrenz@gmail.com" } - s.source = { :git => "https://github.com/dtrenz/SettingsKit.git", :tag => s.version.to_s } + #s.source = { :git => "https://github.com/dtrenz/SettingsKit.git", :tag => s.version.to_s } s.social_media_url = "https://twitter.com/dtrenz" #s.platform = :ios, "8.3" s.requires_arc = true From f367bef4bc8d8c9f64370c044f0ab553e14806b5 Mon Sep 17 00:00:00 2001 From: bsorrentino Date: Thu, 20 Oct 2016 12:48:40 +0200 Subject: [PATCH 04/12] update version --- SettingsKit.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SettingsKit.podspec b/SettingsKit.podspec index 1b98a58..1860ad9 100644 --- a/SettingsKit.podspec +++ b/SettingsKit.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "SettingsKit" - s.version = "0.1.0" + s.version = "0.2.0" s.summary = <<-SUMMARY SettingsKit provides an elegant wrapper for iOS app settings. SUMMARY From d85b3dc28c3d525baad3780be11e594b2be2cc4b Mon Sep 17 00:00:00 2001 From: bsorrentino Date: Thu, 20 Oct 2016 12:56:55 +0200 Subject: [PATCH 05/12] update podspec --- SettingsKit.podspec | 1 + 1 file changed, 1 insertion(+) diff --git a/SettingsKit.podspec b/SettingsKit.podspec index 1860ad9..167145a 100644 --- a/SettingsKit.podspec +++ b/SettingsKit.podspec @@ -13,6 +13,7 @@ Pod::Spec.new do |s| s.license = "Apache 2.0" s.author = { "Dan Trenz" => "dtrenz@gmail.com" } #s.source = { :git => "https://github.com/dtrenz/SettingsKit.git", :tag => s.version.to_s } + s.source = { :git => "https://github.com/dtrenz/SettingsKit.git", :branch => develop } s.social_media_url = "https://twitter.com/dtrenz" #s.platform = :ios, "8.3" s.requires_arc = true From 05656a6bb6adcf773e005fcbde1d1421c85723a1 Mon Sep 17 00:00:00 2001 From: bsorrentino Date: Thu, 20 Oct 2016 12:59:54 +0200 Subject: [PATCH 06/12] update podspec --- SettingsKit.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SettingsKit.podspec b/SettingsKit.podspec index 167145a..afe820b 100644 --- a/SettingsKit.podspec +++ b/SettingsKit.podspec @@ -13,7 +13,7 @@ Pod::Spec.new do |s| s.license = "Apache 2.0" s.author = { "Dan Trenz" => "dtrenz@gmail.com" } #s.source = { :git => "https://github.com/dtrenz/SettingsKit.git", :tag => s.version.to_s } - s.source = { :git => "https://github.com/dtrenz/SettingsKit.git", :branch => develop } + s.source = { :git => "https://github.com/dtrenz/SettingsKit.git", :branch => 'develop' } s.social_media_url = "https://twitter.com/dtrenz" #s.platform = :ios, "8.3" s.requires_arc = true From 5fe21ba6e94690869fde4c2bb99dcfb71a7af05a Mon Sep 17 00:00:00 2001 From: bsorrentino Date: Mon, 13 Feb 2017 01:47:21 +0100 Subject: [PATCH 07/12] update ignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index f855b2c..8d8709e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ ## Build generated +bin/ build/ DerivedData From 6a2c79d51ca7fed41fead22c439b0c3bbe77f297 Mon Sep 17 00:00:00 2001 From: bsorrentino Date: Mon, 13 Feb 2017 01:48:03 +0100 Subject: [PATCH 08/12] update to swift3 --- .../xcshareddata/xcschemes/Example.xcscheme | 2 +- Podfile | 2 +- Podfile.lock | 4 +- SettingsKit.xcodeproj/project.pbxproj | 92 +++++++++++++------ .../xcschemes/SettingsKit.xcscheme | 2 +- .../xcschemes/SettingsKitTests.xcscheme | 2 +- .../contents.xcworkspacedata | 3 - Sources/SettingsKit.swift | 36 ++++---- 8 files changed, 89 insertions(+), 54 deletions(-) diff --git a/Example/Example.xcodeproj/xcshareddata/xcschemes/Example.xcscheme b/Example/Example.xcodeproj/xcshareddata/xcschemes/Example.xcscheme index 9cb856a..83cec12 100644 --- a/Example/Example.xcodeproj/xcshareddata/xcschemes/Example.xcscheme +++ b/Example/Example.xcodeproj/xcshareddata/xcschemes/Example.xcscheme @@ -1,6 +1,6 @@ true do +target 'SettingsKitTests' do pod 'Quick', '~> 0.8.0' pod 'Nimble', '3.0.0' end diff --git a/Podfile.lock b/Podfile.lock index 78d2929..3cdd073 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -10,4 +10,6 @@ SPEC CHECKSUMS: Nimble: 4c353d43735b38b545cbb4cb91504588eb5de926 Quick: 563d0f6ec5f72e394645adb377708639b7dd38ab -COCOAPODS: 0.39.0 +PODFILE CHECKSUM: 97e78fde515eb0819fae1d70165c383ca317d21a + +COCOAPODS: 1.2.0 diff --git a/SettingsKit.xcodeproj/project.pbxproj b/SettingsKit.xcodeproj/project.pbxproj index d650fa6..98f44af 100644 --- a/SettingsKit.xcodeproj/project.pbxproj +++ b/SettingsKit.xcodeproj/project.pbxproj @@ -7,7 +7,7 @@ objects = { /* Begin PBXBuildFile section */ - 11632309D98671B6F6CB12C4 /* Pods_SettingsKitTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A2BAC4EBCA0CC0DB3C4DB824 /* Pods_SettingsKitTests.framework */; }; + 5343093FAF91D7FCFEDCFFEE /* Pods_SettingsKitTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C362923D034B698D2F1861EC /* Pods_SettingsKitTests.framework */; }; C5D7BDA21C80B75B0061D9DD /* SettingsKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5D7BD9F1C80B75B0061D9DD /* SettingsKit.swift */; }; C5D7BDA41C80B75B0061D9DD /* SettingsKit.h in Headers */ = {isa = PBXBuildFile; fileRef = C5D7BDA11C80B75B0061D9DD /* SettingsKit.h */; settings = {ATTRIBUTES = (Public, ); }; }; C5D7BDC11C80BA040061D9DD /* SettingsKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C5D7BD931C80B5FD0061D9DD /* SettingsKit.framework */; }; @@ -25,9 +25,9 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ - 29E698A8BD2666F3874BE529 /* Pods-SettingsKitTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SettingsKitTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-SettingsKitTests/Pods-SettingsKitTests.release.xcconfig"; sourceTree = ""; }; - 4412B3D0A0055F6A6A496486 /* Pods-SettingsKitTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SettingsKitTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-SettingsKitTests/Pods-SettingsKitTests.debug.xcconfig"; sourceTree = ""; }; - A2BAC4EBCA0CC0DB3C4DB824 /* Pods_SettingsKitTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_SettingsKitTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 3A364EA9188BEE4D578493D9 /* Pods-SettingsKitTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SettingsKitTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-SettingsKitTests/Pods-SettingsKitTests.release.xcconfig"; sourceTree = ""; }; + 93705A23A54035F8217520AE /* Pods-SettingsKitTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SettingsKitTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-SettingsKitTests/Pods-SettingsKitTests.debug.xcconfig"; sourceTree = ""; }; + C362923D034B698D2F1861EC /* Pods_SettingsKitTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_SettingsKitTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; C5D7BD931C80B5FD0061D9DD /* SettingsKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SettingsKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; C5D7BD9F1C80B75B0061D9DD /* SettingsKit.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SettingsKit.swift; path = Sources/SettingsKit.swift; sourceTree = SOURCE_ROOT; }; C5D7BDA01C80B75B0061D9DD /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = Sources/Info.plist; sourceTree = SOURCE_ROOT; }; @@ -50,17 +50,26 @@ buildActionMask = 2147483647; files = ( C5D7BDC11C80BA040061D9DD /* SettingsKit.framework in Frameworks */, - 11632309D98671B6F6CB12C4 /* Pods_SettingsKitTests.framework in Frameworks */, + 5343093FAF91D7FCFEDCFFEE /* Pods_SettingsKitTests.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 5BCBCA55AFC06C317DF97761 /* Frameworks */ = { + 0BABDEE5C2F1A1E4C7BDE184 /* Pods */ = { isa = PBXGroup; children = ( - A2BAC4EBCA0CC0DB3C4DB824 /* Pods_SettingsKitTests.framework */, + 93705A23A54035F8217520AE /* Pods-SettingsKitTests.debug.xcconfig */, + 3A364EA9188BEE4D578493D9 /* Pods-SettingsKitTests.release.xcconfig */, + ); + name = Pods; + sourceTree = ""; + }; + A4F97E58BEF937AD6C1ECA54 /* Frameworks */ = { + isa = PBXGroup; + children = ( + C362923D034B698D2F1861EC /* Pods_SettingsKitTests.framework */, ); name = Frameworks; sourceTree = ""; @@ -71,8 +80,8 @@ C5D7BD951C80B5FD0061D9DD /* Sources */, C5D7BDBD1C80BA040061D9DD /* Tests */, C5D7BD941C80B5FD0061D9DD /* Products */, - CF3538BCE9D95A7D40B0B97E /* Pods */, - 5BCBCA55AFC06C317DF97761 /* Frameworks */, + 0BABDEE5C2F1A1E4C7BDE184 /* Pods */, + A4F97E58BEF937AD6C1ECA54 /* Frameworks */, ); sourceTree = ""; }; @@ -114,15 +123,6 @@ path = SettingsKitTests; sourceTree = ""; }; - CF3538BCE9D95A7D40B0B97E /* Pods */ = { - isa = PBXGroup; - children = ( - 4412B3D0A0055F6A6A496486 /* Pods-SettingsKitTests.debug.xcconfig */, - 29E698A8BD2666F3874BE529 /* Pods-SettingsKitTests.release.xcconfig */, - ); - name = Pods; - sourceTree = ""; - }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ @@ -160,10 +160,12 @@ isa = PBXNativeTarget; buildConfigurationList = C5D7BDC61C80BA040061D9DD /* Build configuration list for PBXNativeTarget "SettingsKitTests" */; buildPhases = ( + E4355058E09835DD82F13546 /* [CP] Check Pods Manifest.lock */, C5D7BDB81C80BA040061D9DD /* Sources */, C5D7BDB91C80BA040061D9DD /* Frameworks */, C5D7BDBA1C80BA040061D9DD /* Resources */, - 73474DF3A596BE1328F9F3D3 /* Embed Pods Frameworks */, + 20BBABD4A3BEA191C9247425 /* [CP] Embed Pods Frameworks */, + 41F9D168E12678CE9FAE5226 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -182,16 +184,16 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0720; - LastUpgradeCheck = 0800; + LastUpgradeCheck = 0820; ORGANIZATIONNAME = "Dan Trenz"; TargetAttributes = { C5D7BD921C80B5FD0061D9DD = { CreatedOnToolsVersion = 7.2; - LastSwiftMigration = 0800; + LastSwiftMigration = 0820; }; C5D7BDBB1C80BA040061D9DD = { CreatedOnToolsVersion = 7.2; - LastSwiftMigration = 0800; + LastSwiftMigration = 0820; }; }; }; @@ -231,14 +233,14 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 73474DF3A596BE1328F9F3D3 /* Embed Pods Frameworks */ = { + 20BBABD4A3BEA191C9247425 /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); - name = "Embed Pods Frameworks"; + name = "[CP] Embed Pods Frameworks"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; @@ -246,6 +248,21 @@ shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SettingsKitTests/Pods-SettingsKitTests-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; + 41F9D168E12678CE9FAE5226 /* [CP] Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "[CP] Copy Pods Resources"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SettingsKitTests/Pods-SettingsKitTests-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; C5AA99081C888BB1009577E7 /* Swiftlint */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -260,6 +277,21 @@ shellPath = /bin/sh; shellScript = "if which swiftlint >/dev/null; then\n swiftlint\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi"; }; + E4355058E09835DD82F13546 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "[CP] Check Pods Manifest.lock"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; + showEnvVarsInLog = 0; + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -400,7 +432,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 2.3; + SWIFT_VERSION = 3.0; }; name = Debug; }; @@ -419,33 +451,33 @@ PRODUCT_BUNDLE_IDENTIFIER = com.dtrenz.SettingsKit; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; - SWIFT_VERSION = 2.3; + SWIFT_VERSION = 3.0; }; name = Release; }; C5D7BDC41C80BA040061D9DD /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 4412B3D0A0055F6A6A496486 /* Pods-SettingsKitTests.debug.xcconfig */; + baseConfigurationReference = 93705A23A54035F8217520AE /* Pods-SettingsKitTests.debug.xcconfig */; buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; INFOPLIST_FILE = Tests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.dtrenz.SettingsKitTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 2.3; + SWIFT_VERSION = 3.0; }; name = Debug; }; C5D7BDC51C80BA040061D9DD /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 29E698A8BD2666F3874BE529 /* Pods-SettingsKitTests.release.xcconfig */; + baseConfigurationReference = 3A364EA9188BEE4D578493D9 /* Pods-SettingsKitTests.release.xcconfig */; buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; INFOPLIST_FILE = Tests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.dtrenz.SettingsKitTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 2.3; + SWIFT_VERSION = 3.0; }; name = Release; }; diff --git a/SettingsKit.xcodeproj/xcshareddata/xcschemes/SettingsKit.xcscheme b/SettingsKit.xcodeproj/xcshareddata/xcschemes/SettingsKit.xcscheme index 3466f36..4820fa3 100644 --- a/SettingsKit.xcodeproj/xcshareddata/xcschemes/SettingsKit.xcscheme +++ b/SettingsKit.xcodeproj/xcshareddata/xcschemes/SettingsKit.xcscheme @@ -1,6 +1,6 @@ - - diff --git a/Sources/SettingsKit.swift b/Sources/SettingsKit.swift index 39224e8..387e795 100644 --- a/Sources/SettingsKit.swift +++ b/Sources/SettingsKit.swift @@ -18,17 +18,21 @@ public protocol SettingsKit: CustomStringConvertible { public extension SettingsKit { /// Convenience typealias for subscribe() onChange closure - public typealias SettingChangeHandler = (newValue: AnyObject?) -> Void + public typealias SettingChangeHandler = (_ newValue: AnyObject?) -> Void /// String description of the enum value public var description: String { - guard let value = Self.get(self) else { return "nil" } + + //guard let value = Self.get(self) else { + guard let value = self.get() else { + return "nil" + } return "\(value)" } /// Local defaults reference - private var defaults: NSUserDefaults { return NSUserDefaults.standardUserDefaults() } + private var defaults: UserDefaults { return UserDefaults.standard } // MARK: - Static Convenience Methods @@ -52,7 +56,7 @@ public extension SettingsKit { - value: The value to store for the setting */ public static func set(setting: Self, _ value: T) { - setting.set(value) + setting.set(value: value) } /** @@ -64,8 +68,8 @@ public extension SettingsKit { - setting: The setting to observe - onChange: The closure to call when the setting's value is updated */ - public static func subscribe(setting: Self, onChange: SettingChangeHandler) { - setting.subscribe(onChange) + public static func subscribe(setting: Self, onChange: @escaping SettingChangeHandler) { + setting.subscribe(onChange: onChange) } // MARK: - Instance Methods @@ -79,7 +83,7 @@ public extension SettingsKit { - Returns: The current setting value */ private func get() -> AnyObject? { - return defaults.objectForKey(identifier) + return defaults.object(forKey: identifier) as AnyObject? } /** @@ -92,11 +96,11 @@ public extension SettingsKit { */ private func set(value: T) { if let boolVal = value as? Bool { - defaults.setBool(boolVal, forKey: identifier) + defaults.set(boolVal, forKey: identifier) } else if let intVal = value as? Int { - defaults.setInteger(intVal, forKey: identifier) - } else if let objectVal = value as? AnyObject { - defaults.setObject(objectVal, forKey: identifier) + defaults.set(intVal, forKey: identifier) + } else /*if let objectVal = value as? AnyObject */{ + defaults.set(value, forKey: identifier) } } @@ -111,12 +115,12 @@ public extension SettingsKit { - Parameter onChange: The closure to call when the setting's value is updated */ - private func subscribe(onChange: SettingChangeHandler) { - let center = NSNotificationCenter.defaultCenter() + private func subscribe(onChange: @escaping SettingChangeHandler) { + let center = NotificationCenter.default - center.addObserverForName(NSUserDefaultsDidChangeNotification, object: defaults, queue: nil) { (notif) -> Void in - if let defaults = notif.object as? NSUserDefaults { - onChange(newValue: defaults.objectForKey(self.identifier)) + center.addObserver(forName: UserDefaults.didChangeNotification, object: defaults, queue: nil) { (notif) -> Void in + if let defaults = notif.object as? UserDefaults { + onChange(defaults.object(forKey: self.identifier) as AnyObject?) } } } From de802439b5929dc8a1055f7e680b8043cbf9e46c Mon Sep 17 00:00:00 2001 From: bsorrentino Date: Mon, 13 Feb 2017 01:58:09 +0100 Subject: [PATCH 09/12] update podspec version --- SettingsKit.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SettingsKit.podspec b/SettingsKit.podspec index afe820b..768db2f 100644 --- a/SettingsKit.podspec +++ b/SettingsKit.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "SettingsKit" - s.version = "0.2.0" + s.version = "0.3.0" s.summary = <<-SUMMARY SettingsKit provides an elegant wrapper for iOS app settings. SUMMARY From af61a40cb05aa206242f1ff58ca45d524b56030b Mon Sep 17 00:00:00 2001 From: Bartolomeo Sorrentino Date: Tue, 2 Apr 2019 20:10:14 +0200 Subject: [PATCH 10/12] update ignore --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index 8d8709e..1f86358 100644 --- a/.gitignore +++ b/.gitignore @@ -40,3 +40,7 @@ Pods/ # Jazzy docs docs/ + +Builds/ +Index/ +.DS_Store From 9a078269bdce89577be723ab5a38331fc34c528a Mon Sep 17 00:00:00 2001 From: Bartolomeo Sorrentino Date: Tue, 2 Apr 2019 20:11:04 +0200 Subject: [PATCH 11/12] move to swift 4.2 --- Podfile | 5 +- Podfile.lock | 21 ++-- SettingsKit.xcodeproj/project.pbxproj | 67 ++++++++---- .../xcschemes/SettingsKit.xcscheme | 6 +- .../xcschemes/SettingsKitTests.xcscheme | 2 +- .../xcshareddata/IDEWorkspaceChecks.plist | 8 ++ .../xcshareddata/WorkspaceSettings.xcsettings | 5 + Tests/SettingsKitSpec.swift | 100 +++++++++--------- 8 files changed, 127 insertions(+), 87 deletions(-) create mode 100644 SettingsKit.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist create mode 100644 SettingsKit.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings diff --git a/Podfile b/Podfile index b53d364..392284e 100644 --- a/Podfile +++ b/Podfile @@ -1,7 +1,8 @@ +platform :ios, '10.0' source 'https://github.com/CocoaPods/Specs.git' use_frameworks! target 'SettingsKitTests' do - pod 'Quick', '~> 0.8.0' - pod 'Nimble', '3.0.0' + pod 'Quick', '2.0.0' + pod 'Nimble', '8.0.1' end diff --git a/Podfile.lock b/Podfile.lock index 3cdd073..d7f715c 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -1,15 +1,20 @@ PODS: - - Nimble (3.0.0) - - Quick (0.8.0) + - Nimble (8.0.1) + - Quick (2.0.0) DEPENDENCIES: - - Nimble (= 3.0.0) - - Quick (~> 0.8.0) + - Nimble (= 8.0.1) + - Quick (= 2.0.0) + +SPEC REPOS: + https://github.com/cocoapods/specs.git: + - Nimble + - Quick SPEC CHECKSUMS: - Nimble: 4c353d43735b38b545cbb4cb91504588eb5de926 - Quick: 563d0f6ec5f72e394645adb377708639b7dd38ab + Nimble: 45f786ae66faa9a709624227fae502db55a8bdd0 + Quick: ce1276c7c27ba2da3cb2fd0cde053c3648b3b22d -PODFILE CHECKSUM: 97e78fde515eb0819fae1d70165c383ca317d21a +PODFILE CHECKSUM: e4bd1b527d4e409a8d3aa03b3cbbaf2d9f7e681e -COCOAPODS: 1.2.0 +COCOAPODS: 1.6.1 diff --git a/SettingsKit.xcodeproj/project.pbxproj b/SettingsKit.xcodeproj/project.pbxproj index 98f44af..b798dbf 100644 --- a/SettingsKit.xcodeproj/project.pbxproj +++ b/SettingsKit.xcodeproj/project.pbxproj @@ -8,6 +8,8 @@ /* Begin PBXBuildFile section */ 5343093FAF91D7FCFEDCFFEE /* Pods_SettingsKitTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C362923D034B698D2F1861EC /* Pods_SettingsKitTests.framework */; }; + A033742C2253D86E00E2F0C6 /* Quick.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A033742B2253D86E00E2F0C6 /* Quick.framework */; }; + A033742E2253D8A100E2F0C6 /* Nimble.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A033742D2253D8A100E2F0C6 /* Nimble.framework */; }; C5D7BDA21C80B75B0061D9DD /* SettingsKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5D7BD9F1C80B75B0061D9DD /* SettingsKit.swift */; }; C5D7BDA41C80B75B0061D9DD /* SettingsKit.h in Headers */ = {isa = PBXBuildFile; fileRef = C5D7BDA11C80B75B0061D9DD /* SettingsKit.h */; settings = {ATTRIBUTES = (Public, ); }; }; C5D7BDC11C80BA040061D9DD /* SettingsKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C5D7BD931C80B5FD0061D9DD /* SettingsKit.framework */; }; @@ -27,6 +29,8 @@ /* Begin PBXFileReference section */ 3A364EA9188BEE4D578493D9 /* Pods-SettingsKitTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SettingsKitTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-SettingsKitTests/Pods-SettingsKitTests.release.xcconfig"; sourceTree = ""; }; 93705A23A54035F8217520AE /* Pods-SettingsKitTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SettingsKitTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-SettingsKitTests/Pods-SettingsKitTests.debug.xcconfig"; sourceTree = ""; }; + A033742B2253D86E00E2F0C6 /* Quick.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Quick.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + A033742D2253D8A100E2F0C6 /* Nimble.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Nimble.framework; sourceTree = BUILT_PRODUCTS_DIR; }; C362923D034B698D2F1861EC /* Pods_SettingsKitTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_SettingsKitTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; C5D7BD931C80B5FD0061D9DD /* SettingsKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SettingsKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; C5D7BD9F1C80B75B0061D9DD /* SettingsKit.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SettingsKit.swift; path = Sources/SettingsKit.swift; sourceTree = SOURCE_ROOT; }; @@ -49,6 +53,8 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + A033742E2253D8A100E2F0C6 /* Nimble.framework in Frameworks */, + A033742C2253D86E00E2F0C6 /* Quick.framework in Frameworks */, C5D7BDC11C80BA040061D9DD /* SettingsKit.framework in Frameworks */, 5343093FAF91D7FCFEDCFFEE /* Pods_SettingsKitTests.framework in Frameworks */, ); @@ -69,6 +75,8 @@ A4F97E58BEF937AD6C1ECA54 /* Frameworks */ = { isa = PBXGroup; children = ( + A033742D2253D8A100E2F0C6 /* Nimble.framework */, + A033742B2253D86E00E2F0C6 /* Quick.framework */, C362923D034B698D2F1861EC /* Pods_SettingsKitTests.framework */, ); name = Frameworks; @@ -165,7 +173,6 @@ C5D7BDB91C80BA040061D9DD /* Frameworks */, C5D7BDBA1C80BA040061D9DD /* Resources */, 20BBABD4A3BEA191C9247425 /* [CP] Embed Pods Frameworks */, - 41F9D168E12678CE9FAE5226 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -184,7 +191,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0720; - LastUpgradeCheck = 0820; + LastUpgradeCheck = 1020; ORGANIZATIONNAME = "Dan Trenz"; TargetAttributes = { C5D7BD921C80B5FD0061D9DD = { @@ -202,6 +209,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, ); mainGroup = C5D7BD891C80B5FD0061D9DD; @@ -239,28 +247,18 @@ files = ( ); inputPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-SettingsKitTests/Pods-SettingsKitTests-frameworks.sh", + "${BUILT_PRODUCTS_DIR}/Nimble/Nimble.framework", + "${BUILT_PRODUCTS_DIR}/Quick/Quick.framework", ); name = "[CP] Embed Pods Frameworks"; outputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Nimble.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Quick.framework", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SettingsKitTests/Pods-SettingsKitTests-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; - 41F9D168E12678CE9FAE5226 /* [CP] Copy Pods Resources */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Copy Pods Resources"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SettingsKitTests/Pods-SettingsKitTests-resources.sh\"\n"; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-SettingsKitTests/Pods-SettingsKitTests-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; C5AA99081C888BB1009577E7 /* Swiftlint */ = { @@ -283,13 +281,16 @@ files = ( ); inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", ); name = "[CP] Check Pods Manifest.lock"; outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-SettingsKitTests-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ @@ -326,18 +327,27 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 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_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; @@ -366,6 +376,7 @@ ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -376,18 +387,27 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 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_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; @@ -409,6 +429,7 @@ MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; @@ -432,7 +453,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.2; }; name = Debug; }; @@ -451,7 +472,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.dtrenz.SettingsKit; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.2; }; name = Release; }; @@ -464,7 +485,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.dtrenz.SettingsKitTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.2; }; name = Debug; }; @@ -477,7 +498,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.dtrenz.SettingsKitTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.2; }; name = Release; }; diff --git a/SettingsKit.xcodeproj/xcshareddata/xcschemes/SettingsKit.xcscheme b/SettingsKit.xcodeproj/xcshareddata/xcschemes/SettingsKit.xcscheme index 4820fa3..c7f2ece 100644 --- a/SettingsKit.xcodeproj/xcshareddata/xcschemes/SettingsKit.xcscheme +++ b/SettingsKit.xcodeproj/xcshareddata/xcschemes/SettingsKit.xcscheme @@ -1,6 +1,6 @@ + codeCoverageEnabled = "YES" + shouldUseLaunchSchemeArgsEnv = "YES"> diff --git a/SettingsKit.xcodeproj/xcshareddata/xcschemes/SettingsKitTests.xcscheme b/SettingsKit.xcodeproj/xcshareddata/xcschemes/SettingsKitTests.xcscheme index 0fc0d70..ef00911 100644 --- a/SettingsKit.xcodeproj/xcshareddata/xcschemes/SettingsKitTests.xcscheme +++ b/SettingsKit.xcodeproj/xcshareddata/xcschemes/SettingsKitTests.xcscheme @@ -1,6 +1,6 @@ + + + + IDEDidComputeMac32BitWarning + + + diff --git a/SettingsKit.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/SettingsKit.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 0000000..0c67376 --- /dev/null +++ b/SettingsKit.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,5 @@ + + + + + diff --git a/Tests/SettingsKitSpec.swift b/Tests/SettingsKitSpec.swift index 5474f41..6ac36b4 100644 --- a/Tests/SettingsKitSpec.swift +++ b/Tests/SettingsKitSpec.swift @@ -1,5 +1,5 @@ -import Quick import Nimble +import Quick @testable import SettingsKit @@ -33,13 +33,13 @@ class SettingsKitSpec: QuickSpec { describe("description") { it("returns a string representation of the setting value") { - Settings.set(.LuckyNumber, 23) + Settings.set(setting: .LuckyNumber, 23) expect(Settings.LuckyNumber.description) == "23" } it("returns a string representation of a nil setting value") { - NSUserDefaults.standardUserDefaults().removeObjectForKey(Settings.LuckyNumber.identifier) + UserDefaults.standard.removeObject(forKey: Settings.LuckyNumber.identifier) expect(Settings.LuckyNumber.description) == "nil" } @@ -54,11 +54,11 @@ class SettingsKitSpec: QuickSpec { let identifier = Settings.SocialNetworks.identifier let value = [ "facebook", "twitter", "instagram" ] - NSUserDefaults.standardUserDefaults().removeObjectForKey(identifier) + UserDefaults.standard.removeObject(forKey: identifier) - Settings.set(.SocialNetworks, value) + Settings.set(setting: .SocialNetworks, value) - let result = NSUserDefaults.standardUserDefaults().arrayForKey(identifier) as! [String] + let result = UserDefaults.standard.array(forKey: identifier) as! [String] expect(result) == value } @@ -67,39 +67,39 @@ class SettingsKitSpec: QuickSpec { let identifier = Settings.EnableAnalytics.identifier let value = true - NSUserDefaults.standardUserDefaults().removeObjectForKey(identifier) + UserDefaults.standard.removeObject(forKey: identifier) - Settings.set(.EnableAnalytics, value) + Settings.set(setting: .EnableAnalytics, value) - let result = NSUserDefaults.standardUserDefaults().boolForKey(identifier) + let result = UserDefaults.standard.bool(forKey: identifier) expect(result) == value } it("can store data") { let identifier = Settings.EncodedString.identifier - let value = NSData(base64EncodedString: "SGVsbG8gV29ybGQ=", options: []) as NSData! + let value = NSData(base64Encoded: "SGVsbG8gV29ybGQ=", options: []) as! NSData - NSUserDefaults.standardUserDefaults().removeObjectForKey(identifier) + UserDefaults.standard.removeObject(forKey: identifier) - Settings.set(.EncodedString, value) + Settings.set(setting: .EncodedString, value) - let result = NSUserDefaults.standardUserDefaults().objectForKey(identifier) as! NSData + let result = UserDefaults.standard.object(forKey: identifier) as! NSData expect(result) == value } it("can store a date") { let identifier = Settings.DateOfBirth.identifier - let formatter = NSDateFormatter() + let formatter = DateFormatter() formatter.dateFormat = "yyyy-MM-dd"; - let value = formatter.dateFromString("1969-02-26") as NSDate! + let value = formatter.date(from: "1969-02-26")! as NSDate - NSUserDefaults.standardUserDefaults().removeObjectForKey(identifier) + UserDefaults.standard.removeObject(forKey: identifier) - Settings.set(.DateOfBirth, value) + Settings.set(setting: .DateOfBirth, value) - let result = NSUserDefaults.standardUserDefaults().objectForKey(identifier) as! NSDate + let result = UserDefaults.standard.object(forKey: identifier) as! NSDate expect(result) == value } @@ -108,11 +108,11 @@ class SettingsKitSpec: QuickSpec { let identifier = Settings.CityState.identifier let value = [ "Detroit": "Michigan", "Austin": "Texas", "Chicago": "Illinois" ] - NSUserDefaults.standardUserDefaults().removeObjectForKey(identifier) + UserDefaults.standard.removeObject(forKey: identifier) - Settings.set(.CityState, value) + Settings.set(setting: .CityState, value) - let result = NSUserDefaults.standardUserDefaults().dictionaryForKey(identifier) as! [String: String] + let result = UserDefaults.standard.dictionary(forKey: identifier) as! [String: String] expect(result) == value } @@ -121,11 +121,11 @@ class SettingsKitSpec: QuickSpec { let identifier = Settings.LuckyNumber.identifier let value = 23 - NSUserDefaults.standardUserDefaults().removeObjectForKey(identifier) + UserDefaults.standard.removeObject(forKey: identifier) - Settings.set(.LuckyNumber, value) + Settings.set(setting: .LuckyNumber, value) - let result = NSUserDefaults.standardUserDefaults().integerForKey(identifier) + let result = UserDefaults.standard.integer(forKey: identifier) expect(result) == value } @@ -134,11 +134,11 @@ class SettingsKitSpec: QuickSpec { let identifier = Settings.ApiEnvironment.identifier let value = "Staging" - NSUserDefaults.standardUserDefaults().removeObjectForKey(identifier) + UserDefaults.standard.removeObject(forKey: identifier) - Settings.set(.ApiEnvironment, value) + Settings.set(setting: .ApiEnvironment, value) - let result = NSUserDefaults.standardUserDefaults().stringForKey(identifier) + let result = UserDefaults.standard.string(forKey: identifier) expect(result) == value } @@ -156,9 +156,9 @@ class SettingsKitSpec: QuickSpec { let identifier = Settings.SocialNetworks.identifier let value = [ "facebook", "twitter", "instagram" ] - NSUserDefaults.standardUserDefaults().setObject(value, forKey: identifier) + UserDefaults.standard.set(value, forKey: identifier) - let result = Settings.get(.SocialNetworks) as! [String] + let result = Settings.get(setting: .SocialNetworks) as! [String] expect(result) == value } @@ -167,33 +167,33 @@ class SettingsKitSpec: QuickSpec { let identifier = Settings.EnableAnalytics.identifier let value = true - NSUserDefaults.standardUserDefaults().setBool(value, forKey: identifier) + UserDefaults.standard.set(value, forKey: identifier) - let result = Settings.get(.EnableAnalytics) as! Bool + let result = Settings.get(setting: .EnableAnalytics) as! Bool expect(result) == value } it("can fetch data") { let identifier = Settings.EncodedString.identifier - let value = NSData(base64EncodedString: "SGVsbG8gV29ybGQ=", options: []) as NSData! + let value = NSData(base64Encoded: "SGVsbG8gV29ybGQ=", options: []) as! NSData - NSUserDefaults.standardUserDefaults().setObject(value, forKey: identifier) + UserDefaults.standard.set(value, forKey: identifier) - let result = Settings.get(.EncodedString) as! NSData + let result = Settings.get(setting: .EncodedString) as! NSData expect(result) == value } it("can fetch a date") { let identifier = Settings.DateOfBirth.identifier - let formatter = NSDateFormatter() + let formatter = DateFormatter() formatter.dateFormat = "yyyy-MM-dd"; - let value = formatter.dateFromString("1969-02-26") as NSDate! + let value = formatter.date(from: "1969-02-26") as! NSDate - NSUserDefaults.standardUserDefaults().setObject(value, forKey: identifier) + UserDefaults.standard.set(value, forKey: identifier) - let result = Settings.get(.DateOfBirth) as! NSDate + let result = Settings.get(setting: .DateOfBirth) as! NSDate expect(result) == value } @@ -202,9 +202,9 @@ class SettingsKitSpec: QuickSpec { let identifier = Settings.CityState.identifier let value = [ "Detroit": "Michigan", "Austin": "Texas", "Chicago": "Illinois" ] - NSUserDefaults.standardUserDefaults().setObject(value, forKey: identifier) + UserDefaults.standard.set(value, forKey: identifier) - let result = Settings.get(.CityState) as! [ String: String ] + let result = Settings.get(setting: .CityState) as! [ String: String ] expect(result) == value } @@ -213,9 +213,9 @@ class SettingsKitSpec: QuickSpec { let identifier = Settings.LuckyNumber.identifier let value = 23 - NSUserDefaults.standardUserDefaults().setInteger(value, forKey: identifier) + UserDefaults.standard.set(value, forKey: identifier) - let result = Settings.get(.LuckyNumber) as! Int + let result = Settings.get(setting: .LuckyNumber) as! Int expect(result) == value } @@ -224,9 +224,9 @@ class SettingsKitSpec: QuickSpec { let identifier = Settings.ApiEnvironment.identifier let value = "Staging" - NSUserDefaults.standardUserDefaults().setObject(value, forKey: identifier) + UserDefaults.standard.set(value, forKey: identifier) - let result = Settings.get(.ApiEnvironment) as! String + let result = Settings.get(setting: .ApiEnvironment) as! String expect(result) == value } @@ -243,13 +243,13 @@ class SettingsKitSpec: QuickSpec { it("the onChange closure is called") { var handlerWasCalled = false - NSUserDefaults.standardUserDefaults().setBool(false, forKey: Settings.EnableAnalytics.identifier) + UserDefaults.standard.set(false, forKey: Settings.EnableAnalytics.identifier) - Settings.subscribe(.EnableAnalytics) { (newValue) -> Void in + Settings.subscribe(setting: .EnableAnalytics) { (newValue) -> Void in handlerWasCalled = true } - NSUserDefaults.standardUserDefaults().setBool(true, forKey: Settings.EnableAnalytics.identifier) + UserDefaults.standard.set(true, forKey: Settings.EnableAnalytics.identifier) expect(handlerWasCalled).toEventually(beTrue()) } @@ -257,15 +257,15 @@ class SettingsKitSpec: QuickSpec { it("the new value of the observed setting is passed to the onChange closure") { var result = false - NSUserDefaults.standardUserDefaults().setBool(false, forKey: Settings.EnableAnalytics.identifier) + UserDefaults.standard.set(false, forKey: Settings.EnableAnalytics.identifier) - Settings.subscribe(.EnableAnalytics) { (newValue) -> Void in + Settings.subscribe(setting: .EnableAnalytics) { (newValue) -> Void in if let newValue = newValue as? Bool { result = newValue } } - NSUserDefaults.standardUserDefaults().setBool(true, forKey: Settings.EnableAnalytics.identifier) + UserDefaults.standard.set(true, forKey: Settings.EnableAnalytics.identifier) expect(result).toEventually(beTrue()) } From 34c9560cc75a19fbb000e87df975fb281b05fa53 Mon Sep 17 00:00:00 2001 From: Bartolomeo Sorrentino Date: Tue, 2 Apr 2019 20:12:06 +0200 Subject: [PATCH 12/12] update podspec --- SettingsKit.podspec | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/SettingsKit.podspec b/SettingsKit.podspec index 768db2f..244973a 100644 --- a/SettingsKit.podspec +++ b/SettingsKit.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "SettingsKit" - s.version = "0.3.0" + s.version = "0.4.0" s.summary = <<-SUMMARY SettingsKit provides an elegant wrapper for iOS app settings. SUMMARY @@ -20,7 +20,7 @@ Pod::Spec.new do |s| s.source_files = [ "Sources/**/*", "cli/**/*", "build" ] s.preserve_paths = [ "cli/**/*", "build" ] - s.ios.deployment_target = '8.3' + s.ios.deployment_target = '10.0' s.osx.deployment_target = '10.11' - s.tvos.deployment_target = '9.0' + s.tvos.deployment_target = '10.0' end