Skip to content

Commit

Permalink
Merge pull request #723 from rechsteiner/swift-6
Browse files Browse the repository at this point in the history
Enable Swift 6 mode
  • Loading branch information
rechsteiner authored Sep 16, 2024
2 parents aff5502 + 7190374 commit 2e3283e
Show file tree
Hide file tree
Showing 32 changed files with 648 additions and 694 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/parchment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ name: "Parchment"
on: [push]
jobs:
build:
runs-on: macos-latest
runs-on: macos-14
steps:
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
xcode-version: '16.0-beta'
- uses: actions/checkout@v3
- name: Unit Tests
run: xcodebuild -project Parchment.xcodeproj -scheme "Parchment" -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 15 Pro,OS=17.5' test
run: xcodebuild -project Parchment.xcodeproj -scheme "Parchment" -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 15 Pro,OS=18.0' test
- name: UI Tests
run: xcodebuild -project Parchment.xcodeproj -scheme "ParchmentUITests" -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 15 Pro,OS=17.5' test
run: xcodebuild -project Parchment.xcodeproj -scheme "ParchmentUITests" -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 15 Pro,OS=18.0' test
2 changes: 1 addition & 1 deletion .swift-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.10
6.0
2 changes: 1 addition & 1 deletion Example/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import UIKit

@UIApplicationMain
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
}
6 changes: 3 additions & 3 deletions Example/Examples/Calendar/DateFormatters.swift
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import Foundation

struct DateFormatters {
static var shortDateFormatter: DateFormatter = {
static let shortDateFormatter: DateFormatter = {
let dateFormatter = DateFormatter()
dateFormatter.timeStyle = .none
dateFormatter.dateStyle = .short
return dateFormatter
}()

static var dateFormatter: DateFormatter = {
static let dateFormatter: DateFormatter = {
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "d"
return dateFormatter
}()

static var weekdayFormatter: DateFormatter = {
static let weekdayFormatter: DateFormatter = {
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "EEE"
return dateFormatter
Expand Down
1 change: 1 addition & 0 deletions Example/Examples/Images/ImagesViewController.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Parchment
import UIKit

@MainActor
protocol ImagesViewControllerDelegate: AnyObject {
func imagesViewControllerDidScroll(_: ImagesViewController)
}
Expand Down
2 changes: 1 addition & 1 deletion 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

let package = Package(
Expand Down
18 changes: 3 additions & 15 deletions Parchment.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -937,7 +937,7 @@
attributes = {
BuildIndependentTargetsInParallel = YES;
LastSwiftUpdateCheck = 1130;
LastUpgradeCheck = 1540;
LastUpgradeCheck = 1600;
ORGANIZATIONNAME = "Martin Rechsteiner";
TargetAttributes = {
3E504EC31C7465B000AE1CE3 = {
Expand Down Expand Up @@ -1275,7 +1275,6 @@
);
PRODUCT_BUNDLE_IDENTIFIER = com.martinrechsteiner.ParchmentTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Example.app/Example";
};
name = Debug;
Expand All @@ -1292,7 +1291,6 @@
);
PRODUCT_BUNDLE_IDENTIFIER = com.martinrechsteiner.ParchmentTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Example.app/Example";
};
name = Release;
Expand Down Expand Up @@ -1351,7 +1349,7 @@
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0.1;
SWIFT_VERSION = 6.0;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
Expand Down Expand Up @@ -1406,7 +1404,7 @@
SDKROOT = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
SWIFT_VERSION = 3.0.1;
SWIFT_VERSION = 6.0;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
VERSIONING_SYSTEM = "apple-generic";
Expand Down Expand Up @@ -1441,7 +1439,6 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand Down Expand Up @@ -1471,14 +1468,12 @@
PRODUCT_BUNDLE_IDENTIFIER = com.martinrechsteiner.Parchment;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 5.0;
};
name = Release;
};
3EA04A6A1C53BFF40054E5E0 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer";
DEVELOPMENT_TEAM = G4TGN24VA2;
Expand All @@ -1490,14 +1485,12 @@
);
PRODUCT_BUNDLE_IDENTIFIER = com.martinrechsteiner.Example;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
};
name = Debug;
};
3EA04A6B1C53BFF40054E5E0 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer";
DEVELOPMENT_TEAM = G4TGN24VA2;
Expand All @@ -1509,7 +1502,6 @@
);
PRODUCT_BUNDLE_IDENTIFIER = com.martinrechsteiner.Example;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand Down Expand Up @@ -1537,7 +1529,6 @@
PRODUCT_BUNDLE_IDENTIFIER = com.martinrechsteiner.ParchmentUITests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_TARGET_NAME = Example;
};
Expand Down Expand Up @@ -1565,7 +1556,6 @@
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.martinrechsteiner.ParchmentUITests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_TARGET_NAME = Example;
};
Expand Down Expand Up @@ -1597,7 +1587,6 @@
PRODUCT_BUNDLE_IDENTIFIER = com.martinrechsteiner.ExampleSwiftUI;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand Down Expand Up @@ -1626,7 +1615,6 @@
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.martinrechsteiner.ExampleSwiftUI;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
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.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
4 changes: 2 additions & 2 deletions Parchment/Classes/PagingBorderLayoutAttributes.swift
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import UIKit

open class PagingBorderLayoutAttributes: UICollectionViewLayoutAttributes {
open var backgroundColor: UIColor?
open var insets: UIEdgeInsets = UIEdgeInsets()
nonisolated(unsafe) open var backgroundColor: UIColor?
nonisolated(unsafe) open var insets: UIEdgeInsets = UIEdgeInsets()

open override func copy(with zone: NSZone? = nil) -> Any {
let copy = super.copy(with: zone) as! PagingBorderLayoutAttributes
Expand Down
2 changes: 1 addition & 1 deletion Parchment/Classes/PagingCellLayoutAttributes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import UIKit
/// A custom `UICollectionViewLayoutAttributes` subclass that adds a
/// `progress` property indicating how far the user has scrolled.
open class PagingCellLayoutAttributes: UICollectionViewLayoutAttributes {
open var progress: CGFloat = 0.0
nonisolated(unsafe) open var progress: CGFloat = 0.0

open override func copy(with zone: NSZone? = nil) -> Any {
let copy = super.copy(with: zone) as! PagingCellLayoutAttributes
Expand Down
2 changes: 1 addition & 1 deletion Parchment/Classes/PagingIndicatorLayoutAttributes.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import UIKit

open class PagingIndicatorLayoutAttributes: UICollectionViewLayoutAttributes {
open var backgroundColor: UIColor?
nonisolated(unsafe) open var backgroundColor: UIColor?

open override func copy(with zone: NSZone? = nil) -> Any {
let copy = super.copy(with: zone) as! PagingIndicatorLayoutAttributes
Expand Down
1 change: 1 addition & 0 deletions Parchment/Protocols/PagingViewControllerSizeDelegate.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import UIKit

@MainActor
public protocol PagingViewControllerSizeDelegate: AnyObject {
/// Manually control the width for a given `PagingItem`. Parchment
/// does not support self-sizing cells, so you have to use this if
Expand Down
3 changes: 3 additions & 0 deletions ParchmentTests/Mocks/Mock.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ enum Action: Equatable {
}

struct MockCall: Equatable {
@MainActor
static var callCount: Int = 0

let index: Int
let action: Action

@MainActor
init(action: Action) {
Self.callCount += 1
self.index = Self.callCount
Expand All @@ -25,6 +27,7 @@ extension MockCall: Comparable {
}
}

@MainActor
protocol Mock {
var calls: [MockCall] { get }
}
Expand Down
1 change: 1 addition & 0 deletions ParchmentTests/Mocks/MockCollectionView.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
@testable import Parchment
import UIKit

@MainActor
final class MockCollectionView: CollectionView, Mock {
enum Action: Equatable {
case contentOffset(CGPoint)
Expand Down
1 change: 1 addition & 0 deletions ParchmentTests/Mocks/MockPagingControllerDelegate.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Foundation
@testable import Parchment

@MainActor
final class MockPagingControllerDelegate: PagingMenuDelegate, Mock {
enum Action: Equatable {
case selectContent(pagingItem: Item, direction: PagingDirection, animated: Bool)
Expand Down
Loading

0 comments on commit 2e3283e

Please sign in to comment.