Skip to content

Commit

Permalink
Merge pull request #39 from mtj0928/swift6
Browse files Browse the repository at this point in the history
Support Swift 6
  • Loading branch information
mtj0928 authored Oct 24, 2024
2 parents 541e71d + 406e08d commit 5378ca9
Show file tree
Hide file tree
Showing 16 changed files with 75 additions and 59 deletions.
42 changes: 42 additions & 0 deletions .swiftpm/configuration/Package.resolved
Original file line number Diff line number Diff line change
@@ -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
}
4 changes: 2 additions & 2 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
],
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.9
// swift-tools-version: 6.0
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
4 changes: 2 additions & 2 deletions SlideKitDemo-iOS/SlideKitDemo-iOS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down Expand Up @@ -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;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
//
// EnvironmentValues+ExternalDisplayManager.swift
//
//
// Created by Junnosuke Matsumoto on 2022/08/24.
//

#if os(iOS)
import SwiftUI

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
//
// EnvironmentValues+ObservableObjectContainer.swift
//
//
// Created by Junnosuke Matsumoto on 2022/08/23.
//

import SwiftUI

public enum ObservableObjectContainerKey: EnvironmentKey {
Expand Down
2 changes: 1 addition & 1 deletion Sources/SlideKit/ExternalDisplayManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 3 additions & 9 deletions Sources/SlideKit/ObservableObjectContainer.swift
Original file line number Diff line number Diff line change
@@ -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<Object: ObservableObject>(_ factory: () -> Object) -> Object {
let objectKey = ObjectKey(objectType: Object.self)
Expand Down
2 changes: 2 additions & 0 deletions Sources/SlideKit/PhaseWrapper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import Combine
import SwiftUI

@propertyWrapper
@MainActor
public struct PhaseWrapper<State: PhasedState>: DynamicProperty {

@Environment(\.slideIndexController)
Expand Down Expand Up @@ -42,6 +43,7 @@ public struct PhaseWrapper<State: PhasedState>: DynamicProperty {
}
}

@MainActor
@propertyWrapper
public struct SharedObject<Object: ObservableObject>: DynamicProperty {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()
}
}
Expand Down Expand Up @@ -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))
}
}
Expand Down
3 changes: 2 additions & 1 deletion Sources/SlideKit/SlideComponents/Index/SlideIndex.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ extension EnvironmentValues {
}
}

public protocol IndexStyle {
@MainActor
public protocol IndexStyle: Sendable {
typealias Configuration = IndexConfiguration
associatedtype Body : View

Expand Down
11 changes: 6 additions & 5 deletions Sources/SlideKit/SlideComponents/Item/ItemStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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))
}
Expand Down Expand Up @@ -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()
}
}
Expand Down
11 changes: 3 additions & 8 deletions Sources/SlideKit/SlideIndexController.swift
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 5378ca9

Please sign in to comment.