Skip to content

Enable Swift 6 support #140

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:
swift:
- "5.9"
- "5.10"
- "6.0"
steps:
- name: Git Checkout
uses: actions/checkout@v4
Expand Down
83 changes: 83 additions & 0 deletions [email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
// swift-tools-version: 6.0

import PackageDescription

let package = Package(
name: "swiftui-navigation-transitions",
platforms: [
.iOS(.v13),
.macCatalyst(.v13),
.tvOS(.v13),
],
swiftLanguageVersions: [.v6]
)

// MARK: Dependencies

package.dependencies = [
.package(url: "https://github.com/siteline/swiftui-introspect", from: "1.0.0"),
.package(url: "https://github.com/pointfreeco/swift-custom-dump", from: "1.0.0"), // dev
.package(url: "https://github.com/pointfreeco/xctest-dynamic-overlay", from: "1.0.0"), // dev
]

let SwiftUIIntrospect: Target.Dependency = .product(
name: "SwiftUIIntrospect",
package: "swiftui-introspect"
)

let CustomDump: Target.Dependency = .product(
name: "CustomDump",
package: "swift-custom-dump"
)

let XCTestDynamicOverlay: Target.Dependency = .product(
name: "XCTestDynamicOverlay",
package: "xctest-dynamic-overlay"
)

// MARK: Targets

package.targets += [
.target(name: "Animation"),

.target(name: "Animator"),
.testTarget(name: "AnimatorTests", dependencies: [
"Animator",
"TestUtils",
]),

.target(name: "AtomicTransition", dependencies: [
"Animator",
]),
.testTarget(name: "AtomicTransitionTests", dependencies: [
"AtomicTransition",
"TestUtils",
]),

.target(name: "NavigationTransition", dependencies: [
"Animation",
"AtomicTransition",
]),

.target(name: "NavigationTransitions", dependencies: [
"NavigationTransition",
"RuntimeAssociation",
"RuntimeSwizzling",
SwiftUIIntrospect,
]),

.target(name: "RuntimeAssociation"),
.target(name: "RuntimeSwizzling"),

.target(name: "TestUtils", dependencies: [
CustomDump,
"NavigationTransitions",
XCTestDynamicOverlay,
]),
]

// MARK: Product

package.products += [
.library(name: "NavigationTransitions", targets: ["NavigationTransitions"]),
]
1 change: 1 addition & 0 deletions Sources/Animation/Animation.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import UIKit

@MainActor
public struct Animation {
static var defaultDuration: Double { 0.35 }

Expand Down
1 change: 1 addition & 0 deletions Sources/Animation/Linear.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@MainActor
extension Animation {
public static func linear(duration: Double) -> Self {
.init(duration: duration, curve: .linear)
Expand Down
1 change: 1 addition & 0 deletions Sources/Animator/Animator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public typealias _Animator = Animator
func addCompletion(_ completion: @escaping (UIViewAnimatingPosition) -> Void)
}

@MainActor
extension Animator where Self: UIViewImplicitlyAnimating {
public func addAnimations(_ animation: @escaping () -> Void) {
addAnimations?(animation)
Expand Down
1 change: 1 addition & 0 deletions Sources/Animator/AnimatorTransientView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import UIKit
/// view being animated, which helps compound mutating values across
/// different defined transitions before actually submitting them
/// to the animator. This helps ensure no jumpy behavior in animations occurs.
@MainActor
@dynamicMemberLookup
public class AnimatorTransientView {
/// Typealias for `AnimatorTransientViewProperties`.
Expand Down
1 change: 1 addition & 0 deletions Sources/Animator/AnimatorTransientViewProperties.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public struct AnimatorTransientViewProperties: Equatable {
public var zPosition: CGFloat
}

@MainActor
extension AnimatorTransientViewProperties {
static let `default` = Self(
alpha: 1,
Expand Down
1 change: 1 addition & 0 deletions Sources/Animator/Transform.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public struct Transform: Equatable {
}
}

@MainActor
extension OptionalWithDefault where Value == Transform {
func assign(to uiView: UIView, force: Bool) {
self.assign(force: force) {
Expand Down
5 changes: 3 additions & 2 deletions Sources/RuntimeSwizzling/Swizzle.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import ObjectiveC

public var swizzleLogs = false
nonisolated(unsafe) public var swizzleLogs = false

@MainActor
public func swizzle(_ type: AnyObject.Type, _ original: Selector, _ swizzled: Selector) {
guard !swizzlingHistory.contains(type, original, swizzled) else {
return
Expand Down Expand Up @@ -46,4 +47,4 @@ private struct SwizzlingHistory {
}
}

private var swizzlingHistory = SwizzlingHistory()
nonisolated(unsafe) private var swizzlingHistory = SwizzlingHistory()
Loading