Skip to content

Commit

Permalink
Opt into Swift 6
Browse files Browse the repository at this point in the history
  • Loading branch information
tevelee committed Jul 8, 2024
1 parent f456746 commit e9ef30b
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 19 deletions.
6 changes: 3 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version: 5.7
// swift-tools-version: 6.0

import PackageDescription

Expand All @@ -17,7 +17,7 @@ let package = Package(
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0")
],
targets: [
.target(name: "Flow", exclude: ["Example"]),
.testTarget(name: "FlowTests", dependencies: ["Flow"])
.target(name: "Flow", exclude: ["Example"], swiftSettings: [.swiftLanguageVersion(.v6)]),
.testTarget(name: "FlowTests", dependencies: ["Flow"], swiftSettings: [.swiftLanguageVersion(.v6)])
]
)
10 changes: 5 additions & 5 deletions Sources/Flow/HFlow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import SwiftUI
@frozen
public struct HFlow<Content: View>: View {
@usableFromInline
let layout: HFlowLayout
nonisolated let layout: HFlowLayout
@usableFromInline
let content: Content

Expand Down Expand Up @@ -166,7 +166,7 @@ extension HFlow: Layout where Content == EmptyView {
}

@inlinable
public func sizeThatFits(
nonisolated public func sizeThatFits(
proposal: ProposedViewSize,
subviews: LayoutSubviews,
cache: inout FlowLayoutCache
Expand All @@ -179,7 +179,7 @@ extension HFlow: Layout where Content == EmptyView {
}

@inlinable
public func placeSubviews(
nonisolated public func placeSubviews(
in bounds: CGRect,
proposal: ProposedViewSize,
subviews: LayoutSubviews,
Expand All @@ -194,12 +194,12 @@ extension HFlow: Layout where Content == EmptyView {
}

@inlinable
public func makeCache(subviews: LayoutSubviews) -> FlowLayoutCache {
nonisolated public func makeCache(subviews: LayoutSubviews) -> FlowLayoutCache {
FlowLayoutCache(subviews, axis: .horizontal)
}

@inlinable
public static var layoutProperties: LayoutProperties {
nonisolated public static var layoutProperties: LayoutProperties {
HFlowLayout.layoutProperties
}
}
4 changes: 2 additions & 2 deletions Sources/Flow/HFlowLayout.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import SwiftUI

/// A layout that arranges its children in a horizontally flowing manner.
@frozen
public struct HFlowLayout {
public struct HFlowLayout: Sendable {
@usableFromInline
let layout: FlowLayout
nonisolated let layout: FlowLayout

/// Creates a horizontal flow with the given spacing and vertical alignment.
///
Expand Down
4 changes: 2 additions & 2 deletions Sources/Flow/Internal/Layout.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import CoreFoundation
import SwiftUI

@usableFromInline
struct FlowLayout {
struct FlowLayout: Sendable {
let axis: Axis
var itemSpacing: CGFloat?
var lineSpacing: CGFloat?
Expand All @@ -11,7 +11,7 @@ struct FlowLayout {
var reversedDepth: Bool = false
var justification: Justification?
var distributeItemsEvenly: Bool
let align: (Dimensions) -> CGFloat
let align: @Sendable (Dimensions) -> CGFloat

private struct ItemWithSpacing<T> {
var item: T
Expand Down
2 changes: 1 addition & 1 deletion Sources/Flow/Internal/Size.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import CoreFoundation
import SwiftUI

@usableFromInline
struct Size {
struct Size: Sendable {
@usableFromInline
var breadth: CGFloat
@usableFromInline
Expand Down
2 changes: 1 addition & 1 deletion Sources/Flow/Support.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import SwiftUI

/// Justified layout stretches lines in a way to create a straight and even edge on both sides of the view
public enum Justification {
public enum Justification: Sendable {
/// Flexible items are stretched proportionally in each line
case stretchItems
/// Spaces between items are stretched equally
Expand Down
10 changes: 5 additions & 5 deletions Sources/Flow/VFlow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import SwiftUI
@frozen
public struct VFlow<Content: View>: View {
@usableFromInline
let layout: VFlowLayout
nonisolated let layout: VFlowLayout
@usableFromInline
let content: Content

Expand Down Expand Up @@ -165,7 +165,7 @@ extension VFlow: Layout where Content == EmptyView {
}

@inlinable
public func sizeThatFits(
nonisolated public func sizeThatFits(
proposal: ProposedViewSize,
subviews: LayoutSubviews,
cache: inout FlowLayoutCache
Expand All @@ -178,7 +178,7 @@ extension VFlow: Layout where Content == EmptyView {
}

@inlinable
public func placeSubviews(
nonisolated public func placeSubviews(
in bounds: CGRect,
proposal: ProposedViewSize,
subviews: LayoutSubviews,
Expand All @@ -193,12 +193,12 @@ extension VFlow: Layout where Content == EmptyView {
}

@inlinable
public func makeCache(subviews: LayoutSubviews) -> FlowLayoutCache {
nonisolated public func makeCache(subviews: LayoutSubviews) -> FlowLayoutCache {
FlowLayoutCache(subviews, axis: .vertical)
}

@inlinable
public static var layoutProperties: LayoutProperties {
nonisolated public static var layoutProperties: LayoutProperties {
VFlowLayout.layoutProperties
}
}

0 comments on commit e9ef30b

Please sign in to comment.