Skip to content

Commit 38ea0e1

Browse files
authored
Merge pull request MessageKit#1870 from MessageKit/swift6
Migrate to Swift 6, fully support async/await and Swift concurrency, drop iOS 13
2 parents a60ad67 + 3a0f20b commit 38ea0e1

37 files changed

Lines changed: 645 additions & 873 deletions

.github/workflows/ci_pr_example.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ concurrency:
1010
jobs:
1111
tests:
1212
name: Build Example app
13-
runs-on: macos-14
13+
runs-on: macos-15
1414
steps:
1515
- name: Checkout the Git repository
1616
uses: actions/checkout@v4

.github/workflows/ci_pr_framework.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ concurrency:
1010
jobs:
1111
tests:
1212
name: Build Framework
13-
runs-on: macos-14
13+
runs-on: macos-15
1414
steps:
1515
- name: Checkout the Git repository
1616
uses: actions/checkout@v4

.github/workflows/ci_pr_tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ concurrency:
1010
jobs:
1111
tests:
1212
name: Run Tests
13-
runs-on: macos-14
13+
runs-on: macos-15
1414
steps:
1515
- name: Checkout the Git repository
1616
uses: actions/checkout@v4

Example/ChatExample.xcodeproj/project.pbxproj

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -673,13 +673,13 @@
673673
buildSettings = {
674674
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
675675
INFOPLIST_FILE = "$(SRCROOT)/Sources/Resources/Info.plist";
676+
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
676677
LD_RUNPATH_SEARCH_PATHS = (
677678
"$(inherited)",
678679
"@executable_path/Frameworks",
679680
);
680681
PRODUCT_BUNDLE_IDENTIFIER = com.messagekit.ChatExample;
681682
PRODUCT_NAME = "$(TARGET_NAME)";
682-
SWIFT_VERSION = 5.0;
683683
};
684684
name = Debug;
685685
};
@@ -688,6 +688,7 @@
688688
buildSettings = {
689689
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
690690
INFOPLIST_FILE = "$(SRCROOT)/Sources/Resources/Info.plist";
691+
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
691692
LD_RUNPATH_SEARCH_PATHS = (
692693
"$(inherited)",
693694
"@executable_path/Frameworks",
@@ -696,7 +697,6 @@
696697
PRODUCT_NAME = "$(TARGET_NAME)";
697698
SWIFT_COMPILATION_MODE = wholemodule;
698699
SWIFT_OPTIMIZATION_LEVEL = "-O";
699-
SWIFT_VERSION = 5.0;
700700
};
701701
name = Release;
702702
};
@@ -705,14 +705,14 @@
705705
buildSettings = {
706706
BUNDLE_LOADER = "$(TEST_HOST)";
707707
INFOPLIST_FILE = Tests/Info.plist;
708+
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
708709
LD_RUNPATH_SEARCH_PATHS = (
709710
"$(inherited)",
710711
"@executable_path/Frameworks",
711712
"@loader_path/Frameworks",
712713
);
713714
PRODUCT_BUNDLE_IDENTIFIER = com.hexedbits.ChatExampleTests;
714715
PRODUCT_NAME = "$(TARGET_NAME)";
715-
SWIFT_VERSION = 5.0;
716716
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ChatExample.app/ChatExample";
717717
};
718718
name = Debug;
@@ -722,6 +722,7 @@
722722
buildSettings = {
723723
BUNDLE_LOADER = "$(TEST_HOST)";
724724
INFOPLIST_FILE = Tests/Info.plist;
725+
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
725726
LD_RUNPATH_SEARCH_PATHS = (
726727
"$(inherited)",
727728
"@executable_path/Frameworks",
@@ -731,7 +732,6 @@
731732
PRODUCT_NAME = "$(TARGET_NAME)";
732733
SWIFT_COMPILATION_MODE = wholemodule;
733734
SWIFT_OPTIMIZATION_LEVEL = "-O";
734-
SWIFT_VERSION = 5.0;
735735
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ChatExample.app/ChatExample";
736736
};
737737
name = Release;
@@ -740,14 +740,14 @@
740740
isa = XCBuildConfiguration;
741741
buildSettings = {
742742
INFOPLIST_FILE = UITests/Info.plist;
743+
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
743744
LD_RUNPATH_SEARCH_PATHS = (
744745
"$(inherited)",
745746
"@executable_path/Frameworks",
746747
"@loader_path/Frameworks",
747748
);
748749
PRODUCT_BUNDLE_IDENTIFIER = com.hexedbits.ChatExampleUITests;
749750
PRODUCT_NAME = "$(TARGET_NAME)";
750-
SWIFT_VERSION = 5.0;
751751
TEST_TARGET_NAME = ChatExample;
752752
};
753753
name = Debug;
@@ -756,6 +756,7 @@
756756
isa = XCBuildConfiguration;
757757
buildSettings = {
758758
INFOPLIST_FILE = UITests/Info.plist;
759+
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
759760
LD_RUNPATH_SEARCH_PATHS = (
760761
"$(inherited)",
761762
"@executable_path/Frameworks",
@@ -765,7 +766,6 @@
765766
PRODUCT_NAME = "$(TARGET_NAME)";
766767
SWIFT_COMPILATION_MODE = wholemodule;
767768
SWIFT_OPTIMIZATION_LEVEL = "-O";
768-
SWIFT_VERSION = 5.0;
769769
TEST_TARGET_NAME = ChatExample;
770770
};
771771
name = Release;
@@ -817,7 +817,7 @@
817817
repositoryURL = "https://github.com/onevcat/Kingfisher";
818818
requirement = {
819819
kind = upToNextMajorVersion;
820-
minimumVersion = 5.15.8;
820+
minimumVersion = 8.0.0;
821821
};
822822
};
823823
/* End XCRemoteSwiftPackageReference section */

Example/Sources/AppDelegate.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
import UIKit
2424

25-
@UIApplicationMain
25+
@main
2626
final internal class AppDelegate: UIResponder, UIApplicationDelegate {
2727
var window: UIWindow?
2828

@@ -35,7 +35,7 @@ final internal class AppDelegate: UIResponder, UIApplicationDelegate {
3535
UIViewController()
3636
]
3737
: [masterViewController]
38-
splitViewController.preferredDisplayMode = .allVisible
38+
splitViewController.preferredDisplayMode = UISplitViewController.DisplayMode.oneBesideSecondary
3939
masterViewController.navigationItem.largeTitleDisplayMode = .never
4040

4141
window = UIWindow(frame: UIScreen.main.bounds)

Example/Sources/AudioController/BasicAudioController.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ public enum PlayerState {
4242

4343
/// The `BasicAudioController` update UI for current audio cell that is playing a sound
4444
/// and also creates and manage an `AVAudioPlayer` states, play, pause and stop.
45-
open class BasicAudioController: NSObject, AVAudioPlayerDelegate {
45+
@MainActor
46+
open class BasicAudioController: NSObject, @preconcurrency AVAudioPlayerDelegate {
4647
// MARK: Lifecycle
4748

4849
// MARK: - Init Methods

Example/Sources/Models/MockSocket.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import MessageKit
2424
import UIKit
2525

26+
@MainActor
2627
final class MockSocket {
2728
// MARK: Lifecycle
2829

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@
2525

2626
test:
2727
@echo "Running MessageKit tests."
28-
@set -o pipefail && xcodebuild test -scheme MessageKit -sdk iphonesimulator -destination "platform=iOS Simulator,name=iPhone 15" | xcpretty -c
28+
@set -o pipefail && xcodebuild test -scheme MessageKit -sdk iphonesimulator -destination "platform=iOS Simulator,name=iPhone 16" | xcpretty -c
2929

3030
framework:
3131
@echo "Building MessageKit Framework."
32-
@set -o pipefail && xcodebuild build -scheme MessageKit -destination "platform=iOS Simulator,name=iPhone 15" | xcpretty -c
32+
@set -o pipefail && xcodebuild build -scheme MessageKit -destination "platform=iOS Simulator,name=iPhone 16" | xcpretty -c
3333

3434
build_example:
3535
@echo "Building & testing MessageKit Example app."
36-
@cd Example && set -o pipefail && xcodebuild build analyze -scheme ChatExample -destination "platform=iOS Simulator,name=iPhone 15" CODE_SIGNING_REQUIRED=NO | xcpretty -c
36+
@cd Example && set -o pipefail && xcodebuild build analyze -scheme ChatExample -destination "platform=iOS Simulator,name=iPhone 16" CODE_SIGNING_REQUIRED=NO | xcpretty -c
3737

3838
format:
3939
@swift package --allow-writing-to-package-directory format-source-code --file .

Package.swift

Lines changed: 5 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:5.10
1+
// swift-tools-version:6.0
22

33
// MIT License
44
//
@@ -24,14 +24,12 @@ import PackageDescription
2424

2525
let package = Package(
2626
name: "MessageKit",
27-
platforms: [.iOS(.v13)],
27+
platforms: [.iOS(.v14)],
2828
products: [
29-
.library(name: "MessageKit", targets: ["MessageKit"]),
30-
.plugin(name: "LintPlugin", targets: ["LintPlugin"]),
31-
.plugin(name: "SwiftFormatPlugin", targets: ["SwiftFormatPlugin"]),
29+
.library(name: "MessageKit", targets: ["MessageKit"])
3230
],
3331
dependencies: [
34-
.package(url: "https://github.com/nathantannar4/InputBarAccessoryView", .upToNextMajor(from: "6.5.0")),
32+
.package(url: "https://github.com/nathantannar4/InputBarAccessoryView", .upToNextMajor(from: "7.0.0")),
3533
],
3634
targets: [
3735
// MARK: - MessageKit
@@ -44,45 +42,6 @@ let package = Package(
4442
swiftSettings: [SwiftSetting.define("IS_SPM")]
4543
),
4644
.testTarget(name: "MessageKitTests", dependencies: ["MessageKit"]),
47-
48-
// MARK: - Plugins
49-
50-
.binaryTarget(
51-
name: "LintBinary",
52-
url: "https://github.com/realm/SwiftLint/releases/download/0.47.1/SwiftLintBinary-macos.artifactbundle.zip",
53-
checksum: "82ef90b7d76b02e41edd73423687d9cedf0bb9849dcbedad8df3a461e5a7b555"
54-
),
55-
.plugin(
56-
name: "LintPlugin",
57-
capability: .buildTool(),
58-
dependencies: ["LintBinary"]
59-
),
60-
.plugin(
61-
name: "LintCommandPlugin",
62-
capability: .command(
63-
intent: .custom(
64-
verb: "lint",
65-
description: "Lint Swift source files"
66-
)
67-
),
68-
dependencies: ["LintBinary"]
69-
),
70-
71-
.binaryTarget(
72-
name: "swiftformat",
73-
url: "https://github.com/nicklockwood/SwiftFormat/releases/download/0.49.13/swiftformat.artifactbundle.zip",
74-
checksum: "5ce27780dceee8714b15d53141e6dce1a8d626e970eade3c511c9ef1a0c06f40"
75-
),
76-
.plugin(
77-
name: "SwiftFormatPlugin",
78-
capability: .command(
79-
intent: .sourceCodeFormatting(),
80-
permissions: [
81-
.writeToPackageDirectory(reason: "Format Swift source files"),
82-
]
83-
),
84-
dependencies: ["swiftformat"]
85-
),
8645
],
87-
swiftLanguageVersions: [.v5]
46+
swiftLanguageModes: [.v6]
8847
)

Plugins/LintCommandPlugin/SwiftLintCommandPlugin.swift

Lines changed: 0 additions & 54 deletions
This file was deleted.

0 commit comments

Comments
 (0)