diff --git a/CHANGELOG.md b/CHANGELOG.md index 7df2fd449..eb75fe94a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,18 @@ Release Notes ============= +## Next Version + +### New + +- Support for Swift 4.1 and Xcode 9.3 +- Added `Cursor.compactMap` ([SE-0187](https://github.com/apple/swift-evolution/blob/master/proposals/0187-introduce-filtermap.md)) + +### Deprecated + +- `Cursor.flatMap` is deprecated. Use `compactMap` instead. + + ## 2.9.0 Released February 25, 2018 • [diff](https://github.com/groue/GRDB.swift/compare/v2.8.0...v2.9.0) diff --git a/DemoApps/GRDBDemoiOS/GRDBDemoiOS.xcodeproj/project.pbxproj b/DemoApps/GRDBDemoiOS/GRDBDemoiOS.xcodeproj/project.pbxproj index c4acc4319..4ae785152 100644 --- a/DemoApps/GRDBDemoiOS/GRDBDemoiOS.xcodeproj/project.pbxproj +++ b/DemoApps/GRDBDemoiOS/GRDBDemoiOS.xcodeproj/project.pbxproj @@ -94,41 +94,6 @@ remoteGlobalIDString = 56553C181C3E906C00522B5C; remoteInfo = GRDBOSXCrashTests; }; - 56B036421E8D9F79003B6DA4 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 56B036261E8D9F79003B6DA4 /* GRDB.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 560FC54D1CB003810014AA8E; - remoteInfo = GRDBCipherOSX; - }; - 56B036441E8D9F79003B6DA4 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 56B036261E8D9F79003B6DA4 /* GRDB.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 560FC5B01CB00B880014AA8E; - remoteInfo = GRDBCipherOSXTests; - }; - 56B036461E8D9F79003B6DA4 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 56B036261E8D9F79003B6DA4 /* GRDB.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 5671566C1CB16729007DC145; - remoteInfo = GRDBCipherOSXEncryptedTests; - }; - 56B036481E8D9F79003B6DA4 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 56B036261E8D9F79003B6DA4 /* GRDB.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = F3BA805A1CFB2BB2003DC1BA; - remoteInfo = GRDBCustomSQLiteOSX; - }; - 56B0364A1E8D9F79003B6DA4 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 56B036261E8D9F79003B6DA4 /* GRDB.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = F3BA809B1CFB2F6F003DC1BA; - remoteInfo = GRDBCustomSQLiteOSXTests; - }; 56B0364C1E8D9F79003B6DA4 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 56B036261E8D9F79003B6DA4 /* GRDB.xcodeproj */; @@ -143,41 +108,6 @@ remoteGlobalIDString = 56E5D7D31B4D3FEE00430942; remoteInfo = GRDBiOSTests; }; - 56B036501E8D9F79003B6DA4 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 56B036261E8D9F79003B6DA4 /* GRDB.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 56AFCA231CB1A8BB00F48B96; - remoteInfo = GRDBCipheriOS; - }; - 56B036521E8D9F79003B6DA4 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 56B036261E8D9F79003B6DA4 /* GRDB.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 56AFCA7F1CB1AA9900F48B96; - remoteInfo = GRDBCipheriOSTests; - }; - 56B036541E8D9F79003B6DA4 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 56B036261E8D9F79003B6DA4 /* GRDB.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 56AFCAD71CB1ABC800F48B96; - remoteInfo = GRDBCipheriOSEncryptedTests; - }; - 56B036561E8D9F79003B6DA4 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 56B036261E8D9F79003B6DA4 /* GRDB.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = F3BA7FFE1CFB25E4003DC1BA; - remoteInfo = GRDBCustomSQLiteiOS; - }; - 56B036581E8D9F79003B6DA4 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 56B036261E8D9F79003B6DA4 /* GRDB.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = F3BA80411CFB2AD7003DC1BA; - remoteInfo = GRDBCustomSQLiteiOSTests; - }; 56B0365A1E8D9F79003B6DA4 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 56B036261E8D9F79003B6DA4 /* GRDB.xcodeproj */; @@ -369,18 +299,8 @@ 56B0363F1E8D9F79003B6DA4 /* GRDBOSXPerformanceTests.xctest */, 563BD2F11F8364C1006A5390 /* GRDBOSXPerformanceComparisonTests.xctest */, 56B036411E8D9F79003B6DA4 /* GRDBOSXCrashTests.xctest */, - 56B036431E8D9F79003B6DA4 /* GRDBCipher.framework */, - 56B036451E8D9F79003B6DA4 /* GRDBCipherOSXTests.xctest */, - 56B036471E8D9F79003B6DA4 /* GRDBCipherOSXEncryptedTests.xctest */, - 56B036491E8D9F79003B6DA4 /* GRDBCustomSQLite.framework */, - 56B0364B1E8D9F79003B6DA4 /* GRDBCustomSQLiteOSXTests.xctest */, 56B0364D1E8D9F79003B6DA4 /* GRDB.framework */, 56B0364F1E8D9F79003B6DA4 /* GRDBiOSTests.xctest */, - 56B036511E8D9F79003B6DA4 /* GRDBCipher.framework */, - 56B036531E8D9F79003B6DA4 /* GRDBCipheriOSTests.xctest */, - 56B036551E8D9F79003B6DA4 /* GRDBCipheriOSEncryptedTests.xctest */, - 56B036571E8D9F79003B6DA4 /* GRDBCustomSQLite.framework */, - 56B036591E8D9F79003B6DA4 /* GRDBCustomSQLiteiOSTests.xctest */, 56B0365B1E8D9F79003B6DA4 /* GRDB.framework */, ); name = Products; @@ -455,7 +375,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0830; - LastUpgradeCheck = 0900; + LastUpgradeCheck = 0930; ORGANIZATIONNAME = "Gwendal Roué"; TargetAttributes = { 568E5FBE1E926430002582E0 = { @@ -537,41 +457,6 @@ remoteRef = 56B036401E8D9F79003B6DA4 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - 56B036431E8D9F79003B6DA4 /* GRDBCipher.framework */ = { - isa = PBXReferenceProxy; - fileType = wrapper.framework; - path = GRDBCipher.framework; - remoteRef = 56B036421E8D9F79003B6DA4 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 56B036451E8D9F79003B6DA4 /* GRDBCipherOSXTests.xctest */ = { - isa = PBXReferenceProxy; - fileType = wrapper.cfbundle; - path = GRDBCipherOSXTests.xctest; - remoteRef = 56B036441E8D9F79003B6DA4 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 56B036471E8D9F79003B6DA4 /* GRDBCipherOSXEncryptedTests.xctest */ = { - isa = PBXReferenceProxy; - fileType = wrapper.cfbundle; - path = GRDBCipherOSXEncryptedTests.xctest; - remoteRef = 56B036461E8D9F79003B6DA4 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 56B036491E8D9F79003B6DA4 /* GRDBCustomSQLite.framework */ = { - isa = PBXReferenceProxy; - fileType = wrapper.framework; - path = GRDBCustomSQLite.framework; - remoteRef = 56B036481E8D9F79003B6DA4 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 56B0364B1E8D9F79003B6DA4 /* GRDBCustomSQLiteOSXTests.xctest */ = { - isa = PBXReferenceProxy; - fileType = wrapper.cfbundle; - path = GRDBCustomSQLiteOSXTests.xctest; - remoteRef = 56B0364A1E8D9F79003B6DA4 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; 56B0364D1E8D9F79003B6DA4 /* GRDB.framework */ = { isa = PBXReferenceProxy; fileType = wrapper.framework; @@ -586,41 +471,6 @@ remoteRef = 56B0364E1E8D9F79003B6DA4 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - 56B036511E8D9F79003B6DA4 /* GRDBCipher.framework */ = { - isa = PBXReferenceProxy; - fileType = wrapper.framework; - path = GRDBCipher.framework; - remoteRef = 56B036501E8D9F79003B6DA4 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 56B036531E8D9F79003B6DA4 /* GRDBCipheriOSTests.xctest */ = { - isa = PBXReferenceProxy; - fileType = wrapper.cfbundle; - path = GRDBCipheriOSTests.xctest; - remoteRef = 56B036521E8D9F79003B6DA4 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 56B036551E8D9F79003B6DA4 /* GRDBCipheriOSEncryptedTests.xctest */ = { - isa = PBXReferenceProxy; - fileType = wrapper.cfbundle; - path = GRDBCipheriOSEncryptedTests.xctest; - remoteRef = 56B036541E8D9F79003B6DA4 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 56B036571E8D9F79003B6DA4 /* GRDBCustomSQLite.framework */ = { - isa = PBXReferenceProxy; - fileType = wrapper.framework; - path = GRDBCustomSQLite.framework; - remoteRef = 56B036561E8D9F79003B6DA4 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 56B036591E8D9F79003B6DA4 /* GRDBCustomSQLiteiOSTests.xctest */ = { - isa = PBXReferenceProxy; - fileType = wrapper.cfbundle; - path = GRDBCustomSQLiteiOSTests.xctest; - remoteRef = 56B036581E8D9F79003B6DA4 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; 56B0365B1E8D9F79003B6DA4 /* GRDB.framework */ = { isa = PBXReferenceProxy; fileType = wrapper.framework; @@ -751,6 +601,7 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_COMPLICATION_NAME = Complication; + CLANG_ENABLE_OBJC_WEAK = YES; DEVELOPMENT_TEAM = AMD8W895CT; INFOPLIST_FILE = "GRDBDemoWatchOS Extension/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; @@ -767,6 +618,7 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_COMPLICATION_NAME = Complication; + CLANG_ENABLE_OBJC_WEAK = YES; DEVELOPMENT_TEAM = AMD8W895CT; INFOPLIST_FILE = "GRDBDemoWatchOS Extension/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; @@ -784,6 +636,7 @@ buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_OBJC_WEAK = YES; DEVELOPMENT_TEAM = AMD8W895CT; IBSC_MODULE = GRDBDemoWatchOS_Extension; INFOPLIST_FILE = GRDBDemoWatchOS/Info.plist; @@ -801,6 +654,7 @@ buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_OBJC_WEAK = YES; DEVELOPMENT_TEAM = AMD8W895CT; IBSC_MODULE = GRDBDemoWatchOS_Extension; INFOPLIST_FILE = GRDBDemoWatchOS/Info.plist; @@ -827,6 +681,7 @@ 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_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; @@ -834,6 +689,7 @@ 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; @@ -883,6 +739,7 @@ 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_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; @@ -890,6 +747,7 @@ 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; @@ -912,6 +770,7 @@ GCC_WARN_UNUSED_VARIABLE = YES; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_VERSION = 4.0; VALIDATE_PRODUCT = YES; @@ -923,6 +782,7 @@ buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_OBJC_WEAK = YES; DEVELOPMENT_TEAM = AMD8W895CT; INFOPLIST_FILE = GRDBDemoiOS/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; @@ -936,6 +796,7 @@ buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_OBJC_WEAK = YES; DEVELOPMENT_TEAM = AMD8W895CT; INFOPLIST_FILE = GRDBDemoiOS/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; diff --git a/DemoApps/GRDBDemoiOS/GRDBDemoiOS.xcodeproj/xcshareddata/xcschemes/GRDBDemoWatchOS.xcscheme b/DemoApps/GRDBDemoiOS/GRDBDemoiOS.xcodeproj/xcshareddata/xcschemes/GRDBDemoWatchOS.xcscheme index 70ba69fe8..16013f9a2 100644 --- a/DemoApps/GRDBDemoiOS/GRDBDemoiOS.xcodeproj/xcshareddata/xcschemes/GRDBDemoWatchOS.xcscheme +++ b/DemoApps/GRDBDemoiOS/GRDBDemoiOS.xcodeproj/xcshareddata/xcschemes/GRDBDemoWatchOS.xcscheme @@ -1,6 +1,6 @@ + codeCoverageEnabled = "YES" + shouldUseLaunchSchemeArgsEnv = "YES"> diff --git a/GRDB.xcodeproj/xcshareddata/xcschemes/GRDBOSXPerformanceComparisonTests.xcscheme b/GRDB.xcodeproj/xcshareddata/xcschemes/GRDBOSXPerformanceComparisonTests.xcscheme index dc203d353..fc3be5e0e 100644 --- a/GRDB.xcodeproj/xcshareddata/xcschemes/GRDBOSXPerformanceComparisonTests.xcscheme +++ b/GRDB.xcodeproj/xcshareddata/xcschemes/GRDBOSXPerformanceComparisonTests.xcscheme @@ -1,6 +1,6 @@ + codeCoverageEnabled = "YES" + shouldUseLaunchSchemeArgsEnv = "YES"> diff --git a/GRDB.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/GRDB.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 000000000..18d981003 --- /dev/null +++ b/GRDB.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/GRDB/Core/Cursor.swift b/GRDB/Core/Cursor.swift index 26ca0b362..7afea0a74 100644 --- a/GRDB/Core/Cursor.swift +++ b/GRDB/Core/Cursor.swift @@ -132,11 +132,24 @@ extension Cursor { return nil } + #if swift(>=4.1) + /// Returns a cursor over the concatenated non-nil results of mapping + /// transform over this cursor. + public func compactMap(_ transform: @escaping (Element) throws -> ElementOfResult?) -> MapCursor>, ElementOfResult> { + return map(transform).filter { $0 != nil }.map { $0! } + } + + @available(*, deprecated, renamed: "compactMap") + public func flatMap(_ transform: @escaping (Element) throws -> ElementOfResult?) -> MapCursor>, ElementOfResult> { + return compactMap(transform) + } + #else /// Returns a cursor over the concatenated non-nil results of mapping /// transform over this cursor. public func flatMap(_ transform: @escaping (Element) throws -> ElementOfResult?) -> MapCursor>, ElementOfResult> { return map(transform).filter { $0 != nil }.map { $0! } } + #endif /// Returns a cursor that skips any initial elements that satisfy /// `predicate`. diff --git a/GRDB/Core/Database.swift b/GRDB/Core/Database.swift index 9a8f4c8eb..ad48f304e 100644 --- a/GRDB/Core/Database.swift +++ b/GRDB/Core/Database.swift @@ -841,11 +841,13 @@ extension Database { self.rawValue = rawValue } + #if !swift(>=4.1) /// The hash value /// :nodoc: public var hashValue: Int { return rawValue.hashValue } + #endif /// The `BINARY` built-in SQL collation public static let binary = CollationName("BINARY") @@ -878,11 +880,13 @@ extension Database { self.rawValue = rawValue } + #if !swift(>=4.1) /// The hash value /// :nodoc: public var hashValue: Int { return rawValue.hashValue } + #endif /// The `TEXT` SQL column type public static let text = ColumnType("TEXT") diff --git a/GRDB/Core/DatabaseError.swift b/GRDB/Core/DatabaseError.swift index 6833c383f..afa6cb5d9 100644 --- a/GRDB/Core/DatabaseError.swift +++ b/GRDB/Core/DatabaseError.swift @@ -139,6 +139,7 @@ public struct ResultCode : RawRepresentable, Equatable, CustomStringConvertible public static let SQLITE_OK_LOAD_PERMANENTLY = ResultCode(rawValue: (SQLITE_OK.rawValue | (1<<8))) } +#if !swift(>=4.1) // Equatable extension ResultCode { /// :nodoc: @@ -146,6 +147,7 @@ extension ResultCode { return lhs.rawValue == rhs.rawValue } } +#endif // CustomStringConvertible extension ResultCode { diff --git a/GRDB/Core/DatabaseFunction.swift b/GRDB/Core/DatabaseFunction.swift index 8de8d1ed4..873a3e922 100644 --- a/GRDB/Core/DatabaseFunction.swift +++ b/GRDB/Core/DatabaseFunction.swift @@ -5,12 +5,27 @@ #endif /// An SQL function or aggregate. -public final class DatabaseFunction { - public let name: String - let argumentCount: Int32? +public final class DatabaseFunction: Hashable { + // SQLite identifies functions by (name + argument count) + private struct Identity: Hashable { + let name: String + let nArg: Int32 // -1 for variadic functions + + #if !swift(>=4.1) + var hashValue: Int { + return name.hashValue ^ nArg.hashValue + } + + static func == (lhs: Identity, rhs: Identity) -> Bool { + return lhs.name == rhs.name && lhs.nArg == rhs.nArg + } + #endif + } + + public var name: String { return identity.name } + private let identity: Identity let pure: Bool private let kind: Kind - private var nArg: Int32 { return argumentCount ?? -1 } private var eTextRep: Int32 { return (SQLITE_UTF8 | (pure ? SQLITE_DETERMINISTIC : 0)) } /// Returns an SQL function. @@ -38,8 +53,7 @@ public final class DatabaseFunction { /// exactly *argumentCount* elements, provided *argumentCount* is /// not nil. public init(_ name: String, argumentCount: Int32? = nil, pure: Bool = false, function: @escaping ([DatabaseValue]) throws -> DatabaseValueConvertible?) { - self.name = name - self.argumentCount = argumentCount + self.identity = Identity(name: name, nArg: argumentCount ?? -1) self.pure = pure self.kind = .function{ (argc, argv) in let arguments = (0..(_ name: String, argumentCount: Int32? = nil, pure: Bool = false, aggregate: Aggregate.Type) { - self.name = name - self.argumentCount = argumentCount + self.identity = Identity(name: name, nArg: argumentCount ?? -1) self.pure = pure self.kind = .aggregate { return Aggregate() } } @@ -104,8 +117,8 @@ public final class DatabaseFunction { let code = sqlite3_create_function_v2( db.sqliteConnection, - name, - nArg, + identity.name, + identity.nArg, eTextRep, definitionP, kind.xFunc, @@ -127,8 +140,8 @@ public final class DatabaseFunction { func uninstall(in db: Database) { let code = sqlite3_create_function_v2( db.sqliteConnection, - name, - nArg, + identity.name, + identity.nArg, eTextRep, nil, nil, nil, nil, nil) @@ -274,7 +287,7 @@ public final class DatabaseFunction { let aggregateContextU = Unmanaged.passRetained(aggregateContext) var aggregateContextP = aggregateContextU.toOpaque() withUnsafeBytes(of: &aggregateContextP) { - aggregateContextBufferP.copyBytes(from: $0) + aggregateContextBufferP.copyMemory(from: $0) } return aggregateContextU } @@ -309,17 +322,17 @@ public final class DatabaseFunction { } } -extension DatabaseFunction : Hashable { +extension DatabaseFunction { /// The hash value /// :nodoc: public var hashValue: Int { - return name.hashValue ^ nArg.hashValue + return identity.hashValue } /// Two functions are equal if they share the same name and arity. /// :nodoc: public static func == (lhs: DatabaseFunction, rhs: DatabaseFunction) -> Bool { - return lhs.name == rhs.name && lhs.nArg == rhs.nArg + return lhs.identity == rhs.identity } } diff --git a/GRDB/Core/DatabaseRegion.swift b/GRDB/Core/DatabaseRegion.swift index 52f67a6fb..678144fbf 100644 --- a/GRDB/Core/DatabaseRegion.swift +++ b/GRDB/Core/DatabaseRegion.swift @@ -255,11 +255,13 @@ private struct TableRegion: Equatable { return false } + #if !swift(>=4.1) static func == (lhs: TableRegion, rhs: TableRegion) -> Bool { if lhs.columns != rhs.columns { return false } if lhs.rowIds != rhs.rowIds { return false } return true } + #endif func intersection(_ other: TableRegion) -> TableRegion { let columnsIntersection: Set? diff --git a/GRDB/Core/Statement.swift b/GRDB/Core/Statement.swift index f29a1536f..e0bf95f60 100644 --- a/GRDB/Core/Statement.swift +++ b/GRDB/Core/Statement.swift @@ -911,6 +911,7 @@ extension StatementArguments { } } +#if !swift(>=4.1) // Equatable extension StatementArguments { /// :nodoc: @@ -920,6 +921,7 @@ extension StatementArguments { return true } } +#endif /// A thread-unsafe statement cache struct StatementCache { diff --git a/GRDB/Core/Support/Foundation/DatabaseDateComponents.swift b/GRDB/Core/Support/Foundation/DatabaseDateComponents.swift index 1e1385a85..93d7978d4 100644 --- a/GRDB/Core/Support/Foundation/DatabaseDateComponents.swift +++ b/GRDB/Core/Support/Foundation/DatabaseDateComponents.swift @@ -105,7 +105,7 @@ public struct DatabaseDateComponents : DatabaseValueConvertible { timeString = nil } - return [dateString, timeString].flatMap { $0 }.joined(separator: " ").databaseValue + return [dateString, timeString].compactMap { $0 }.joined(separator: " ").databaseValue } /// Returns a DatabaseDateComponents if *dbValue* contains a diff --git a/GRDB/Core/TransactionObserver.swift b/GRDB/Core/TransactionObserver.swift index 0d3f0bfe5..00df65ec3 100644 --- a/GRDB/Core/TransactionObserver.swift +++ b/GRDB/Core/TransactionObserver.swift @@ -238,7 +238,7 @@ class DatabaseObservationBroker { // For example, if one observes all deletions in the table T, then // all individual deletions of DELETE FROM T are notified: let eventKind = eventKinds[0] - statementObservations = transactionObservations.flatMap { observation in + statementObservations = transactionObservations.compactMap { observation in guard observation.observes(eventsOfKind: eventKind) else { // observation is not interested return nil @@ -260,7 +260,7 @@ class DatabaseObservationBroker { // For example, if DELETE FROM T1 generates deletions in T1 and T2 // by the mean of a foreign key action, then when one only observes // deletions in T1, one must not be notified of deletions in T2: - statementObservations = transactionObservations.flatMap { observation in + statementObservations = transactionObservations.compactMap { observation in let observedKinds = eventKinds.filter(observation.observes) if observedKinds.isEmpty { // observation is not interested diff --git a/GRDB/FTS/FTS5Tokenizer.swift b/GRDB/FTS/FTS5Tokenizer.swift index dcb01d7f7..20efcdad3 100644 --- a/GRDB/FTS/FTS5Tokenizer.swift +++ b/GRDB/FTS/FTS5Tokenizer.swift @@ -192,10 +192,10 @@ let api = FTS5.api(self) let xTokenizerPointer: UnsafeMutablePointer = .allocate(capacity: 1) - defer { xTokenizerPointer.deallocate(capacity: 1) } + defer { xTokenizerPointer.deallocate() } let contextHandle: UnsafeMutablePointer = .allocate(capacity: 1) - defer { contextHandle.deallocate(capacity: 1) } + defer { contextHandle.deallocate() } let code = api.pointee.xFindTokenizer!( UnsafeMutablePointer(mutating: api), diff --git a/GRDB/Legacy/Swift4.1.swift b/GRDB/Legacy/Swift4.1.swift new file mode 100644 index 000000000..c1adaac2f --- /dev/null +++ b/GRDB/Legacy/Swift4.1.swift @@ -0,0 +1,24 @@ +// Compatibility layer for Swift < 4.1 + +#if !swift(>=4.1) +extension Sequence { + // From future import SE-0187 + func compactMap(_ transform: (Self.Element) throws -> ElementOfResult?) rethrows -> [ElementOfResult] { + return try flatMap(transform) + } +} + +extension UnsafeMutablePointer { + // From future import SE-0184 + func deallocate() { + deallocate(capacity: 0) + } +} + +extension UnsafeMutableRawBufferPointer { + // From future import SE-0184 + func copyMemory(from source: C) where C : Collection, C.Element == UInt8 { + copyBytes(from: source) + } +} +#endif diff --git a/GRDB/QueryInterface/SQLExpression+QueryInterface.swift b/GRDB/QueryInterface/SQLExpression+QueryInterface.swift index 786ec9a5d..ce34318f3 100644 --- a/GRDB/QueryInterface/SQLExpression+QueryInterface.swift +++ b/GRDB/QueryInterface/SQLExpression+QueryInterface.swift @@ -486,6 +486,7 @@ public struct SQLFunctionName : Hashable { self.sql = sql } + #if !swift(>=4.1) /// The hash value /// /// :nodoc: @@ -499,6 +500,7 @@ public struct SQLFunctionName : Hashable { public static func == (lhs: SQLFunctionName, rhs: SQLFunctionName) -> Bool { return lhs.sql == rhs.sql } + #endif } /// [**Experimental**](http://github.com/groue/GRDB.swift#what-are-experimental-features) diff --git a/GRDB/QueryInterface/TableDefinition.swift b/GRDB/QueryInterface/TableDefinition.swift index 9a3242973..52b704542 100644 --- a/GRDB/QueryInterface/TableDefinition.swift +++ b/GRDB/QueryInterface/TableDefinition.swift @@ -463,7 +463,7 @@ public final class TableDefinition { } let indexStatements = columns - .flatMap { $0.indexDefinition(in: name) } + .compactMap { $0.indexDefinition(in: name) } .map { $0.sql() } statements.append(contentsOf: indexStatements) return statements.joined(separator: "; ") diff --git a/GRDB/Record/FetchedRecordsController.swift b/GRDB/Record/FetchedRecordsController.swift index 03dd53490..9d23f784b 100644 --- a/GRDB/Record/FetchedRecordsController.swift +++ b/GRDB/Record/FetchedRecordsController.swift @@ -1050,8 +1050,9 @@ private final class Item : RowConvertible, Equatable { init(row: Row) { self.row = row.copy() } + + static func == (lhs: Item, rhs: Item) -> Bool { + return lhs.row == rhs.row + } } -private func == (lhs: Item, rhs: Item) -> Bool { - return lhs.row == rhs.row -} diff --git a/GRDB/Record/Persistable.swift b/GRDB/Record/Persistable.swift index 002e78175..f511f3346 100644 --- a/GRDB/Record/Persistable.swift +++ b/GRDB/Record/Persistable.swift @@ -977,20 +977,21 @@ final class DAO { // MARK: - InsertQuery -private struct InsertQuery { +private struct InsertQuery: Hashable { let onConflict: Database.ConflictResolution let tableName: String let insertedColumns: [String] -} - -extension InsertQuery : Hashable { + + // Not generated by Swift 4.1 var hashValue: Int { return tableName.hashValue } + #if !swift(>=4.1) static func == (lhs: InsertQuery, rhs: InsertQuery) -> Bool { if lhs.tableName != rhs.tableName { return false } if lhs.onConflict != rhs.onConflict { return false } return lhs.insertedColumns == rhs.insertedColumns } + #endif } extension InsertQuery { @@ -1016,22 +1017,23 @@ extension InsertQuery { // MARK: - UpdateQuery -private struct UpdateQuery { +private struct UpdateQuery: Hashable { let onConflict: Database.ConflictResolution let tableName: String let updatedColumns: [String] let conditionColumns: [String] -} - -extension UpdateQuery : Hashable { + + // Not generated by Swift 4.1 var hashValue: Int { return tableName.hashValue } + #if !swift(>=4.1) static func == (lhs: UpdateQuery, rhs: UpdateQuery) -> Bool { if lhs.tableName != rhs.tableName { return false } if lhs.onConflict != rhs.onConflict { return false } if lhs.updatedColumns != rhs.updatedColumns { return false } return lhs.conditionColumns == rhs.conditionColumns } + #endif } extension UpdateQuery { diff --git a/GRDB/Record/RowConvertible+Decodable.swift b/GRDB/Record/RowConvertible+Decodable.swift index c63ae9942..b8ba94af2 100644 --- a/GRDB/Record/RowConvertible+Decodable.swift +++ b/GRDB/Record/RowConvertible+Decodable.swift @@ -14,7 +14,7 @@ private struct RowKeyedDecodingContainer: KeyedDecodingContainer let row = decoder.row let columnNames = Set(row.columnNames) let scopeNames = row.scopeNames - return columnNames.union(scopeNames).flatMap { Key(stringValue: $0) } + return columnNames.union(scopeNames).compactMap { Key(stringValue: $0) } } /// Returns whether the `Decoder` contains a value associated with the given key. diff --git a/GRDBCipher.xcodeproj/project.pbxproj b/GRDBCipher.xcodeproj/project.pbxproj index 97c210416..56d9918cb 100755 --- a/GRDBCipher.xcodeproj/project.pbxproj +++ b/GRDBCipher.xcodeproj/project.pbxproj @@ -482,6 +482,8 @@ 5698AD251DABAEFA0056AF8C /* FTS5WrapperTokenizer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5698AD201DABAEFA0056AF8C /* FTS5WrapperTokenizer.swift */; }; 5698AD361DABAF4A0056AF8C /* FTS5CustomTokenizer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5698AD341DABAF4A0056AF8C /* FTS5CustomTokenizer.swift */; }; 5698AD391DABAF4A0056AF8C /* FTS5CustomTokenizer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5698AD341DABAF4A0056AF8C /* FTS5CustomTokenizer.swift */; }; + 569B7FA8201C904C0069DE70 /* Swift4.1.swift in Sources */ = {isa = PBXBuildFile; fileRef = 569B7FA6201C904C0069DE70 /* Swift4.1.swift */; }; + 569B7FA9201C904C0069DE70 /* Swift4.1.swift in Sources */ = {isa = PBXBuildFile; fileRef = 569B7FA6201C904C0069DE70 /* Swift4.1.swift */; }; 569C1EB31CF07DDD0042627B /* SchedulingWatchdogTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 569C1EB11CF07DDD0042627B /* SchedulingWatchdogTests.swift */; }; 569C1EB41CF07DDD0042627B /* SchedulingWatchdogTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 569C1EB11CF07DDD0042627B /* SchedulingWatchdogTests.swift */; }; 569C1EB61CF07DDD0042627B /* SchedulingWatchdogTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 569C1EB11CF07DDD0042627B /* SchedulingWatchdogTests.swift */; }; @@ -974,6 +976,7 @@ 5698AD151DAAD16F0056AF8C /* FTS5Tokenizer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FTS5Tokenizer.swift; sourceTree = ""; }; 5698AD201DABAEFA0056AF8C /* FTS5WrapperTokenizer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FTS5WrapperTokenizer.swift; sourceTree = ""; }; 5698AD341DABAF4A0056AF8C /* FTS5CustomTokenizer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FTS5CustomTokenizer.swift; sourceTree = ""; }; + 569B7FA6201C904C0069DE70 /* Swift4.1.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Swift4.1.swift; sourceTree = ""; }; 569C1EB11CF07DDD0042627B /* SchedulingWatchdogTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SchedulingWatchdogTests.swift; sourceTree = ""; }; 569EF0E8200D387000A9FA45 /* DatabaseRegion.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseRegion.swift; sourceTree = ""; }; 56A238131B9C74A90082EB20 /* DatabaseTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseTests.swift; sourceTree = ""; }; @@ -1607,6 +1610,7 @@ 56E06F051E859064008AE2A4 /* Fixits-0.102.0.swift */, 56D121591ED34978001347D2 /* Fixits-0.109.0.swift */, 56873BEB1F2CB400004D24B4 /* Fixits-1.2.swift */, + 569B7FA6201C904C0069DE70 /* Swift4.1.swift */, ); path = Legacy; sourceTree = ""; @@ -1879,7 +1883,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0730; - LastUpgradeCheck = 0900; + LastUpgradeCheck = 0930; ORGANIZATIONNAME = "Gwendal Roué"; TargetAttributes = { 560FC5191CB003810014AA8E = { @@ -2013,6 +2017,7 @@ 5698AC381D9E5A590056AF8C /* FTS3Pattern.swift in Sources */, 564F9C2F1F07611400877A00 /* DatabaseFunction.swift in Sources */, 5659F4991EA8D989004A4992 /* Pool.swift in Sources */, + 569B7FA8201C904C0069DE70 /* Swift4.1.swift in Sources */, 5674A6FA1F307F600095F066 /* Persistable+Encodable.swift in Sources */, 56CEB54D1EAA359A00BFAF62 /* SQLExpressible.swift in Sources */, 5664759B1D97D8A000FF74B8 /* SQLCollection.swift in Sources */, @@ -2407,6 +2412,7 @@ 5698AC3B1D9E5A590056AF8C /* FTS3Pattern.swift in Sources */, 564F9C321F07611700877A00 /* DatabaseFunction.swift in Sources */, 5659F49C1EA8D989004A4992 /* Pool.swift in Sources */, + 569B7FA9201C904C0069DE70 /* Swift4.1.swift in Sources */, 5674A6F71F307F600095F066 /* Persistable+Encodable.swift in Sources */, 56CEB5501EAA359A00BFAF62 /* SQLExpressible.swift in Sources */, 5664759E1D97D8A000FF74B8 /* SQLCollection.swift in Sources */, @@ -2810,6 +2816,7 @@ APPLICATION_EXTENSION_API_ONLY = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_WEAK = YES; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; COMBINE_HIDPI_IMAGES = YES; DEFINES_MODULE = YES; @@ -2830,6 +2837,7 @@ APPLICATION_EXTENSION_API_ONLY = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_WEAK = YES; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; COMBINE_HIDPI_IMAGES = YES; DEFINES_MODULE = YES; @@ -2839,6 +2847,7 @@ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; SKIP_INSTALL = YES; + SWIFT_COMPILATION_MODE = wholemodule; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; }; name = Release; @@ -2847,6 +2856,7 @@ isa = XCBuildConfiguration; baseConfigurationReference = 56C494411ED7269800CC72AF /* GRDBDeploymentTarget.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; COMBINE_HIDPI_IMAGES = YES; DEBUG_INFORMATION_FORMAT = dwarf; GCC_NO_COMMON_BLOCKS = YES; @@ -2863,6 +2873,7 @@ isa = XCBuildConfiguration; baseConfigurationReference = 56C494411ED7269800CC72AF /* GRDBDeploymentTarget.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; @@ -2873,6 +2884,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBCipherOSXTests; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = macosx; + SWIFT_COMPILATION_MODE = wholemodule; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; }; name = Release; @@ -2881,6 +2893,7 @@ isa = XCBuildConfiguration; baseConfigurationReference = 56C494411ED7269800CC72AF /* GRDBDeploymentTarget.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; COMBINE_HIDPI_IMAGES = YES; DEBUG_INFORMATION_FORMAT = dwarf; GCC_NO_COMMON_BLOCKS = YES; @@ -2897,6 +2910,7 @@ isa = XCBuildConfiguration; baseConfigurationReference = 56C494411ED7269800CC72AF /* GRDBDeploymentTarget.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; @@ -2907,6 +2921,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBCipherOSXTests; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = macosx; + SWIFT_COMPILATION_MODE = wholemodule; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; }; name = Release; @@ -2918,6 +2933,7 @@ APPLICATION_EXTENSION_API_ONLY = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_WEAK = YES; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; DEBUG_INFORMATION_FORMAT = dwarf; @@ -2942,6 +2958,7 @@ APPLICATION_EXTENSION_API_ONLY = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_WEAK = YES; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; COPY_PHASE_STRIP = NO; @@ -2955,6 +2972,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; SDKROOT = iphoneos; SKIP_INSTALL = YES; + SWIFT_COMPILATION_MODE = wholemodule; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; TARGETED_DEVICE_FAMILY = "1,2"; }; @@ -2964,6 +2982,7 @@ isa = XCBuildConfiguration; baseConfigurationReference = 56C494411ED7269800CC72AF /* GRDBDeploymentTarget.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; DEBUG_INFORMATION_FORMAT = dwarf; GCC_NO_COMMON_BLOCKS = YES; @@ -2980,6 +2999,7 @@ isa = XCBuildConfiguration; baseConfigurationReference = 56C494411ED7269800CC72AF /* GRDBDeploymentTarget.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; @@ -2990,6 +3010,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBCipheriOSTests; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; }; name = Release; @@ -2998,6 +3019,7 @@ isa = XCBuildConfiguration; baseConfigurationReference = 56C494411ED7269800CC72AF /* GRDBDeploymentTarget.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; DEBUG_INFORMATION_FORMAT = dwarf; GCC_NO_COMMON_BLOCKS = YES; @@ -3014,6 +3036,7 @@ isa = XCBuildConfiguration; baseConfigurationReference = 56C494411ED7269800CC72AF /* GRDBDeploymentTarget.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; @@ -3024,6 +3047,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBCipheriOSEncryptedTests; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; }; name = Release; @@ -3040,12 +3064,14 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; @@ -3093,12 +3119,14 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; @@ -3119,6 +3147,7 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; MTL_ENABLE_DEBUG_INFO = NO; + SWIFT_COMPILATION_MODE = wholemodule; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_VERSION = 4.0; VALIDATE_PRODUCT = YES; diff --git a/GRDBCipher.xcodeproj/xcshareddata/xcschemes/GRDBCipherOSX.xcscheme b/GRDBCipher.xcodeproj/xcshareddata/xcschemes/GRDBCipherOSX.xcscheme index 6ab046b60..1586943d3 100644 --- a/GRDBCipher.xcodeproj/xcshareddata/xcschemes/GRDBCipherOSX.xcscheme +++ b/GRDBCipher.xcodeproj/xcshareddata/xcschemes/GRDBCipherOSX.xcscheme @@ -1,6 +1,6 @@ + + + + diff --git a/GRDBCustom.xcodeproj/xcshareddata/xcschemes/GRDBCustomSQLiteiOS.xcscheme b/GRDBCustom.xcodeproj/xcshareddata/xcschemes/GRDBCustomSQLiteiOS.xcscheme index 7a6690b89..0a3a1bb1c 100644 --- a/GRDBCustom.xcodeproj/xcshareddata/xcschemes/GRDBCustomSQLiteiOS.xcscheme +++ b/GRDBCustom.xcodeproj/xcshareddata/xcschemes/GRDBCustomSQLiteiOS.xcscheme @@ -1,6 +1,6 @@ + codeCoverageEnabled = "YES" + shouldUseLaunchSchemeArgsEnv = "YES"> @@ -71,7 +70,6 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - language = "" launchStyle = "0" useCustomWorkingDirectory = "NO" ignoresPersistentStateOnLaunch = "NO" diff --git a/Makefile b/Makefile index 6f17fe493..847fc35ac 100644 --- a/Makefile +++ b/Makefile @@ -47,7 +47,10 @@ TEST_ACTIONS = clean build build-for-testing test-without-building # xcodebuild destination to run tests on iOS 8.1 (requires a pre-installed simulator) MIN_IOS_DESTINATION = "platform=iOS Simulator,name=iPhone 4s,OS=8.1" -ifeq ($(XCODEVERSION),9.2) +# When adding support for an Xcode version, look for available devices with `instruments -s devices` +ifeq ($(XCODEVERSION),9.3) + MAX_IOS_DESTINATION = "platform=iOS Simulator,name=iPhone 8,OS=11.3" +else ifeq ($(XCODEVERSION),9.2) MAX_IOS_DESTINATION = "platform=iOS Simulator,name=iPhone 8,OS=11.2" else ifeq ($(XCODEVERSION),9.1) MAX_IOS_DESTINATION = "platform=iOS Simulator,name=iPhone 8,OS=11.1" @@ -251,10 +254,10 @@ test_performance: Realm FMDB SQLite.swift -scheme GRDBOSXPerformanceComparisonTests \ build-for-testing test-without-building -Realm: Tests/Performance/Realm/build/osx/swift-4.0.3/RealmSwift.framework +Realm: Tests/Performance/Realm/build/osx/swift-4.1/RealmSwift.framework # Makes sure the Tests/Performance/Realm submodule has been downloaded, and Realm framework has been built. -Tests/Performance/Realm/build/osx/swift-4.0.3/RealmSwift.framework: +Tests/Performance/Realm/build/osx/swift-4.1/RealmSwift.framework: $(GIT) submodule update --init --recursive Tests/Performance/Realm cd Tests/Performance/Realm && sh build.sh osx-swift @@ -303,10 +306,10 @@ ifdef JAZZY --author 'Gwendal Roué' \ --author_url https://github.com/groue \ --github_url https://github.com/groue/GRDB.swift \ - --github-file-prefix https://github.com/groue/GRDB.swift/tree/v2.9.0 \ - --module-version 2.9 \ + --github-file-prefix https://github.com/groue/GRDB.swift/tree/v2.10.0 \ + --module-version 2.10 \ --module GRDB \ - --root-url http://groue.github.io/GRDB.swift/docs/2.9/ \ + --root-url http://groue.github.io/GRDB.swift/docs/2.10/ \ --output Documentation/Reference \ --podspec GRDB.swift.podspec else diff --git a/README.md b/README.md index afc278044..8a627e387 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ GRDB 2 [![Swift](https://img.shields.io/badge/swift-4-orange.svg?style=flat)](ht **Latest release**: February 25, 2018 • version 2.9.0 • [CHANGELOG](CHANGELOG.md) -**Requirements**: iOS 8.0+ / OSX 10.9+ / watchOS 2.0+ • Swift 4.0 / Xcode 9+ +**Requirements**: iOS 8.0+ / OSX 10.9+ / watchOS 2.0+ • Swift 4+ / Xcode 9+ | Swift version | GRDB version | | ------------- | ----------------------------------------------------------- | @@ -675,7 +675,7 @@ Both arrays and cursors can iterate over database results. How do you choose one If you don't see, or don't care about the difference, use arrays. If you care about memory and performance, use cursors when appropriate. -**All GRDB cursors adopt the [Cursor](http://groue.github.io/GRDB.swift/docs/2.9/Protocols/Cursor.html) protocol, which looks a lot like standard [lazy sequences](https://developer.apple.com/reference/swift/lazysequenceprotocol) of Swift.** As such, cursors come with many convenience methods: `contains`, `dropFirst`, `dropLast`, `drop(while:)`, `enumerated`, `filter`, `first`, `flatMap`, `forEach`, `joined`, `joined(separator:)`, `max`, `max(by:)`, `min`, `min(by:)`, `map`, `prefix`, `prefix(while:)`, `reduce`, `reduce(into:)`, `suffix`: +**All GRDB cursors adopt the [Cursor](http://groue.github.io/GRDB.swift/docs/2.9/Protocols/Cursor.html) protocol, which looks a lot like standard [lazy sequences](https://developer.apple.com/reference/swift/lazysequenceprotocol) of Swift.** As such, cursors come with many convenience methods: `compactMap`, `contains`, `dropFirst`, `dropLast`, `drop(while:)`, `enumerated`, `filter`, `first`, `flatMap`, `forEach`, `joined`, `joined(separator:)`, `max`, `max(by:)`, `min`, `min(by:)`, `map`, `prefix`, `prefix(while:)`, `reduce`, `reduce(into:)`, `suffix`: ```swift // All URL hosts @@ -1509,7 +1509,7 @@ When you don't provide any explicit *argumentCount*, the function can take any n ```swift let averageOf = DatabaseFunction("averageOf", pure: true) { (values: [DatabaseValue]) in - let doubles = values.flatMap { Double.fromDatabaseValue($0) } + let doubles = values.compactMap { Double.fromDatabaseValue($0) } return doubles.reduce(0, +) / Double(doubles.count) } dbQueue.add(function: averageOf) diff --git a/TODO.md b/TODO.md index f0baf3825..2c043996f 100644 --- a/TODO.md +++ b/TODO.md @@ -13,6 +13,10 @@ - [ ] Allow concurrent reads from a snapshot - [ ] Decode NSDecimalNumber from text database values +Xcode 9.3, Swift 4.1 + +- [ ] Audit Cursor return types and make it look as much as possible as stdlib's lazy sequence + GRDB 3.0 - [ ] Rename "changes tracking" (ambiguous with database observation) to "record comparison" diff --git a/Tests/GRDBTests/CursorTests.swift b/Tests/GRDBTests/CursorTests.swift index 19c9370e3..81debde5d 100644 --- a/Tests/GRDBTests/CursorTests.swift +++ b/Tests/GRDBTests/CursorTests.swift @@ -78,12 +78,21 @@ class CursorTests: GRDBTestCase { } } + #if swift(>=4.1) + func testCompactMap() { + let cursor = IteratorCursor(["1", "foo", "2"]).compactMap { Int($0) } + XCTAssertEqual(try cursor.next()!, 1) + XCTAssertEqual(try cursor.next()!, 2) + XCTAssertTrue(try cursor.next() == nil) // end + } + #else func testFlatMapOfOptional() { let cursor = IteratorCursor(["1", "foo", "2"]).flatMap { Int($0) } XCTAssertEqual(try cursor.next()!, 1) XCTAssertEqual(try cursor.next()!, 2) XCTAssertTrue(try cursor.next() == nil) // end } + #endif func testForEach() throws { let cursor = IteratorCursor([1, 2]) diff --git a/Tests/GRDBTests/DatabaseAggregateTests.swift b/Tests/GRDBTests/DatabaseAggregateTests.swift index ad0657436..faf882210 100644 --- a/Tests/GRDBTests/DatabaseAggregateTests.swift +++ b/Tests/GRDBTests/DatabaseAggregateTests.swift @@ -295,7 +295,11 @@ class DatabaseAggregateTests: GRDBTestCase { struct Aggregate : DatabaseAggregate { var result: DatabaseValueConvertible? mutating func step(_ dbValues: [DatabaseValue]) { + #if swift(>=4.1) + let ints = dbValues.compactMap { Int.fromDatabaseValue($0) } + #else let ints = dbValues.flatMap { Int.fromDatabaseValue($0) } + #endif result = ints.reduce(0, +) } func finalize() -> DatabaseValueConvertible? { diff --git a/Tests/GRDBTests/DatabaseFunctionTests.swift b/Tests/GRDBTests/DatabaseFunctionTests.swift index 48cd9f874..4fd02a4b7 100644 --- a/Tests/GRDBTests/DatabaseFunctionTests.swift +++ b/Tests/GRDBTests/DatabaseFunctionTests.swift @@ -250,7 +250,11 @@ class DatabaseFunctionTests: GRDBTestCase { func testFunctionOfTwoArguments() throws { let dbQueue = try makeDatabaseQueue() let fn = DatabaseFunction("f", argumentCount: 2) { dbValues in + #if swift(>=4.1) + let ints = dbValues.compactMap { Int.fromDatabaseValue($0) } + #else let ints = dbValues.flatMap { Int.fromDatabaseValue($0) } + #endif return ints.reduce(0, +) } dbQueue.add(function: fn) diff --git a/Tests/GRDBTests/QueryInterfaceExpressionsTests.swift b/Tests/GRDBTests/QueryInterfaceExpressionsTests.swift index daa2c3e1e..2dbdfa946 100644 --- a/Tests/GRDBTests/QueryInterfaceExpressionsTests.swift +++ b/Tests/GRDBTests/QueryInterfaceExpressionsTests.swift @@ -31,7 +31,11 @@ class QueryInterfaceExpressionsTests: GRDBTestCase { dbWriter.add(collation: collation) customFunction = DatabaseFunction("avgOf", pure: true) { dbValues in + #if swift(>=4.1) + let sum = dbValues.compactMap { Int.fromDatabaseValue($0) }.reduce(0, +) + #else let sum = dbValues.flatMap { Int.fromDatabaseValue($0) }.reduce(0, +) + #endif return Double(sum) / Double(dbValues.count) } dbWriter.add(function: self.customFunction) diff --git a/Tests/Performance/GRDBProfiling/GRDBProfiling.xcodeproj/project.pbxproj b/Tests/Performance/GRDBProfiling/GRDBProfiling.xcodeproj/project.pbxproj index 7400ab318..f67b4bf18 100644 --- a/Tests/Performance/GRDBProfiling/GRDBProfiling.xcodeproj/project.pbxproj +++ b/Tests/Performance/GRDBProfiling/GRDBProfiling.xcodeproj/project.pbxproj @@ -45,41 +45,6 @@ remoteGlobalIDString = 56553C181C3E906C00522B5C; remoteInfo = GRDBOSXCrashTests; }; - 564C5B6F1F489B8A00176870 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 56537C841BA8874F00E87787 /* GRDB.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 560FC54D1CB003810014AA8E; - remoteInfo = GRDBCipherOSX; - }; - 564C5B711F489B8A00176870 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 56537C841BA8874F00E87787 /* GRDB.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 560FC5B01CB00B880014AA8E; - remoteInfo = GRDBCipherOSXTests; - }; - 564C5B731F489B8A00176870 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 56537C841BA8874F00E87787 /* GRDB.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 5671566C1CB16729007DC145; - remoteInfo = GRDBCipherOSXEncryptedTests; - }; - 564C5B751F489B8A00176870 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 56537C841BA8874F00E87787 /* GRDB.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = F3BA805A1CFB2BB2003DC1BA; - remoteInfo = GRDBCustomSQLiteOSX; - }; - 564C5B771F489B8A00176870 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 56537C841BA8874F00E87787 /* GRDB.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = F3BA809B1CFB2F6F003DC1BA; - remoteInfo = GRDBCustomSQLiteOSXTests; - }; 564C5B791F489B8A00176870 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 56537C841BA8874F00E87787 /* GRDB.xcodeproj */; @@ -94,41 +59,6 @@ remoteGlobalIDString = 56E5D7D31B4D3FEE00430942; remoteInfo = GRDBiOSTests; }; - 564C5B7D1F489B8A00176870 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 56537C841BA8874F00E87787 /* GRDB.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 56AFCA231CB1A8BB00F48B96; - remoteInfo = GRDBCipheriOS; - }; - 564C5B7F1F489B8A00176870 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 56537C841BA8874F00E87787 /* GRDB.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 56AFCA7F1CB1AA9900F48B96; - remoteInfo = GRDBCipheriOSTests; - }; - 564C5B811F489B8A00176870 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 56537C841BA8874F00E87787 /* GRDB.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 56AFCAD71CB1ABC800F48B96; - remoteInfo = GRDBCipheriOSEncryptedTests; - }; - 564C5B831F489B8A00176870 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 56537C841BA8874F00E87787 /* GRDB.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = F3BA7FFE1CFB25E4003DC1BA; - remoteInfo = GRDBCustomSQLiteiOS; - }; - 564C5B851F489B8A00176870 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 56537C841BA8874F00E87787 /* GRDB.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = F3BA80411CFB2AD7003DC1BA; - remoteInfo = GRDBCustomSQLiteiOSTests; - }; 564C5B871F489B8A00176870 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 56537C841BA8874F00E87787 /* GRDB.xcodeproj */; @@ -136,6 +66,13 @@ remoteGlobalIDString = 565490A01D5A4798005622CB; remoteInfo = GRDBWatchOS; }; + 56B1C3BD201C8B7D001938DA /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 56537C841BA8874F00E87787 /* GRDB.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 56439B501F4CA1DC0066043F; + remoteInfo = GRDBOSXPerformanceComparisonTests; + }; /* End PBXContainerItemProxy section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -182,19 +119,10 @@ 564C5B681F489B8A00176870 /* GRDB.framework */, 564C5B6A1F489B8A00176870 /* GRDBOSXTests.xctest */, 564C5B6C1F489B8A00176870 /* GRDBOSXPerformanceTests.xctest */, + 56B1C3BE201C8B7D001938DA /* GRDBOSXPerformanceComparisonTests.xctest */, 564C5B6E1F489B8A00176870 /* GRDBOSXCrashTests.xctest */, - 564C5B701F489B8A00176870 /* GRDBCipher.framework */, - 564C5B721F489B8A00176870 /* GRDBCipherOSXTests.xctest */, - 564C5B741F489B8A00176870 /* GRDBCipherOSXEncryptedTests.xctest */, - 564C5B761F489B8A00176870 /* GRDBCustomSQLite.framework */, - 564C5B781F489B8A00176870 /* GRDBCustomSQLiteOSXTests.xctest */, 564C5B7A1F489B8A00176870 /* GRDB.framework */, 564C5B7C1F489B8A00176870 /* GRDBiOSTests.xctest */, - 564C5B7E1F489B8A00176870 /* GRDBCipher.framework */, - 564C5B801F489B8A00176870 /* GRDBCipheriOSTests.xctest */, - 564C5B821F489B8A00176870 /* GRDBCipheriOSEncryptedTests.xctest */, - 564C5B841F489B8A00176870 /* GRDBCustomSQLite.framework */, - 564C5B861F489B8A00176870 /* GRDBCustomSQLiteiOSTests.xctest */, 564C5B881F489B8A00176870 /* GRDB.framework */, ); name = Products; @@ -258,7 +186,7 @@ 56537C6A1BA8871A00E87787 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0900; + LastUpgradeCheck = 0930; ORGANIZATIONNAME = "Gwendal Roué"; TargetAttributes = { 56537C711BA8871A00E87787 = { @@ -320,41 +248,6 @@ remoteRef = 564C5B6D1F489B8A00176870 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - 564C5B701F489B8A00176870 /* GRDBCipher.framework */ = { - isa = PBXReferenceProxy; - fileType = wrapper.framework; - path = GRDBCipher.framework; - remoteRef = 564C5B6F1F489B8A00176870 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 564C5B721F489B8A00176870 /* GRDBCipherOSXTests.xctest */ = { - isa = PBXReferenceProxy; - fileType = wrapper.cfbundle; - path = GRDBCipherOSXTests.xctest; - remoteRef = 564C5B711F489B8A00176870 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 564C5B741F489B8A00176870 /* GRDBCipherOSXEncryptedTests.xctest */ = { - isa = PBXReferenceProxy; - fileType = wrapper.cfbundle; - path = GRDBCipherOSXEncryptedTests.xctest; - remoteRef = 564C5B731F489B8A00176870 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 564C5B761F489B8A00176870 /* GRDBCustomSQLite.framework */ = { - isa = PBXReferenceProxy; - fileType = wrapper.framework; - path = GRDBCustomSQLite.framework; - remoteRef = 564C5B751F489B8A00176870 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 564C5B781F489B8A00176870 /* GRDBCustomSQLiteOSXTests.xctest */ = { - isa = PBXReferenceProxy; - fileType = wrapper.cfbundle; - path = GRDBCustomSQLiteOSXTests.xctest; - remoteRef = 564C5B771F489B8A00176870 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; 564C5B7A1F489B8A00176870 /* GRDB.framework */ = { isa = PBXReferenceProxy; fileType = wrapper.framework; @@ -369,41 +262,6 @@ remoteRef = 564C5B7B1F489B8A00176870 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - 564C5B7E1F489B8A00176870 /* GRDBCipher.framework */ = { - isa = PBXReferenceProxy; - fileType = wrapper.framework; - path = GRDBCipher.framework; - remoteRef = 564C5B7D1F489B8A00176870 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 564C5B801F489B8A00176870 /* GRDBCipheriOSTests.xctest */ = { - isa = PBXReferenceProxy; - fileType = wrapper.cfbundle; - path = GRDBCipheriOSTests.xctest; - remoteRef = 564C5B7F1F489B8A00176870 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 564C5B821F489B8A00176870 /* GRDBCipheriOSEncryptedTests.xctest */ = { - isa = PBXReferenceProxy; - fileType = wrapper.cfbundle; - path = GRDBCipheriOSEncryptedTests.xctest; - remoteRef = 564C5B811F489B8A00176870 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 564C5B841F489B8A00176870 /* GRDBCustomSQLite.framework */ = { - isa = PBXReferenceProxy; - fileType = wrapper.framework; - path = GRDBCustomSQLite.framework; - remoteRef = 564C5B831F489B8A00176870 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 564C5B861F489B8A00176870 /* GRDBCustomSQLiteiOSTests.xctest */ = { - isa = PBXReferenceProxy; - fileType = wrapper.cfbundle; - path = GRDBCustomSQLiteiOSTests.xctest; - remoteRef = 564C5B851F489B8A00176870 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; 564C5B881F489B8A00176870 /* GRDB.framework */ = { isa = PBXReferenceProxy; fileType = wrapper.framework; @@ -411,6 +269,13 @@ remoteRef = 564C5B871F489B8A00176870 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; + 56B1C3BE201C8B7D001938DA /* GRDBOSXPerformanceComparisonTests.xctest */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = GRDBOSXPerformanceComparisonTests.xctest; + remoteRef = 56B1C3BD201C8B7D001938DA /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; /* End PBXReferenceProxy section */ /* Begin PBXResourcesBuildPhase section */ @@ -462,12 +327,14 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; @@ -514,12 +381,14 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; @@ -550,6 +419,7 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_OBJC_WEAK = YES; COMBINE_HIDPI_IMAGES = YES; INFOPLIST_FILE = GRDBProfiling/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; @@ -563,11 +433,13 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_OBJC_WEAK = YES; COMBINE_HIDPI_IMAGES = YES; INFOPLIST_FILE = GRDBProfiling/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBProfiling; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_COMPILATION_MODE = wholemodule; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_VERSION = 3.0; };