diff --git a/.travis.yml b/.travis.yml index f94a097..4b6dec2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ os: osx -osx_image: xcode10.1 +osx_image: xcode10.2 branches: only: - master @@ -14,12 +14,12 @@ env: - TVOS_FRAMEWORK_SCHEME="SQift tvOS CI" - WATCHOS_FRAMEWORK_SCHEME="SQift watchOS" matrix: - - DESTINATION="OS=12.1,name=iPhone XS" SCHEME="$IOS_FRAMEWORK_SCHEME" RUN_TESTS="YES" BUILD_EXAMPLE="YES" POD_LINT="YES" + - DESTINATION="OS=12.2,name=iPhone XS" SCHEME="$IOS_FRAMEWORK_SCHEME" RUN_TESTS="YES" BUILD_EXAMPLE="YES" POD_LINT="YES" - DESTINATION="OS=11.3,name=iPhone X" SCHEME="$IOS_FRAMEWORK_SCHEME" RUN_TESTS="YES" BUILD_EXAMPLE="YES" POD_LINT="NO" - DESTINATION="OS=10.3.1,name=iPhone 7" SCHEME="$IOS_FRAMEWORK_SCHEME" RUN_TESTS="YES" BUILD_EXAMPLE="YES" POD_LINT="NO" - DESTINATION="arch=x86_64" SCHEME="$MACOS_FRAMEWORK_SCHEME" RUN_TESTS="YES" BUILD_EXAMPLE="NO" POD_LINT="NO" - - DESTINATION="OS=12.1,name=Apple TV 4K" SCHEME="$TVOS_FRAMEWORK_SCHEME" RUN_TESTS="YES" BUILD_EXAMPLE="NO" POD_LINT="NO" - - DESTINATION="OS=5.1,name=Apple Watch Series 4 - 44mm" SCHEME="$WATCHOS_FRAMEWORK_SCHEME" RUN_TESTS="NO" BUILD_EXAMPLE="NO" POD_LINT="NO" + - DESTINATION="OS=12.2,name=Apple TV 4K" SCHEME="$TVOS_FRAMEWORK_SCHEME" RUN_TESTS="YES" BUILD_EXAMPLE="NO" POD_LINT="NO" + - DESTINATION="OS=5.2,name=Apple Watch Series 4 - 44mm" SCHEME="$WATCHOS_FRAMEWORK_SCHEME" RUN_TESTS="NO" BUILD_EXAMPLE="NO" POD_LINT="NO" before_install: - gem update bundler diff --git a/CHANGELOG.md b/CHANGELOG.md index 85bf1ab..f754fd8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ All notable changes to this project will be documented in this file. #### 4.x Releases +- `4.1.x` Releases - [4.1.0](#410) - `4.0.x` Releases - [4.0.0](#400) #### 3.x Releases @@ -36,12 +37,24 @@ All notable changes to this project will be documented in this file. - `0.2.x` Releases - [0.2.0](#020) - `0.1.x` Releases - [0.1.0](#010) +--- +## [4.1.0](https://github.com/Nike-Inc/SQift/releases/tag/4.1.0) + +Release on 2019-04-30. All issues associated with this milestone can be found using this +[filter](https://github.com/Nike-Inc/SQift/milestone/8?closed=1). + +#### Updated +- To Swift 5 with backwards compatibility to Swift 4.2. + - Updated by [William Thompson](https://github.com/eSpecialized) in Pull Request [#18](https://github.com/Nike-Inc/SQift/pull/18). +- Deployment targets to watchOS 3.0 and tvOS 10.0 in Xcode project to match podspec. + - Updated by [William Thompson](https://github.com/eSpecialized) in Pull Request [#18](https://github.com/Nike-Inc/SQift/pull/18). + --- ## [4.0.0](https://github.com/Nike-Inc/SQift/releases/tag/4.0.0) Release on 2018-11-30. All issues associated with this milestone can be found using this -[filter](https://github.com/Nike-Inc/SQift/milestone/7?closed=1) +[filter](https://github.com/Nike-Inc/SQift/milestone/7?closed=1). #### Added - Migration Guide for SQift 4 and added it to the README. diff --git a/Gemfile b/Gemfile index 34ffb91..0825f41 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,13 @@ +# +# Gemfile +# SQift +# +# Created by William Thompson on 4/30/19 +# Copyright © 2019 Nike. All rights reserved. +# + source "https://rubygems.org" -gem "cocoapods", "~> 1.6.0.beta.1" +gem "cocoapods", "~> 1.7.0.beta.3" gem "xcpretty" + diff --git a/Gemfile.lock b/Gemfile.lock index 266e677..cbab846 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,19 +2,19 @@ GEM remote: https://rubygems.org/ specs: CFPropertyList (3.0.0) - activesupport (4.2.10) + activesupport (4.2.11.1) i18n (~> 0.7) minitest (~> 5.1) thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) atomos (0.1.3) claide (1.0.2) - cocoapods (1.6.0.beta.1) + cocoapods (1.7.0.beta.3) activesupport (>= 4.0.2, < 5) claide (>= 1.0.2, < 2.0) - cocoapods-core (= 1.6.0.beta.1) - cocoapods-deintegrate (>= 1.0.2, < 2.0) - cocoapods-downloader (>= 1.2.1, < 2.0) + cocoapods-core (= 1.7.0.beta.3) + cocoapods-deintegrate (>= 1.0.3, < 2.0) + cocoapods-downloader (>= 1.2.2, < 2.0) cocoapods-plugins (>= 1.0.0, < 2.0) cocoapods-search (>= 1.0.0, < 2.0) cocoapods-stats (>= 1.0.0, < 2.0) @@ -22,30 +22,30 @@ GEM cocoapods-try (>= 1.1.0, < 2.0) colored2 (~> 3.1) escape (~> 0.0.4) - fourflusher (~> 2.0.1) + fourflusher (>= 2.2.0, < 3.0) gh_inspector (~> 1.0) molinillo (~> 0.6.6) nap (~> 1.0) - ruby-macho (~> 1.2) - xcodeproj (>= 1.6.0, < 2.0) - cocoapods-core (1.6.0.beta.1) + ruby-macho (~> 1.4) + xcodeproj (>= 1.8.2, < 2.0) + cocoapods-core (1.7.0.beta.3) activesupport (>= 4.0.2, < 6) fuzzy_match (~> 2.0.4) nap (~> 1.0) - cocoapods-deintegrate (1.0.2) - cocoapods-downloader (1.2.1) + cocoapods-deintegrate (1.0.4) + cocoapods-downloader (1.2.2) cocoapods-plugins (1.0.0) nap cocoapods-search (1.0.0) - cocoapods-stats (1.0.0) + cocoapods-stats (1.1.0) cocoapods-trunk (1.3.1) nap (>= 0.8, < 2.0) netrc (~> 0.11) cocoapods-try (1.1.0) colored2 (3.1.2) - concurrent-ruby (1.0.5) + concurrent-ruby (1.1.5) escape (0.0.4) - fourflusher (2.0.1) + fourflusher (2.2.0) fuzzy_match (2.0.4) gh_inspector (1.1.3) i18n (0.9.5) @@ -56,11 +56,11 @@ GEM nap (1.1.0) netrc (0.11.0) rouge (2.0.7) - ruby-macho (1.2.0) + ruby-macho (1.4.0) thread_safe (0.3.6) tzinfo (1.2.5) thread_safe (~> 0.1) - xcodeproj (1.6.0) + xcodeproj (1.8.2) CFPropertyList (>= 2.3.3, < 4.0) atomos (~> 0.1.3) claide (>= 1.0.2, < 2.0) @@ -73,7 +73,7 @@ PLATFORMS ruby DEPENDENCIES - cocoapods (~> 1.6.0.beta.1) + cocoapods (~> 1.7.0.beta.3) xcpretty BUNDLED WITH diff --git a/README.md b/README.md index e1dd630..8598fec 100644 --- a/README.md +++ b/README.md @@ -30,8 +30,8 @@ SQift is a lightweight Swift wrapper for SQLite. ## Requirements - iOS 10.0+, macOS 10.12+, tvOS 10.0+, watchOS 3.0+ -- Xcode 9.3+ -- Swift 4.1+ +- Xcode 10.0+ +- Swift 4.2+ ## Migration Guides diff --git a/SQift.podspec b/SQift.podspec index ccd7d47..d6cfee5 100644 --- a/SQift.podspec +++ b/SQift.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "SQift" - s.version = "4.0.0" + s.version = "4.1.0" s.license = "MIT" s.summary = "A lightweight Swift wrapper for SQLite." s.homepage = "https://github.com/Nike-Inc/SQift" @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.source = { :git => "https://github.com/Nike-Inc/SQift.git", :tag => s.version } s.source_files = "Source/**/*.swift" - s.swift_version = "4.2" + s.swift_versions = ["4.2", "5.0"] s.ios.deployment_target = "10.0" s.osx.deployment_target = "10.12" diff --git a/SQift.xcodeproj/project.pbxproj b/SQift.xcodeproj/project.pbxproj index 07bcd1a..aa2f57d 100644 --- a/SQift.xcodeproj/project.pbxproj +++ b/SQift.xcodeproj/project.pbxproj @@ -253,7 +253,6 @@ 4C3C4CFA1BFB2B6F0080A0C6 /* SQift.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SQift.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 4C5036FE1F69B13700B54640 /* LICENSE */ = {isa = PBXFileReference; lastKnownFileType = text; path = LICENSE; sourceTree = ""; }; 4C6120751F58BAD500C289C0 /* StringExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StringExtension.swift; sourceTree = ""; }; - 4C6120771F58BAD500C289C0 /* Info-tvOS.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Info-tvOS.plist"; sourceTree = ""; }; 4C6120781F58BAD500C289C0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 4C6120791F58BAD500C289C0 /* SQift.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SQift.h; sourceTree = ""; }; 4C61207C1F58BAD500C289C0 /* Binding.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Binding.swift; sourceTree = ""; }; @@ -365,7 +364,6 @@ 4C6120761F58BAD500C289C0 /* Supporting Files */ = { isa = PBXGroup; children = ( - 4C6120771F58BAD500C289C0 /* Info-tvOS.plist */, 4C6120781F58BAD500C289C0 /* Info.plist */, 4C6120791F58BAD500C289C0 /* SQift.h */, ); @@ -800,18 +798,18 @@ 4C29B3151BFB28330086A2EF = { CreatedOnToolsVersion = 7.1; DevelopmentTeamName = "Nike, Inc."; - LastSwiftMigration = 0900; + LastSwiftMigration = 1020; ProvisioningStyle = Manual; }; 4C29B31E1BFB28330086A2EF = { CreatedOnToolsVersion = 7.1; DevelopmentTeamName = "Nike, Inc."; - LastSwiftMigration = 0900; + LastSwiftMigration = 1020; }; 4C3C4CF91BFB2B6F0080A0C6 = { CreatedOnToolsVersion = 7.1; DevelopmentTeamName = "Nike, Inc."; - LastSwiftMigration = 0900; + LastSwiftMigration = 1020; ProvisioningStyle = Manual; }; 4C7F1E9B1CD3507C00098A83 = { @@ -820,22 +818,23 @@ 4CA8C21D1BF6A49400822606 = { CreatedOnToolsVersion = 7.1; DevelopmentTeamName = "Nike, Inc."; - LastSwiftMigration = 0900; + LastSwiftMigration = 1020; ProvisioningStyle = Manual; }; 4CA8C2271BF6A49400822606 = { CreatedOnToolsVersion = 7.1; DevelopmentTeamName = "Nike, Inc."; - LastSwiftMigration = 0900; + LastSwiftMigration = 1020; }; }; }; buildConfigurationList = 4CA8C2181BF6A49400822606 /* Build configuration list for PBXProject "SQift" */; compatibilityVersion = "Xcode 9.3"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, + Base, ); mainGroup = 4CA8C2141BF6A49400822606; productRefGroup = 4CA8C21F1BF6A49400822606 /* Products */; @@ -1277,7 +1276,7 @@ "$(inherited)", "SQLITE_HAS_CODEC=1", ); - INFOPLIST_FILE = "Source/Supporting Files/Info-tvOS.plist"; + INFOPLIST_FILE = "Source/Supporting Files/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", @@ -1289,6 +1288,7 @@ PRODUCT_NAME = SQift; SDKROOT = appletvos; SKIP_INSTALL = YES; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 3; TVOS_DEPLOYMENT_TARGET = 10.0; }; @@ -1304,7 +1304,7 @@ DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; GCC_PREPROCESSOR_DEFINITIONS = "SQLITE_HAS_CODEC=1"; - INFOPLIST_FILE = "Source/Supporting Files/Info-tvOS.plist"; + INFOPLIST_FILE = "Source/Supporting Files/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", @@ -1316,6 +1316,7 @@ PRODUCT_NAME = SQift; SDKROOT = appletvos; SKIP_INSTALL = YES; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 3; TVOS_DEPLOYMENT_TARGET = 10.0; }; @@ -1337,6 +1338,7 @@ PRODUCT_NAME = "SQift Tests"; PROVISIONING_PROFILE_SPECIFIER = ""; SDKROOT = appletvos; + SWIFT_VERSION = 5.0; TVOS_DEPLOYMENT_TARGET = 10.0; }; name = Debug; @@ -1357,6 +1359,7 @@ PRODUCT_NAME = "SQift Tests"; PROVISIONING_PROFILE_SPECIFIER = ""; SDKROOT = appletvos; + SWIFT_VERSION = 5.0; TVOS_DEPLOYMENT_TARGET = 10.0; }; name = Release; @@ -1387,6 +1390,7 @@ PRODUCT_NAME = SQift; SDKROOT = watchos; SKIP_INSTALL = YES; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 4; WATCHOS_DEPLOYMENT_TARGET = 3.0; }; @@ -1414,6 +1418,7 @@ PRODUCT_NAME = SQift; SDKROOT = watchos; SKIP_INSTALL = YES; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 4; WATCHOS_DEPLOYMENT_TARGET = 3.0; }; @@ -1486,12 +1491,12 @@ ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.2; - TARGETED_DEVICE_FAMILY = "1,2"; - TVOS_DEPLOYMENT_TARGET = 9.0; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2,3"; + TVOS_DEPLOYMENT_TARGET = 10.0; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; - WATCHOS_DEPLOYMENT_TARGET = 2.0; + WATCHOS_DEPLOYMENT_TARGET = 3.0; }; name = Debug; }; @@ -1542,13 +1547,13 @@ SDKROOT = iphoneos; SWIFT_COMPILATION_MODE = wholemodule; SWIFT_OPTIMIZATION_LEVEL = "-O"; - SWIFT_VERSION = 4.2; - TARGETED_DEVICE_FAMILY = "1,2"; - TVOS_DEPLOYMENT_TARGET = 9.0; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2,3"; + TVOS_DEPLOYMENT_TARGET = 10.0; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; - WATCHOS_DEPLOYMENT_TARGET = 2.0; + WATCHOS_DEPLOYMENT_TARGET = 3.0; }; name = Release; }; @@ -1578,6 +1583,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.nike.SQift; PRODUCT_NAME = SQift; SKIP_INSTALL = YES; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -1603,6 +1609,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.nike.SQift; PRODUCT_NAME = SQift; SKIP_INSTALL = YES; + SWIFT_VERSION = 5.0; }; name = Release; }; @@ -1621,6 +1628,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "com.nike.SQift-Tests"; PRODUCT_NAME = "SQift Tests"; PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -1639,6 +1647,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "com.nike.SQift-Tests"; PRODUCT_NAME = "SQift Tests"; PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_VERSION = 5.0; }; name = Release; }; diff --git a/Source/Connection/ConnectionQueue.swift b/Source/Connection/ConnectionQueue.swift index 1e55e79..3773a39 100644 --- a/Source/Connection/ConnectionQueue.swift +++ b/Source/Connection/ConnectionQueue.swift @@ -112,7 +112,9 @@ public class ConnectionQueue { // MARK: - Hashable extension ConnectionQueue: Hashable { - public var hashValue: Int { return id.hashValue } + public func hash(into hasher: inout Hasher) { + hasher.combine(id.hashValue) + } } // MARK: - Equatable diff --git a/Source/Connection/Functions/Function.swift b/Source/Connection/Functions/Function.swift index 314b016..29972a1 100644 --- a/Source/Connection/Functions/Function.swift +++ b/Source/Connection/Functions/Function.swift @@ -361,7 +361,13 @@ extension Connection { sqlite3_result_text64(context, text, UInt64(text.utf8.count), SQLITE_TRANSIENT, UInt8(SQLITE_UTF8)) case .data(var data): - data.withUnsafeBytes { sqlite3_result_blob64(context, $0, UInt64(data.count), SQLITE_TRANSIENT) } + #if swift(<5.0) + data.withUnsafeBytes { sqlite3_result_blob64(context, $0, UInt64(data.count), SQLITE_TRANSIENT) } + #else + data.withUnsafeBytes { + sqlite3_result_blob64(context, $0.bindMemory(to: UInt8.self).baseAddress, UInt64(data.count), SQLITE_TRANSIENT) + } + #endif case .zeroData(let length): sqlite3_result_zeroblob64(context, length) diff --git a/Source/Connection/Statement.swift b/Source/Connection/Statement.swift index 998361d..ca8ff5a 100644 --- a/Source/Connection/Statement.swift +++ b/Source/Connection/Statement.swift @@ -472,9 +472,15 @@ public class Statement { try connection.check(sqlite3_bind_text(handle, index, value, -1, SQLITE_TRANSIENT)) case .blob(let value): - try value.withUnsafeBytes { (bytes: UnsafePointer) -> Void in - try connection.check(sqlite3_bind_blob(handle, index, bytes, Int32(value.count), SQLITE_TRANSIENT)) - } + #if swift(<5.0) + try value.withUnsafeBytes { (bytes: UnsafePointer) -> Void in + try connection.check(sqlite3_bind_blob(handle, index, bytes, Int32(value.count), SQLITE_TRANSIENT)) + } + #else + try value.withUnsafeBytes { + _ = try connection.check(sqlite3_bind_blob(handle, index, $0.bindMemory(to: UInt8.self).baseAddress, Int32(value.count), SQLITE_TRANSIENT)) + } + #endif } } } diff --git a/Source/Supporting Files/Info-tvOS.plist b/Source/Supporting Files/Info-tvOS.plist deleted file mode 100644 index b816779..0000000 --- a/Source/Supporting Files/Info-tvOS.plist +++ /dev/null @@ -1,30 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - FMWK - CFBundleShortVersionString - 4.0.0 - CFBundleSignature - ???? - CFBundleVersion - $(CURRENT_PROJECT_VERSION) - NSPrincipalClass - - UIRequiredDeviceCapabilities - - arm64 - - - diff --git a/Source/Supporting Files/Info.plist b/Source/Supporting Files/Info.plist index 1bcfa6d..5284837 100644 --- a/Source/Supporting Files/Info.plist +++ b/Source/Supporting Files/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 4.0.0 + 4.1.0 CFBundleSignature ???? CFBundleVersion