Skip to content

Commit

Permalink
Xcode 16 and Swift 6 (#50)
Browse files Browse the repository at this point in the history
Xcode 16 and Swift 6
  • Loading branch information
alemar11 authored Nov 22, 2024
1 parent 05de7b1 commit f71b5f5
Show file tree
Hide file tree
Showing 47 changed files with 716 additions and 1,084 deletions.
38 changes: 19 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ concurrency:
jobs:
info:
name: Show macOS and Xcode versions
runs-on: macos-14
runs-on: macos-15
env:
DEVELOPER_DIR: /Applications/Xcode_15.3.app/Contents/Developer
DEVELOPER_DIR: /Applications/Xcode_16.app/Contents/Developer
steps:
- name: Versions
run: |
Expand All @@ -32,9 +32,9 @@ jobs:
xcrun simctl list
macOS:
name: Test macOS
runs-on: macos-14
runs-on: macos-15
env:
DEVELOPER_DIR: /Applications/Xcode_15.3.app/Contents/Developer
DEVELOPER_DIR: /Applications/Xcode_16.app/Contents/Developer
steps:
- uses: actions/checkout@v4
- name: macOS
Expand All @@ -48,12 +48,12 @@ jobs:
path: ~/Downloads/Report
iOS:
name: Test iOS
runs-on: macos-14
runs-on: macos-15
env:
DEVELOPER_DIR: /Applications/Xcode_15.3.app/Contents/Developer
DEVELOPER_DIR: /Applications/Xcode_16.app/Contents/Developer
strategy:
matrix:
destination: ["OS=17.0,name=iPhone 15 Pro"]
destination: ["OS=18.0,name=iPhone 16 Pro"]
steps:
- uses: actions/checkout@v4
- name: iOS - ${{ matrix.destination }}
Expand All @@ -67,12 +67,12 @@ jobs:
path: ~/Downloads/Report
visionOS:
name: Test visionOS
runs-on: macos-14
runs-on: macos-15
env:
DEVELOPER_DIR: /Applications/Xcode_15.3.app/Contents/Developer
DEVELOPER_DIR: /Applications/Xcode_16.app/Contents/Developer
strategy:
matrix:
destination: ["OS=1.0,name=Apple Vision Pro"]
destination: ["OS=2.0,name=Apple Vision Pro"]
steps:
- uses: actions/checkout@v4
- name: iOS - ${{ matrix.destination }}
Expand All @@ -86,12 +86,12 @@ jobs:
path: ~/Downloads/Report
tvOS:
name: Test tvOS
runs-on: macos-14
runs-on: macos-15
env:
DEVELOPER_DIR: /Applications/Xcode_15.3.app/Contents/Developer
DEVELOPER_DIR: /Applications/Xcode_16.app/Contents/Developer
strategy:
matrix:
destination: ["OS=17.0,name=Apple TV"]
destination: ["OS=18.0,name=Apple TV"]
steps:
- uses: actions/checkout@v4
- name: tvOS - ${{ matrix.destination }}
Expand All @@ -105,12 +105,12 @@ jobs:
path: ~/Downloads/Report
watchOS:
name: Test watchOS
runs-on: macos-14
runs-on: macos-15
env:
DEVELOPER_DIR: /Applications/Xcode_15.3.app/Contents/Developer
DEVELOPER_DIR: /Applications/Xcode_16.app/Contents/Developer
strategy:
matrix:
destination: ["OS=10.0,name=Apple Watch Series 9 (45mm)"]
destination: ["OS=11.0,name=Apple Watch Series 10 (46mm)"]
steps:
- uses: actions/checkout@v4
- name: watchOS - ${{ matrix.destination }}
Expand All @@ -124,9 +124,9 @@ jobs:
path: ~/Downloads/Report
SPM:
name: Test SPM Integration
runs-on: macos-14
runs-on: macos-15
env:
DEVELOPER_DIR: /Applications/Xcode_15.3.app/Contents/Developer
DEVELOPER_DIR: /Applications/Xcode_16.app/Contents/Developer
steps:
- uses: actions/checkout@v4
- name: SPM Test
Expand All @@ -135,7 +135,7 @@ jobs:
swift test
# lint:
# name: Swift Lint
# runs-on: macos-14
# runs-on: macos-15
# steps:
# - uses: actions/checkout@v4
# - name: Run SwiftLint
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

### 6.2.0

- Xcode 16
- Swift 6 (Strict concurrency checking)

### 6.1.0

- Added utility methods for `FetchedResultsObjectChange` and `FetchedResultsSectionChange`.
Expand Down
24 changes: 5 additions & 19 deletions CoreDataPlus.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,10 @@
063E100D264BC2F90050E84C /* Deprecated.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Deprecated.swift; sourceTree = "<group>"; };
065094052643E8BC00B3EE12 /* MigrationProgressReporter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MigrationProgressReporter.swift; sourceTree = "<group>"; };
0693F915237C58A7008E4F31 /* workflows */ = {isa = PBXFileReference; lastKnownFileType = text; name = workflows; path = .github/workflows; sourceTree = SOURCE_ROOT; };
06968AD926454BA300088D76 /* CoreDataPlus watchOS.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = "CoreDataPlus watchOS.xctestplan"; sourceTree = "<group>"; };
06968B0C26454FBE00088D76 /* BookCoverToCoverMigrationPolicy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BookCoverToCoverMigrationPolicy.swift; sourceTree = "<group>"; };
06968B112645685F00088D76 /* FeedbackMigrationManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeedbackMigrationManager.swift; sourceTree = "<group>"; };
06A1D11E2BF34C6300F62CA1 /* LegacyMigrationStep.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LegacyMigrationStep.swift; sourceTree = "<group>"; };
06A3C1D3239FD36100E08D45 /* CoreDataPlus macOS.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = "CoreDataPlus macOS.xctestplan"; sourceTree = "<group>"; };
06A3C1D4239FD3E900E08D45 /* CoreDataPlus tvOS.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = "CoreDataPlus tvOS.xctestplan"; sourceTree = "<group>"; };
06A3C1D5239FD83D00E08D45 /* CHANGELOG.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = CHANGELOG.md; sourceTree = SOURCE_ROOT; };
06A4584E239FD22C007BA7C9 /* CoreDataPlus iOS.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = "CoreDataPlus iOS.xctestplan"; sourceTree = "<group>"; };
06A6CD9F261DE0E7000563F0 /* Transformer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Transformer.swift; sourceTree = "<group>"; };
06A6CDC6261DFC8F000563F0 /* Transformer_Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Transformer_Tests.swift; sourceTree = "<group>"; };
06A6CE25261E0961000563F0 /* SampleModel_V1.sqlite */ = {isa = PBXFileReference; lastKnownFileType = file; path = SampleModel_V1.sqlite; sourceTree = "<group>"; };
Expand Down Expand Up @@ -301,10 +297,6 @@
isa = PBXGroup;
children = (
06AF61B126F095070090A61B /* CoreDataPlus.xctestplan */,
06968AD926454BA300088D76 /* CoreDataPlus watchOS.xctestplan */,
06A4584E239FD22C007BA7C9 /* CoreDataPlus iOS.xctestplan */,
06A3C1D3239FD36100E08D45 /* CoreDataPlus macOS.xctestplan */,
06A3C1D4239FD3E900E08D45 /* CoreDataPlus tvOS.xctestplan */,
);
path = TestPlans;
sourceTree = "<group>";
Expand Down Expand Up @@ -612,7 +604,7 @@
attributes = {
BuildIndependentTargetsInParallel = YES;
LastSwiftUpdateCheck = 1300;
LastUpgradeCheck = 1540;
LastUpgradeCheck = 1600;
ORGANIZATIONNAME = "Alessandro Marzoli";
TargetAttributes = {
06AF614726F091370090A61B = {
Expand Down Expand Up @@ -869,7 +861,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 5.0.0;
MARKETING_VERSION = 6.2.0;
MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++";
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++17";
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
Expand All @@ -881,7 +873,6 @@
SUPPORTS_MACCATALYST = YES;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_STRICT_CONCURRENCY = complete;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2,3,4,5,6,7";
TVOS_DEPLOYMENT_TARGET = 16.0;
WATCHOS_DEPLOYMENT_TARGET = 9.0;
Expand Down Expand Up @@ -912,7 +903,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 5.0.0;
MARKETING_VERSION = 6.2.0;
MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++";
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++17";
MTL_FAST_MATH = YES;
Expand All @@ -923,7 +914,6 @@
SUPPORTS_MACCATALYST = YES;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_STRICT_CONCURRENCY = complete;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2,3,4,5,6,7";
TVOS_DEPLOYMENT_TARGET = 16.0;
WATCHOS_DEPLOYMENT_TARGET = 9.0;
Expand All @@ -934,7 +924,6 @@
isa = XCBuildConfiguration;
buildSettings = {
ALLOW_TARGET_PLATFORM_SPECIALIZATION = YES;
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CLANG_ENABLE_OBJC_WEAK = YES;
CODE_SIGN_STYLE = Automatic;
Expand All @@ -956,7 +945,6 @@
SUPPORTS_MACCATALYST = YES;
SWIFT_EMIT_LOC_STRINGS = NO;
SWIFT_STRICT_CONCURRENCY = complete;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2,4,6,7";
TVOS_DEPLOYMENT_TARGET = 16.0;
WATCHOS_DEPLOYMENT_TARGET = 9.0;
Expand All @@ -967,7 +955,6 @@
isa = XCBuildConfiguration;
buildSettings = {
ALLOW_TARGET_PLATFORM_SPECIALIZATION = YES;
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CLANG_ENABLE_OBJC_WEAK = YES;
CODE_SIGN_STYLE = Automatic;
Expand All @@ -988,7 +975,6 @@
SUPPORTS_MACCATALYST = YES;
SWIFT_EMIT_LOC_STRINGS = NO;
SWIFT_STRICT_CONCURRENCY = complete;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2,4,6,7";
TVOS_DEPLOYMENT_TARGET = 16.0;
WATCHOS_DEPLOYMENT_TARGET = 9.0;
Expand Down Expand Up @@ -1108,7 +1094,7 @@
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OBJC_BRIDGING_HEADER = "";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
SWIFT_VERSION = 6.0;
TVOS_DEPLOYMENT_TARGET = 16.0;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
Expand Down Expand Up @@ -1173,7 +1159,7 @@
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OBJC_BRIDGING_HEADER = "";
SWIFT_OPTIMIZATION_LEVEL = "-O";
SWIFT_VERSION = 5.0;
SWIFT_VERSION = 6.0;
TVOS_DEPLOYMENT_TARGET = 16.0;
VALIDATE_PRODUCT = YES;
VERSIONING_SYSTEM = "apple-generic";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1540"
LastUpgradeVersion = "1600"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1540"
LastUpgradeVersion = "1600"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1540"
LastUpgradeVersion = "1600"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
8 changes: 3 additions & 5 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.10
// swift-tools-version: 6.0

import PackageDescription
import Foundation
Expand Down Expand Up @@ -47,9 +47,7 @@ if isRunningFromCommandLine || buildingDocumentation {
"Resources/SampleModel3/SampleModel3.xcdatamodeld"]
}

let swiftSettings: [SwiftSetting] = [
.enableExperimentalFeature("StrictConcurrency")
]
let swiftSettings: [SwiftSetting] = []

let package = Package(
name: "CoreDataPlus",
Expand All @@ -70,7 +68,7 @@ let package = Package(
swiftSettings: swiftSettings
),
],
swiftLanguageVersions: [.v5]
swiftLanguageModes: [.v6]
)

// Only require the docc plugin when building documentation
Expand Down
34 changes: 19 additions & 15 deletions Sources/FetchedResultsChange.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,12 @@ extension FetchedResultsObjectChange {
/// - indexPath: The old index patch for the object
/// - type: The type of the reported change
/// - newIndexPath: The new index path for the object
public init?(object: Any,
indexPath: IndexPath?,
changeType type: NSFetchedResultsChangeType,
newIndexPath: IndexPath?) {
public init?(
object: Any,
indexPath: IndexPath?,
changeType type: NSFetchedResultsChangeType,
newIndexPath: IndexPath?
) {
guard let object = object as? T else {
assertionFailure("Invalid change. The changed object is not a \(T.self).")
return nil
Expand Down Expand Up @@ -93,7 +95,7 @@ extension FetchedResultsObjectChange {
case .update(let object, _): object
}
}

/// Returns `true` if the change is a move.
public var isMove: Bool {
switch self {
Expand All @@ -103,7 +105,7 @@ extension FetchedResultsObjectChange {
return false
}
}

/// Returns`true` if the change is an insertion.
public var isInsertion: Bool {
switch self {
Expand All @@ -113,7 +115,7 @@ extension FetchedResultsObjectChange {
return false
}
}

/// Returns `true` if the change is a deletion.
public var isDeletion: Bool {
switch self {
Expand All @@ -123,7 +125,7 @@ extension FetchedResultsObjectChange {
return false
}
}

/// Returns `true` if the change is an update.
public var isUpdate: Bool {
switch self {
Expand All @@ -133,7 +135,7 @@ extension FetchedResultsObjectChange {
return false
}
}

/// The `IndexPath` of the change.
public var indexPath: IndexPath {
switch self {
Expand Down Expand Up @@ -194,9 +196,11 @@ extension FetchedResultsSectionChange {
/// - sectionInfo: The `NSFetchedResultsSectionInfo` instance
/// - sectionIndex: The section index
/// - type: The type of the reported change
public init?(section sectionInfo: NSFetchedResultsSectionInfo,
index sectionIndex: Int,
changeType type: NSFetchedResultsChangeType) {
public init?(
section sectionInfo: NSFetchedResultsSectionInfo,
index sectionIndex: Int,
changeType type: NSFetchedResultsChangeType
) {
let info = FetchedResultsSectionInfo<T>(from: sectionInfo)

switch type {
Expand All @@ -222,7 +226,7 @@ extension FetchedResultsSectionChange {
case .delete(let info, _): info
}
}

/// Returns`true` if the change is an insertion.
public var isInsertion: Bool {
switch self {
Expand All @@ -232,7 +236,7 @@ extension FetchedResultsSectionChange {
return false
}
}

/// Returns `true` if the change is a deletion.
public var isDeletion: Bool {
switch self {
Expand All @@ -242,7 +246,7 @@ extension FetchedResultsSectionChange {
return false
}
}

/// The index of the change.
public var index: Int {
switch self {
Expand Down
Loading

0 comments on commit f71b5f5

Please sign in to comment.