diff --git a/.swiftpm/configuration/Package.resolved b/.swiftpm/configuration/Package.resolved new file mode 100644 index 00000000..a8e4cbc7 --- /dev/null +++ b/.swiftpm/configuration/Package.resolved @@ -0,0 +1,42 @@ +{ + "originHash" : "03685eda65c15da75dbc8741acf2f1e3229945f0308344acd05d8ef6aba454d9", + "pins" : [ + { + "identity" : "splash", + "kind" : "remoteSourceControl", + "location" : "https://github.com/JohnSundell/Splash", + "state" : { + "revision" : "7f4df436eb78fe64fe2c32c58006e9949fa28ad8", + "version" : "0.16.0" + } + }, + { + "identity" : "swift-docc-plugin", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-docc-plugin", + "state" : { + "revision" : "26ac5758409154cc448d7ab82389c520fa8a8247", + "version" : "1.3.0" + } + }, + { + "identity" : "swift-docc-symbolkit", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-docc-symbolkit", + "state" : { + "revision" : "b45d1f2ed151d057b54504d653e0da5552844e34", + "version" : "1.0.0" + } + }, + { + "identity" : "swift-syntax", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-syntax.git", + "state" : { + "revision" : "64889f0c732f210a935a0ad7cda38f77f876262d", + "version" : "509.1.1" + } + } + ], + "version" : 3 +} diff --git a/Package.resolved b/Package.resolved index f448cfc0..5c17278c 100644 --- a/Package.resolved +++ b/Package.resolved @@ -32,8 +32,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-syntax.git", "state" : { - "revision" : "67c5007099d9ffdd292f421f81f4efe5ee42963e", - "version" : "509.0.0-swift-DEVELOPMENT-SNAPSHOT-2023-07-10-a" + "revision" : "64889f0c732f210a935a0ad7cda38f77f876262d", + "version" : "509.1.1" } } ], diff --git a/Package.swift b/Package.swift index edb47c73..706f2ccc 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version: 5.9 +// swift-tools-version: 6.0 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription diff --git a/README.md b/README.md index 4fad0b27..f6a35965 100644 --- a/README.md +++ b/README.md @@ -11,8 +11,7 @@ ![Slides](https://user-images.githubusercontent.com/12427733/190956930-ea9ce4d0-0a19-4bb3-b43b-28dd2d73374a.png) ## Requirements -- Xcode 15+ -- Swift 5.9 +- Swift 6.0 ## Documents First, see the [Tutorial for SlideKit](https://mtj0928.github.io/SlideKit/tutorials/meet-slidekit). diff --git a/SlideKitDemo-iOS/SlideKitDemo-iOS.xcodeproj/project.pbxproj b/SlideKitDemo-iOS/SlideKitDemo-iOS.xcodeproj/project.pbxproj index 1756447c..016c89f8 100644 --- a/SlideKitDemo-iOS/SlideKitDemo-iOS.xcodeproj/project.pbxproj +++ b/SlideKitDemo-iOS/SlideKitDemo-iOS.xcodeproj/project.pbxproj @@ -318,7 +318,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "net.matsuji.SlideKitDemo-iOS"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_EMIT_LOC_STRINGS = YES; - SWIFT_VERSION = 5.0; + SWIFT_VERSION = 6.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; @@ -347,7 +347,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "net.matsuji.SlideKitDemo-iOS"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_EMIT_LOC_STRINGS = YES; - SWIFT_VERSION = 5.0; + SWIFT_VERSION = 6.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; diff --git a/SlideKitDemo-macOS/SlideKitDemo-macOS.xcodeproj/project.pbxproj b/SlideKitDemo-macOS/SlideKitDemo-macOS.xcodeproj/project.pbxproj index d8cbe160..6d509d57 100644 --- a/SlideKitDemo-macOS/SlideKitDemo-macOS.xcodeproj/project.pbxproj +++ b/SlideKitDemo-macOS/SlideKitDemo-macOS.xcodeproj/project.pbxproj @@ -316,7 +316,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "net.matsuji.SlideKitDemo-macOS"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_EMIT_LOC_STRINGS = YES; - SWIFT_VERSION = 5.0; + SWIFT_VERSION = 6.0; }; name = Debug; }; @@ -345,7 +345,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "net.matsuji.SlideKitDemo-macOS"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_EMIT_LOC_STRINGS = YES; - SWIFT_VERSION = 5.0; + SWIFT_VERSION = 6.0; }; name = Release; }; diff --git a/SlideKitDemo-macOS/SlideKitDemo-macOS/SlideConfiguration.swift b/SlideKitDemo-macOS/SlideKitDemo-macOS/SlideConfiguration.swift index c1e37f33..1fca88aa 100644 --- a/SlideKitDemo-macOS/SlideKitDemo-macOS/SlideConfiguration.swift +++ b/SlideKitDemo-macOS/SlideKitDemo-macOS/SlideConfiguration.swift @@ -1,12 +1,7 @@ -// -// SlideConfiguration.swift -// -// Created by Junnosuke Matsumoto on 2022/08/26. -// - import SwiftUI import SlideKit +@MainActor struct SlideConfiguration { /// Edit the slide size. diff --git a/Sources/SlideKit/EnvironmentValues/EnvironmentValues+ExternalDisplayManager.swift.swift b/Sources/SlideKit/EnvironmentValues/EnvironmentValues+ExternalDisplayManager.swift.swift index b3f44c81..62e82a22 100644 --- a/Sources/SlideKit/EnvironmentValues/EnvironmentValues+ExternalDisplayManager.swift.swift +++ b/Sources/SlideKit/EnvironmentValues/EnvironmentValues+ExternalDisplayManager.swift.swift @@ -1,10 +1,3 @@ -// -// EnvironmentValues+ExternalDisplayManager.swift -// -// -// Created by Junnosuke Matsumoto on 2022/08/24. -// - #if os(iOS) import SwiftUI diff --git a/Sources/SlideKit/EnvironmentValues/EnvironmentValues+ObservableObjectContainer.swift b/Sources/SlideKit/EnvironmentValues/EnvironmentValues+ObservableObjectContainer.swift index 2bf764e5..65202263 100644 --- a/Sources/SlideKit/EnvironmentValues/EnvironmentValues+ObservableObjectContainer.swift +++ b/Sources/SlideKit/EnvironmentValues/EnvironmentValues+ObservableObjectContainer.swift @@ -1,10 +1,3 @@ -// -// EnvironmentValues+ObservableObjectContainer.swift -// -// -// Created by Junnosuke Matsumoto on 2022/08/23. -// - import SwiftUI public enum ObservableObjectContainerKey: EnvironmentKey { diff --git a/Sources/SlideKit/ExternalDisplayManager.swift b/Sources/SlideKit/ExternalDisplayManager.swift index 13867dd9..ec886c86 100644 --- a/Sources/SlideKit/ExternalDisplayManager.swift +++ b/Sources/SlideKit/ExternalDisplayManager.swift @@ -10,7 +10,7 @@ import SwiftUI import UIKit @available(iOS 15.0, *) -public class ExternalDisplayManager: ObservableObject { +@MainActor public final class ExternalDisplayManager: ObservableObject { @Published public private(set) var externalDisplayMode = ExternalDisplayMode.presentation diff --git a/Sources/SlideKit/ObservableObjectContainer.swift b/Sources/SlideKit/ObservableObjectContainer.swift index d134a50b..9b0a5749 100644 --- a/Sources/SlideKit/ObservableObjectContainer.swift +++ b/Sources/SlideKit/ObservableObjectContainer.swift @@ -1,17 +1,11 @@ -// -// ObservableObjectContainer.swift -// -// -// Created by Junnosuke Matsumoto on 2022/08/23. -// - import SwiftUI -public class ObservableObjectContainer { +@MainActor +public final class ObservableObjectContainer: Sendable { private var container: [ObjectKey: Any] = [:] - public init() {} + nonisolated public init() {} public func resolve(_ factory: () -> Object) -> Object { let objectKey = ObjectKey(objectType: Object.self) diff --git a/Sources/SlideKit/PhaseWrapper.swift b/Sources/SlideKit/PhaseWrapper.swift index 14bf9939..e4ac75e9 100644 --- a/Sources/SlideKit/PhaseWrapper.swift +++ b/Sources/SlideKit/PhaseWrapper.swift @@ -9,6 +9,7 @@ import Combine import SwiftUI @propertyWrapper +@MainActor public struct PhaseWrapper: DynamicProperty { @Environment(\.slideIndexController) @@ -42,6 +43,7 @@ public struct PhaseWrapper: DynamicProperty { } } +@MainActor @propertyWrapper public struct SharedObject: DynamicProperty { diff --git a/Sources/SlideKit/SlideComponents/HeaderSlide/HeaderSlideStyle.swift b/Sources/SlideKit/SlideComponents/HeaderSlide/HeaderSlideStyle.swift index 6005c7a1..f4b66f19 100644 --- a/Sources/SlideKit/SlideComponents/HeaderSlide/HeaderSlideStyle.swift +++ b/Sources/SlideKit/SlideComponents/HeaderSlide/HeaderSlideStyle.swift @@ -24,7 +24,8 @@ extension View { } } -public protocol HeaderSlideStyle { +@MainActor +public protocol HeaderSlideStyle: Sendable { associatedtype Body : View @ViewBuilder func makeBody(configuration: Self.Configuration) -> Self.Body @@ -33,7 +34,7 @@ public protocol HeaderSlideStyle { } extension HeaderSlideStyle where Self == DefaultHeaderSlideStyle { - public static var `default`: some HeaderSlideStyle { + public nonisolated static var `default`: some HeaderSlideStyle { DefaultHeaderSlideStyle() } } @@ -65,11 +66,11 @@ public struct HeaderSlideStyleConfiguration { public var content: HeaderSlideStyleConfiguration.Content } -struct AnyHeaderSlideStyle: HeaderSlideStyle { - private let converter: (Configuration) -> AnyView +struct AnyHeaderSlideStyle: HeaderSlideStyle, Sendable { + private let converter: @MainActor (Configuration) -> AnyView - init(style: some HeaderSlideStyle) { - converter = { configuration in + nonisolated init(style: some HeaderSlideStyle) { + converter = { @MainActor configuration in AnyView(style.makeBody(configuration: configuration)) } } diff --git a/Sources/SlideKit/SlideComponents/Index/SlideIndex.swift b/Sources/SlideKit/SlideComponents/Index/SlideIndex.swift index 210a5dee..613c65cf 100644 --- a/Sources/SlideKit/SlideComponents/Index/SlideIndex.swift +++ b/Sources/SlideKit/SlideComponents/Index/SlideIndex.swift @@ -31,7 +31,8 @@ extension EnvironmentValues { } } -public protocol IndexStyle { +@MainActor +public protocol IndexStyle: Sendable { typealias Configuration = IndexConfiguration associatedtype Body : View diff --git a/Sources/SlideKit/SlideComponents/Item/ItemStyle.swift b/Sources/SlideKit/SlideComponents/Item/ItemStyle.swift index dc212528..a4daf1db 100644 --- a/Sources/SlideKit/SlideComponents/Item/ItemStyle.swift +++ b/Sources/SlideKit/SlideComponents/Item/ItemStyle.swift @@ -7,7 +7,8 @@ import SwiftUI -public protocol ItemStyle { +@MainActor +public protocol ItemStyle: Sendable { associatedtype Body : View @ViewBuilder func makeBody(configuration: Self.Configuration) -> Self.Body @@ -53,10 +54,10 @@ public struct ItemConfiguration { } } -struct AnyItemStyle: ItemStyle { - private let converter: (Configuration) -> AnyView +struct AnyItemStyle: ItemStyle, Sendable { + private let converter: @MainActor (Configuration) -> AnyView - init(style: some ItemStyle) { + nonisolated init(style: some ItemStyle) { converter = { configuration in AnyView(style.makeBody(configuration: configuration)) } @@ -103,7 +104,7 @@ public struct DefaultItemStyle: ItemStyle { } extension ItemStyle where Self == DefaultItemStyle { - public static var `default`: DefaultItemStyle { + public nonisolated static var `default`: DefaultItemStyle { DefaultItemStyle() } } diff --git a/Sources/SlideKit/SlideIndexController.swift b/Sources/SlideKit/SlideIndexController.swift index 3bf22a5b..f6afd819 100644 --- a/Sources/SlideKit/SlideIndexController.swift +++ b/Sources/SlideKit/SlideIndexController.swift @@ -1,13 +1,8 @@ -// -// SlideIndexController.swift -// -// -// Created by Junnosuke Matsumoto on 2022/08/23. -// - import Foundation -public class SlideIndexController: ObservableObject { +/// A controller managing the current slide index. +@MainActor +public final class SlideIndexController: ObservableObject { @Published public private(set) var currentIndex: Int