Skip to content

Commit 891a19a

Browse files
committed
Run SwiftFormat
1 parent 19c5efe commit 891a19a

File tree

15 files changed

+54
-58
lines changed

15 files changed

+54
-58
lines changed

Examples/Package.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import PackageDescription
44

55
let package = Package(
6-
name: "Examples",
7-
products: [],
8-
targets: []
6+
name: "Examples",
7+
products: [],
8+
targets: []
99
)

Examples/Showcase/Showcase/Controls.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import SwiftUI
22
import SwiftUIIntrospect
33

44
struct ControlsShowcase: View {
5-
65
@State private var textFieldValue = ""
76
@State private var toggleValue = false
87
@State private var sliderValue = 0.0
@@ -166,6 +165,5 @@ struct ControlsShowcase: View {
166165
#endif
167166
}
168167
}
169-
170168
}
171169
}

Examples/Showcase/Showcase/List.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,5 @@ struct ListShowcase: View {
104104
}
105105
}
106106
}
107-
108107
}
109108
}

Sources/Introspect.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ extension View {
5050
/// ```
5151
@MainActor
5252
public func introspect<SwiftUIViewType: IntrospectableViewType, PlatformSpecificEntity: PlatformEntity>(
53-
_ viewType: SwiftUIViewType,
54-
on platforms: (PlatformViewVersionPredicate<SwiftUIViewType, PlatformSpecificEntity>)...,
55-
scope: IntrospectionScope? = nil,
56-
customize: @escaping (PlatformSpecificEntity) -> Void
53+
_ viewType: SwiftUIViewType,
54+
on platforms: PlatformViewVersionPredicate<SwiftUIViewType, PlatformSpecificEntity>...,
55+
scope: IntrospectionScope? = nil,
56+
customize: @escaping (PlatformSpecificEntity) -> Void
5757
) -> some View {
5858
self.modifier(IntrospectModifier(viewType, platforms: platforms, scope: scope, customize: customize))
5959
}

Sources/IntrospectionSelector.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ public struct IntrospectionSelector<Target: PlatformEntity> {
2323
)
2424
}
2525

26-
private var receiverSelector: @MainActor (IntrospectionPlatformViewController) -> Target?
27-
private var ancestorSelector: @MainActor (IntrospectionPlatformViewController) -> Target?
26+
private var receiverSelector: @MainActor (IntrospectionPlatformViewController) -> Target? = nil
27+
private var ancestorSelector: @MainActor (IntrospectionPlatformViewController) -> Target? = nil
2828

2929
private init(
3030
receiverSelector: @MainActor @escaping (IntrospectionPlatformViewController) -> Target?,

Sources/IntrospectionView.swift

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ fileprivate enum IntrospectionStore {
88
static var shared: [IntrospectionViewID: Pair] = [:]
99

1010
struct Pair {
11-
weak var controller: IntrospectionPlatformViewController?
12-
weak var anchor: IntrospectionAnchorPlatformViewController?
11+
weak var controller: IntrospectionPlatformViewController? = nil
12+
weak var anchor: IntrospectionAnchorPlatformViewController? = nil
1313
}
1414
}
1515

@@ -88,7 +88,7 @@ struct IntrospectionView<Target: PlatformEntity>: PlatformViewControllerRepresen
8888
#endif
8989

9090
final class TargetCache {
91-
weak var target: Target?
91+
weak var target: Target? = nil
9292
}
9393

9494
@Binding
@@ -113,15 +113,14 @@ struct IntrospectionView<Target: PlatformEntity>: PlatformViewControllerRepresen
113113
}
114114

115115
func makePlatformViewController(context: Context) -> IntrospectionPlatformViewController {
116-
let controller = IntrospectionPlatformViewController(id: id) { controller in
116+
IntrospectionPlatformViewController(id: id) { controller in
117117
guard let target = selector(controller) else {
118118
return
119119
}
120120
context.coordinator.target = target
121121
customize(target)
122122
controller.handler = nil
123123
}
124-
return controller
125124
}
126125

127126
func updatePlatformViewController(_ controller: IntrospectionPlatformViewController, context: Context) {

Sources/PlatformVersion.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ extension PlatformVersion {
2323
public var isCurrentOrPast: Bool {
2424
condition == .current || condition == .past
2525
}
26-
26+
2727
@_spi(Internals)
2828
public var condition: PlatformVersionCondition? { nil }
2929
}
@@ -206,7 +206,7 @@ extension tvOSVersion {
206206
return nil
207207
#endif
208208
}
209-
209+
210210
public static let v17 = tvOSVersion {
211211
#if os(tvOS)
212212
if #available(tvOS 18, *) {

Sources/PlatformView.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,25 +36,25 @@ public protocol PlatformViewControllerRepresentable: _PlatformViewControllerRepr
3636
}
3737

3838
@_spi(Internals)
39-
public extension PlatformViewControllerRepresentable {
39+
extension PlatformViewControllerRepresentable {
4040
#if canImport(UIKit)
41-
func makeUIViewController(context: Context) -> ViewController {
41+
public func makeUIViewController(context: Context) -> ViewController {
4242
makePlatformViewController(context: context)
4343
}
44-
func updateUIViewController(_ controller: ViewController, context: Context) {
44+
public func updateUIViewController(_ controller: ViewController, context: Context) {
4545
updatePlatformViewController(controller, context: context)
4646
}
47-
static func dismantleUIViewController(_ controller: ViewController, coordinator: Coordinator) {
47+
public static func dismantleUIViewController(_ controller: ViewController, coordinator: Coordinator) {
4848
dismantlePlatformViewController(controller, coordinator: coordinator)
4949
}
5050
#elseif canImport(AppKit)
51-
func makeNSViewController(context: Context) -> ViewController {
51+
public func makeNSViewController(context: Context) -> ViewController {
5252
makePlatformViewController(context: context)
5353
}
54-
func updateNSViewController(_ controller: ViewController, context: Context) {
54+
public func updateNSViewController(_ controller: ViewController, context: Context) {
5555
updatePlatformViewController(controller, context: context)
5656
}
57-
static func dismantleNSViewController(_ controller: ViewController, coordinator: Coordinator) {
57+
public static func dismantleNSViewController(_ controller: ViewController, coordinator: Coordinator) {
5858
dismantlePlatformViewController(controller, coordinator: coordinator)
5959
}
6060
#endif

Sources/PlatformViewVersion.swift

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public struct PlatformViewVersionPredicate<SwiftUIViewType: IntrospectableViewTy
1616
}
1717
}
1818

19-
public static func iOS(_ versions: (iOSViewVersion<SwiftUIViewType, PlatformSpecificEntity>)...) -> Self {
19+
public static func iOS(_ versions: iOSViewVersion<SwiftUIViewType, PlatformSpecificEntity>...) -> Self {
2020
Self(versions, matches: \.isCurrent)
2121
}
2222

@@ -25,7 +25,7 @@ public struct PlatformViewVersionPredicate<SwiftUIViewType: IntrospectableViewTy
2525
Self([versions.lowerBound], matches: \.isCurrentOrPast)
2626
}
2727

28-
public static func tvOS(_ versions: (tvOSViewVersion<SwiftUIViewType, PlatformSpecificEntity>)...) -> Self {
28+
public static func tvOS(_ versions: tvOSViewVersion<SwiftUIViewType, PlatformSpecificEntity>...) -> Self {
2929
Self(versions, matches: \.isCurrent)
3030
}
3131

@@ -34,7 +34,7 @@ public struct PlatformViewVersionPredicate<SwiftUIViewType: IntrospectableViewTy
3434
Self([versions.lowerBound], matches: \.isCurrentOrPast)
3535
}
3636

37-
public static func macOS(_ versions: (macOSViewVersion<SwiftUIViewType, PlatformSpecificEntity>)...) -> Self {
37+
public static func macOS(_ versions: macOSViewVersion<SwiftUIViewType, PlatformSpecificEntity>...) -> Self {
3838
Self(versions, matches: \.isCurrent)
3939
}
4040

@@ -43,7 +43,7 @@ public struct PlatformViewVersionPredicate<SwiftUIViewType: IntrospectableViewTy
4343
Self([versions.lowerBound], matches: \.isCurrentOrPast)
4444
}
4545

46-
public static func visionOS(_ versions: (visionOSViewVersion<SwiftUIViewType, PlatformSpecificEntity>)...) -> Self {
46+
public static func visionOS(_ versions: visionOSViewVersion<SwiftUIViewType, PlatformSpecificEntity>...) -> Self {
4747
Self(versions, matches: \.isCurrent)
4848
}
4949

@@ -89,19 +89,19 @@ public enum PlatformViewVersion<Version: PlatformVersion, SwiftUIViewType: Intro
8989
}
9090

9191
private var version: Version? {
92-
if case .available(let version, _) = self {
93-
return version
92+
if case let .available(version, _) = self {
93+
version
9494
} else {
95-
return nil
95+
nil
9696
}
9797
}
9898

9999
@MainActor
100100
fileprivate var selector: IntrospectionSelector<PlatformSpecificEntity>? {
101-
if case .available(_, let selector) = self {
102-
return selector
101+
if case let .available(_, selector) = self {
102+
selector
103103
} else {
104-
return nil
104+
nil
105105
}
106106
}
107107

@@ -117,11 +117,11 @@ public enum PlatformViewVersion<Version: PlatformVersion, SwiftUIViewType: Intro
117117
// This conformance isn't meant to be used directly by the user,
118118
// it's only to satisfy requirements for forming ranges (e.g. `.v15...`).
119119
extension PlatformViewVersion: Comparable {
120-
nonisolated public static func == (lhs: Self, rhs: Self) -> Bool {
120+
public nonisolated static func == (lhs: Self, rhs: Self) -> Bool {
121121
true
122122
}
123123

124-
nonisolated public static func < (lhs: Self, rhs: Self) -> Bool {
124+
public nonisolated static func < (lhs: Self, rhs: Self) -> Bool {
125125
true
126126
}
127127
}

Sources/Utils.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
postfix operator ~
22

3-
postfix func ~ <LHS, T>(lhs: LHS) -> T {
3+
postfix func ~ <T>(lhs: some Any) -> T {
44
lhs as! T
55
}
66

7-
postfix func ~ <LHS, T>(lhs: LHS?) -> T? {
7+
postfix func ~ <T>(lhs: (some Any)?) -> T? {
88
lhs as? T
99
}
1010

0 commit comments

Comments
 (0)