diff --git a/Sources/SkipUI/SkipUI/Animation/Animation.swift b/Sources/SkipUI/SkipUI/Animation/Animation.swift index 00dae33..dfae9b9 100644 --- a/Sources/SkipUI/SkipUI/Animation/Animation.swift +++ b/Sources/SkipUI/SkipUI/Animation/Animation.swift @@ -92,7 +92,7 @@ final class AnimationHolder { } #endif -public struct Animation : Hashable, Sendable { +public struct Animation : Hashable { #if SKIP /// The current active animation, whether from the environment via `animation` or from `withAnimation`. @Composable static func current(isAnimating: Bool) -> Animation? { @@ -392,7 +392,7 @@ public struct Animation : Hashable, Sendable { } } -public enum AnimationCompletionCriteria : Hashable, Sendable { +public enum AnimationCompletionCriteria : Hashable { case logicallyComplete case removed } diff --git a/Sources/SkipUI/SkipUI/Animation/Spring.swift b/Sources/SkipUI/SkipUI/Animation/Spring.swift index 406de4e..45d2833 100644 --- a/Sources/SkipUI/SkipUI/Animation/Spring.swift +++ b/Sources/SkipUI/SkipUI/Animation/Spring.swift @@ -9,7 +9,7 @@ import androidx.compose.animation.core.SpringSpec import androidx.compose.animation.core.TweenSpec #endif -public struct Spring : Hashable, Sendable { +public struct Spring : Hashable { #if SKIP private let animationSpec: AnimationSpec @@ -109,7 +109,7 @@ public struct Spring : Hashable, Sendable { } } -public enum SpringLoadingBehavior : Hashable, Sendable { +public enum SpringLoadingBehavior : Hashable { case automatic case enabled case disabled diff --git a/Sources/SkipUI/SkipUI/Animation/Transition.swift b/Sources/SkipUI/SkipUI/Animation/Transition.swift index 058a127..7b90d83 100644 --- a/Sources/SkipUI/SkipUI/Animation/Transition.swift +++ b/Sources/SkipUI/SkipUI/Animation/Transition.swift @@ -75,7 +75,7 @@ extension Transition { #endif } -public struct ContentTransition : RawRepresentable, Equatable, Sendable { +public struct ContentTransition : RawRepresentable, Equatable { public let rawValue: Int public init(rawValue: Int) { self.rawValue = rawValue @@ -156,7 +156,7 @@ public struct AnyTransition { } } -public enum TransitionPhase: Hashable, Sendable { +public enum TransitionPhase: Hashable { case willAppear case identity case didDisappear @@ -177,7 +177,7 @@ public enum TransitionPhase: Hashable, Sendable { } } -public struct TransitionProperties : Sendable { +public struct TransitionProperties { public let hasMotion: Bool public init(hasMotion: Bool = true) { diff --git a/Sources/SkipUI/SkipUI/App/Scene.swift b/Sources/SkipUI/SkipUI/App/Scene.swift index 15bc690..a1d7f60 100644 --- a/Sources/SkipUI/SkipUI/App/Scene.swift +++ b/Sources/SkipUI/SkipUI/App/Scene.swift @@ -10,7 +10,7 @@ public protocol Scene { extension Scene { @available(*, unavailable) - public func backgroundTask(_ task: BackgroundTask, action: @escaping @Sendable (D) async -> R) -> some Scene /* where D : Sendable, R : Sendable */ { + public func backgroundTask(_ task: BackgroundTask, action: @escaping (D) async -> R) -> some Scene /* where D : Sendable, R : Sendable */ { return self } @@ -70,7 +70,7 @@ extension Scene { } } -public struct ScenePadding : Equatable, Sendable { +public struct ScenePadding : Equatable { public static let minimum = ScenePadding() } @@ -86,7 +86,7 @@ extension View { } } -public enum ScenePhase : Int, Comparable, Hashable, Sendable { +public enum ScenePhase : Int, Comparable, Hashable { case background case inactive case active diff --git a/Sources/SkipUI/SkipUI/App/Window.swift b/Sources/SkipUI/SkipUI/App/Window.swift index 9caed08..7055f3f 100644 --- a/Sources/SkipUI/SkipUI/App/Window.swift +++ b/Sources/SkipUI/SkipUI/App/Window.swift @@ -121,7 +121,7 @@ public struct WindowGroup : Scene { // } } -public enum WindowResizability : Sendable { +public enum WindowResizability { case automatic case contentSize case contentMinSize diff --git a/Sources/SkipUI/SkipUI/Color/Color.swift b/Sources/SkipUI/SkipUI/Color/Color.swift index aa26d34..e3f45c1 100644 --- a/Sources/SkipUI/SkipUI/Color/Color.swift +++ b/Sources/SkipUI/SkipUI/Color/Color.swift @@ -74,7 +74,7 @@ public struct Color: ShapeStyle, Hashable { // MARK: - - public enum RGBColorSpace : Hashable, Sendable { + public enum RGBColorSpace : Hashable { case sRGB case sRGBLinear case displayP3 @@ -607,6 +607,11 @@ private struct ColorSet : Decodable { let alpha: String? var color: Color { + // Note that colors might be in the form of "0xAB" hex or non-decimal "255" numbers, + // corresponding to the "Input Method" menu in the Xcode colorset asset. + // These seem to be no metadata indicating the input method, other than looking at + // the value and seeing whether it starts with "0x" (hex) or contains a dot (float) + // See: https://github.com/skiptools/skip-ui/issues/146 let redValue = Double(red ?? "") ?? 0.0 let greenValue = Double(green ?? "") ?? 0.0 let blueValue = Double(blue ?? "") ?? 0.0 diff --git a/Sources/SkipUI/SkipUI/Color/ColorRenderingMode.swift b/Sources/SkipUI/SkipUI/Color/ColorRenderingMode.swift index 186cd2b..37c507e 100644 --- a/Sources/SkipUI/SkipUI/Color/ColorRenderingMode.swift +++ b/Sources/SkipUI/SkipUI/Color/ColorRenderingMode.swift @@ -2,7 +2,7 @@ // SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception #if !SKIP_BRIDGE -public enum ColorRenderingMode : Hashable, Sendable { +public enum ColorRenderingMode : Hashable { case nonLinear case linear case extendedLinear diff --git a/Sources/SkipUI/SkipUI/Color/ColorScheme.swift b/Sources/SkipUI/SkipUI/Color/ColorScheme.swift index 7e8b525..937d5e3 100644 --- a/Sources/SkipUI/SkipUI/Color/ColorScheme.swift +++ b/Sources/SkipUI/SkipUI/Color/ColorScheme.swift @@ -12,7 +12,7 @@ import androidx.compose.ui.graphics.luminance import androidx.compose.ui.platform.LocalContext #endif -public enum ColorScheme : Int, CaseIterable, Hashable, Sendable { +public enum ColorScheme : Int, CaseIterable, Hashable { case light = 0 // For bridging case dark = 1 // For bridging diff --git a/Sources/SkipUI/SkipUI/Commands/DismissBehavior.swift b/Sources/SkipUI/SkipUI/Commands/DismissBehavior.swift index 2e2aa14..de096c3 100644 --- a/Sources/SkipUI/SkipUI/Commands/DismissBehavior.swift +++ b/Sources/SkipUI/SkipUI/Commands/DismissBehavior.swift @@ -2,7 +2,7 @@ // SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception #if !SKIP_BRIDGE -public enum DismissBehavior : Sendable { +public enum DismissBehavior { case interactive case destructive } diff --git a/Sources/SkipUI/SkipUI/Commands/EditActions.swift b/Sources/SkipUI/SkipUI/Commands/EditActions.swift index e644163..8b2fbf3 100644 --- a/Sources/SkipUI/SkipUI/Commands/EditActions.swift +++ b/Sources/SkipUI/SkipUI/Commands/EditActions.swift @@ -3,7 +3,7 @@ #if !SKIP_BRIDGE import Foundation -public struct EditActions /* */ : OptionSet, Sendable { +public struct EditActions /* */ : OptionSet { public let rawValue: Int public init(rawValue: Int) { diff --git a/Sources/SkipUI/SkipUI/Commands/EditMode.swift b/Sources/SkipUI/SkipUI/Commands/EditMode.swift index 8a0505c..aad7ecd 100644 --- a/Sources/SkipUI/SkipUI/Commands/EditMode.swift +++ b/Sources/SkipUI/SkipUI/Commands/EditMode.swift @@ -2,7 +2,7 @@ // SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception #if !SKIP_BRIDGE -public enum EditMode : Hashable, Sendable { +public enum EditMode : Hashable { case inactive case transient case active diff --git a/Sources/SkipUI/SkipUI/Commands/Menu.swift b/Sources/SkipUI/SkipUI/Commands/Menu.swift index c4e7845..525017f 100644 --- a/Sources/SkipUI/SkipUI/Commands/Menu.swift +++ b/Sources/SkipUI/SkipUI/Commands/Menu.swift @@ -221,7 +221,7 @@ public struct MenuActionDismissBehavior: RawRepresentable, Equatable { public static let disabled = MenuActionDismissBehavior(rawValue: 1) } -public struct MenuOrder: RawRepresentable, Equatable, Hashable, Sendable { +public struct MenuOrder: RawRepresentable, Equatable, Hashable { public let rawValue: Int public init(rawValue: Int) { diff --git a/Sources/SkipUI/SkipUI/Commands/Search.swift b/Sources/SkipUI/SkipUI/Commands/Search.swift index c528a80..9dc11bf 100644 --- a/Sources/SkipUI/SkipUI/Commands/Search.swift +++ b/Sources/SkipUI/SkipUI/Commands/Search.swift @@ -69,7 +69,7 @@ extension View { } } -public struct SearchFieldPlacement : RawRepresentable, Sendable { +public struct SearchFieldPlacement : RawRepresentable { public let rawValue: Int public init(rawValue: Int) { @@ -92,7 +92,7 @@ public struct SearchFieldPlacement : RawRepresentable, Sendable { return SearchFieldPlacement(rawValue: 4) } - public enum NavigationBarDrawerDisplayMode : Sendable { + public enum NavigationBarDrawerDisplayMode { case automatic case always } diff --git a/Sources/SkipUI/SkipUI/Commands/SubmitLabel.swift b/Sources/SkipUI/SkipUI/Commands/SubmitLabel.swift index 68dc3d6..923d14c 100644 --- a/Sources/SkipUI/SkipUI/Commands/SubmitLabel.swift +++ b/Sources/SkipUI/SkipUI/Commands/SubmitLabel.swift @@ -5,7 +5,7 @@ import androidx.compose.ui.text.input.ImeAction #endif -public enum SubmitLabel : Sendable { +public enum SubmitLabel { case done case go case send diff --git a/Sources/SkipUI/SkipUI/Commands/SubmitTriggers.swift b/Sources/SkipUI/SkipUI/Commands/SubmitTriggers.swift index 63fcb3d..49dfe64 100644 --- a/Sources/SkipUI/SkipUI/Commands/SubmitTriggers.swift +++ b/Sources/SkipUI/SkipUI/Commands/SubmitTriggers.swift @@ -2,7 +2,7 @@ // SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception #if !SKIP_BRIDGE -public struct SubmitTriggers : OptionSet, Sendable { +public struct SubmitTriggers : OptionSet { public let rawValue: Int public init(rawValue: Int) { diff --git a/Sources/SkipUI/SkipUI/Commands/Toolbar.swift b/Sources/SkipUI/SkipUI/Commands/Toolbar.swift index 64016be..1c341ac 100644 --- a/Sources/SkipUI/SkipUI/Commands/Toolbar.swift +++ b/Sources/SkipUI/SkipUI/Commands/Toolbar.swift @@ -106,7 +106,7 @@ public struct ToolbarTitleMenu : CustomizableToolbarContent, View { #endif } -public enum ToolbarCustomizationBehavior : Sendable { +public enum ToolbarCustomizationBehavior { case `default` case reorderable case disabled @@ -137,7 +137,7 @@ public enum ToolbarPlacement: Equatable { case tabBar } -public enum ToolbarRole : Sendable { +public enum ToolbarRole { case automatic case navigationStack case browser @@ -151,7 +151,7 @@ public enum ToolbarTitleDisplayMode { case inline } -public struct ToolbarCustomizationOptions : OptionSet, Sendable { +public struct ToolbarCustomizationOptions : OptionSet { public let rawValue: Int public init(rawValue: Int) { diff --git a/Sources/SkipUI/SkipUI/Components/Image.swift b/Sources/SkipUI/SkipUI/Components/Image.swift index 32a49c3..fb61201 100644 --- a/Sources/SkipUI/SkipUI/Components/Image.swift +++ b/Sources/SkipUI/SkipUI/Components/Image.swift @@ -767,7 +767,7 @@ public struct Image : View, Equatable { fatalError() } - public enum Interpolation : Hashable, Sendable { + public enum Interpolation : Hashable { case none case low case medium @@ -782,13 +782,13 @@ public struct Image : View, Equatable { return self } - public enum DynamicRange : Hashable, Sendable { + public enum DynamicRange : Hashable { case standard case constrainedHigh case high } - public enum TemplateRenderingMode : Hashable, Sendable { + public enum TemplateRenderingMode : Hashable { case template case original } @@ -798,7 +798,7 @@ public struct Image : View, Equatable { return self } - public enum Orientation : UInt8, CaseIterable, Hashable, Sendable { + public enum Orientation : UInt8, CaseIterable, Hashable { case up case upMirrored case down @@ -809,7 +809,7 @@ public struct Image : View, Equatable { case rightMirrored } - public enum Scale : Hashable, Sendable { + public enum Scale : Hashable { case small case medium case large diff --git a/Sources/SkipUI/SkipUI/Containers/Form.swift b/Sources/SkipUI/SkipUI/Containers/Form.swift index d138d78..7eab697 100644 --- a/Sources/SkipUI/SkipUI/Containers/Form.swift +++ b/Sources/SkipUI/SkipUI/Containers/Form.swift @@ -5,15 +5,21 @@ import androidx.compose.runtime.Composable #endif +// SKIP @bridge public struct Form : View { - #if SKIP // It appears that on iOS, List and Form render the same let list: List public init(@ViewBuilder content: () -> any View) { - list = List(content: content) + self.list = List(content: content) + } + + // SKIP @bridge + public init(bridgedContent: any View) { + self.list = List(bridgedContent: bridgedContent) } + #if SKIP @Composable public override func ComposeContent(context: ComposeContext) { let _ = list.Compose(context: context) } diff --git a/Sources/SkipUI/SkipUI/Containers/Grid.swift b/Sources/SkipUI/SkipUI/Containers/Grid.swift index ce4656d..255c434 100644 --- a/Sources/SkipUI/SkipUI/Containers/Grid.swift +++ b/Sources/SkipUI/SkipUI/Containers/Grid.swift @@ -8,8 +8,8 @@ import androidx.compose.ui.unit.dp import struct CoreGraphics.CGFloat #endif -public struct GridItem : Sendable { - public enum Size : Sendable { +public struct GridItem { + public enum Size { case fixed(CGFloat) case flexible(minimum: CGFloat = 10.0, maximum: CGFloat = .infinity) case adaptive(minimum: CGFloat, maximum: CGFloat = .infinity) diff --git a/Sources/SkipUI/SkipUI/Containers/List.swift b/Sources/SkipUI/SkipUI/Containers/List.swift index 6363575..f7a54a7 100644 --- a/Sources/SkipUI/SkipUI/Containers/List.swift +++ b/Sources/SkipUI/SkipUI/Containers/List.swift @@ -732,39 +732,40 @@ public struct ListStyle: RawRepresentable, Equatable { self.rawValue = rawValue } - public static let automatic = ListStyle(rawValue: 0) + public static let automatic = ListStyle(rawValue: 0) // For bridging @available(*, unavailable) - public static let sidebar = ListStyle(rawValue: 1) + public static let sidebar = ListStyle(rawValue: 1) // For bridging @available(*, unavailable) - public static let insetGrouped = ListStyle(rawValue: 2) + public static let insetGrouped = ListStyle(rawValue: 2) // For bridging @available(*, unavailable) - public static let grouped = ListStyle(rawValue: 3) + public static let grouped = ListStyle(rawValue: 3) // For bridging @available(*, unavailable) - public static let inset = ListStyle(rawValue: 4) + public static let inset = ListStyle(rawValue: 4) // For bridging - public static let plain = ListStyle(rawValue: 5) + public static let plain = ListStyle(rawValue: 5) // For bridging } -public enum ListItemTint : Sendable { +public enum ListItemTint { case fixed(Color) case preferred(Color) case monochrome } -public enum ListSectionSpacing : Sendable { +public enum ListSectionSpacing { case `default` case compact case custom(CGFloat) } extension View { - public func listRowBackground(_ view: Any?) -> some View { + // SKIP @bridge + public func listRowBackground(_ view: (any View)?) -> any View { #if SKIP - return ListItemModifierView(view: self, background: view as! View?) + return ListItemModifierView(view: self, background: view) #else return self #endif @@ -778,6 +779,11 @@ extension View { #endif } + // SKIP @bridge + public func listRowSeparator(bridgedVisibility: Int, bridgedEdges: Int) -> any View { + return listRowSeparator(Visibility(rawValue: bridgedVisibility) ?? .automatic, edges: VerticalEdge.Set(rawValue: bridgedEdges)) + } + @available(*, unavailable) public func listRowSeparatorTint(_ color: Color?, edges: VerticalEdge.Set = .all) -> some View { return self @@ -801,7 +807,13 @@ extension View { #endif } - public func listItemTint(_ tint: Color?) -> some View { + // SKIP @bridge + public func listStyle(bridgedStyle: Int) -> any View { + return listStyle(ListStyle(rawValue: bridgedStyle)) + } + + // SKIP @bridge + public func listItemTint(_ tint: Color?) -> any View { #if SKIP return environment(\._listItemTint, tint) #else diff --git a/Sources/SkipUI/SkipUI/Containers/Navigation.swift b/Sources/SkipUI/SkipUI/Containers/Navigation.swift index 1870c6c..5ea026e 100644 --- a/Sources/SkipUI/SkipUI/Containers/Navigation.swift +++ b/Sources/SkipUI/SkipUI/Containers/Navigation.swift @@ -91,30 +91,39 @@ public struct NavigationStack : View { let root: ComposeBuilder let path: Binding<[Any]>? let navigationPath: Binding? + let destinationValueKey: ((Any) -> String)? public init(@ViewBuilder root: () -> any View) { self.root = ComposeBuilder.from(root) self.path = nil self.navigationPath = nil + self.destinationValueKey = nil } public init(path: Binding, @ViewBuilder root: () -> any View) { self.root = ComposeBuilder.from(root) self.path = nil self.navigationPath = path + self.destinationValueKey = nil } public init(path: Any, @ViewBuilder root: () -> any View) { self.root = ComposeBuilder.from(root) self.path = path as! Binding<[Any]>? self.navigationPath = nil + self.destinationValueKey = nil } // SKIP @bridge - public init(bridgedRoot: any View) { + public init(getData: (() -> [Any])?, setData: (([Any]) -> Void)?, bridgedRoot: any View, destinationValueKey: @escaping (Any) -> String) { self.root = ComposeBuilder.from { bridgedRoot } - self.path = nil self.navigationPath = nil + if let getData, let setData { + self.path = Binding(get: getData, set: setData) + } else { + self.path = nil + } + self.destinationValueKey = destinationValueKey } #if SKIP @@ -127,7 +136,7 @@ public struct NavigationStack : View { let destinationsCollector = PreferenceCollector(key: NavigationDestinationsPreferenceKey.self, state: destinations, isErasable: false) let reducedDestinations = destinations.value.reduced let navController = rememberNavController() - let navigator = rememberSaveable(stateSaver: context.stateSaver as! Saver) { mutableStateOf(Navigator(navController: navController, destinations: reducedDestinations)) } + let navigator = rememberSaveable(stateSaver: context.stateSaver as! Saver) { mutableStateOf(Navigator(navController: navController, destinations: reducedDestinations, destinationValueKey: destinationValueKey)) } navigator.value.didCompose(navController: navController, destinations: reducedDestinations, path: path, navigationPath: navigationPath, keyboardController: LocalSoftwareKeyboardController.current) // SKIP INSERT: val providedNavigator = LocalNavigator provides navigator.value @@ -552,7 +561,7 @@ public struct NavigationStack : View { let targetValue: Any } -typealias NavigationDestinations = Dictionary +typealias NavigationDestinations = Dictionary struct NavigationDestination { let destination: (Any) -> any View // No way to compare closures. Assume equal so we don't think our destinations are constantly updating @@ -581,7 +590,8 @@ struct NavigationDestination { private var navController: NavHostController private var keyboardController: SoftwareKeyboardController? private var destinations: NavigationDestinations - private var destinationIndexes: [Any.Type: Int] = [:] + private var destinationIndexes: [AnyHashable: Int] = [:] + private var destinationValueKey: ((Any) -> String)? // We reserve the last destination index for static destinations. Every time we navigate to a static destination view, we increment the // destination value to give it a unique navigation path of e.g. 99/0, 99/1, 99/2, etc @@ -610,9 +620,10 @@ struct NavigationDestination { } } - init(navController: NavHostController, destinations: NavigationDestinations) { + init(navController: NavHostController, destinations: NavigationDestinations, destinationValueKey: ((Any) -> String)?) { self.navController = navController self.destinations = destinations + self.destinationValueKey = destinationValueKey updateDestinationIndexes() } @@ -640,8 +651,18 @@ struct NavigationDestination { } else if let navigationPath { navigationPath.wrappedValue.append(targetValue) } else { - let _ = navigate(to: targetValue, type: type(of: targetValue)) + navigate(toKeyed: targetValue) + } + } + + private func navigate(toKeyed targetValue: Any) { + let key: AnyHashable + if let destinationValueKey { + key = destinationValueKey(targetValue) + } else { + key = type(of: targetValue) } + let _ = navigate(toKeyed: targetValue, key: key) } /// Navigate to a destination view. @@ -797,24 +818,26 @@ struct NavigationDestination { } // Navigate to any new path values for i in pathIndex.. Bool { - guard let type else { + private func navigate(toKeyed targetValue: Any, key: AnyHashable?) -> Bool { + guard let key else { return false } - guard let destination = destinations[type] else { - for supertype in type.superclasses { - if navigate(to: targetValue, type: supertype as? Any.Type) { - return true + guard let destination = destinations[key] else { + if let type = key as? Any.Type { + for supertype in type.superclasses { + if navigate(toKeyed: targetValue, key: supertype) { + return true + } } } return false } - let route = route(for: type, value: targetValue) + let route = route(for: key, value: targetValue) navigate(route: route, destination: destination.destination, targetValue: targetValue) return true } @@ -837,9 +860,9 @@ struct NavigationDestination { return entry.id } - private func route(for targetType: Any.Type, value: Any) -> String { - guard let index = destinationIndexes[targetType] else { - return String(describing: targetType) + "?" + private func route(for key: AnyHashable, value: Any) -> String { + guard let index = destinationIndexes[key] else { + return String(describing: key) + "?" } // Escape '/' because it is meaningful in navigation routes var valueString = composeBundleString(for: value) @@ -848,9 +871,9 @@ struct NavigationDestination { } private func updateDestinationIndexes() { - for type in destinations.keys { - if destinationIndexes[type] == nil { - destinationIndexes[type] = destinationIndexes.count + for key in destinations.keys { + if destinationIndexes[key] == nil { + destinationIndexes[key] = destinationIndexes.count } } } @@ -871,16 +894,17 @@ public struct NavigationSplitViewStyle: RawRepresentable, Equatable { public static var prominentDetail = NavigationSplitViewStyle(rawValue: 2) } -public struct NavigationBarItem : Hashable, Sendable { - public enum TitleDisplayMode : Equatable, Sendable { - case automatic - case inline - case large +public struct NavigationBarItem : Hashable { + public enum TitleDisplayMode : Int, Equatable { + case automatic = 0 // For bridging + case inline = 1 // For bridging + case large = 2 // For bridging } } extension View { - public func navigationBarBackButtonHidden(_ hidesBackButton: Bool = true) -> some View { + // SKIP @bridge + public func navigationBarBackButtonHidden(_ hidesBackButton: Bool = true) -> any View { #if SKIP return preference(key: ToolbarPreferenceKey.self, value: ToolbarPreferences(backButtonHidden: hidesBackButton)) #else @@ -888,7 +912,7 @@ extension View { #endif } - public func navigationBarTitleDisplayMode(_ displayMode: NavigationBarItem.TitleDisplayMode) -> some View { + public func navigationBarTitleDisplayMode(_ displayMode: NavigationBarItem.TitleDisplayMode) -> any View { #if SKIP let toolbarTitleDisplayMode: ToolbarTitleDisplayMode switch displayMode { @@ -905,7 +929,12 @@ extension View { #endif } - public func navigationDestination(for data: D.Type, @ViewBuilder destination: @escaping (D) -> any View) -> some View where D: Any { + // SKIP @bridge + public func navigationBarTitleDisplayMode(bridgedDisplayMode: Int) -> any View { + return navigationBarTitleDisplayMode(NavigationBarItem.TitleDisplayMode(rawValue: bridgedDisplayMode) ?? NavigationBarItem.TitleDisplayMode.automatic) + } + + public func navigationDestination(for data: D.Type, @ViewBuilder destination: @escaping (D) -> any View) -> any View where D: Any { #if SKIP let destinations: NavigationDestinations = [data: NavigationDestination(destination: { destination($0 as! D) })] return preference(key: NavigationDestinationsPreferenceKey.self, value: destinations) @@ -914,7 +943,17 @@ extension View { #endif } - public func navigationDestination(isPresented: Binding, @ViewBuilder destination: () -> any View) -> some View { + // SKIP @bridge + public func navigationDestination(destinationKey: String, bridgedDestination: @escaping (Any) -> any View) -> any View { + #if SKIP + let destinations: NavigationDestinations = [destinationKey: NavigationDestination(destination: { bridgedDestination($0) })] + return preference(key: NavigationDestinationsPreferenceKey.self, value: destinations) + #else + return self + #endif + } + + public func navigationDestination(isPresented: Binding, @ViewBuilder destination: () -> any View) -> any View { #if SKIP let destinationView = ComposeBuilder.from(destination) return ComposeModifierView(targetView: self) { context in @@ -939,6 +978,11 @@ extension View { #endif } + // SKIP @bridge + public func navigationDestination(getIsPresented: @escaping () -> Bool, setIsPresented: @escaping (Bool) -> Void, bridgedDestination: any View) -> any View { + return navigationDestination(isPresented: Binding(get: getIsPresented, set: setIsPresented), destination: { bridgedDestination }) + } + @available(*, unavailable) public func navigationDestination(item: Binding, @ViewBuilder destination: @escaping (D) -> any View) -> some View where D : Hashable { return self @@ -964,7 +1008,8 @@ extension View { return self } - public func navigationTitle(_ title: Text) -> some View { + // SKIP @bridge + public func navigationTitle(_ title: Text) -> any View { #if SKIP return preference(key: NavigationTitlePreferenceKey.self, value: title) #else @@ -1111,9 +1156,9 @@ public struct NavigationLink : View, ListItemAdapting { } // SKIP @bridge - public init(bridgedDestination: any View, bridgedLabel: any View) { - self.value = nil - self.destination = ComposeBuilder.from { bridgedDestination } + public init(bridgedDestination: (any View)?, value: Any?, bridgedLabel: any View) { + self.destination = bridgedDestination == nil ? nil : ComposeBuilder.from { bridgedDestination! } + self.value = value self.label = ComposeBuilder.from { bridgedLabel } } diff --git a/Sources/SkipUI/SkipUI/Containers/ScrollView.swift b/Sources/SkipUI/SkipUI/Containers/ScrollView.swift index fe8a700..5096a19 100644 --- a/Sources/SkipUI/SkipUI/Containers/ScrollView.swift +++ b/Sources/SkipUI/SkipUI/Containers/ScrollView.swift @@ -205,13 +205,13 @@ struct BuiltinScrollAxisSetPreferenceKey: PreferenceKey { } #endif -public enum ScrollBounceBehavior : Sendable { +public enum ScrollBounceBehavior { case automatic case always case basedOnSize } -public enum ScrollDismissesKeyboardMode : Sendable { +public enum ScrollDismissesKeyboardMode { case automatic case immediately case interactively @@ -235,7 +235,7 @@ public struct ScrollTarget { } } -public struct PinnedScrollableViews : OptionSet, Sendable { +public struct PinnedScrollableViews : OptionSet { public let rawValue: Int public init(rawValue: Int) { diff --git a/Sources/SkipUI/SkipUI/Containers/TabView.swift b/Sources/SkipUI/SkipUI/Containers/TabView.swift index 9ea668c..6710507 100644 --- a/Sources/SkipUI/SkipUI/Containers/TabView.swift +++ b/Sources/SkipUI/SkipUI/Containers/TabView.swift @@ -558,6 +558,8 @@ final class TabIndexComposer: RenderingComposer { public protocol TabViewStyle: Equatable {} public struct DefaultTabViewStyle : TabViewStyle { + static let identifier = 0 // For bridging + public init() {} } @@ -566,6 +568,8 @@ extension TabViewStyle where Self == DefaultTabViewStyle { } public struct TabBarOnlyTabViewStyle: TabViewStyle { + static let identifier = 1 // For bridging + public init() {} } @@ -574,6 +578,8 @@ extension TabViewStyle where Self == TabBarOnlyTabViewStyle { } public struct PageTabViewStyle: TabViewStyle { + static let identifier = 2 // For bridging + public let indexDisplayMode: PageTabViewStyle.IndexDisplayMode public struct IndexDisplayMode: RawRepresentable, Equatable { @@ -583,9 +589,9 @@ public struct PageTabViewStyle: TabViewStyle { self.rawValue = rawValue } - public static let automatic = IndexDisplayMode(rawValue: 0) - public static let always = IndexDisplayMode(rawValue: 1) - public static let never = IndexDisplayMode(rawValue: 2) + public static let automatic = IndexDisplayMode(rawValue: 0) // For bridging + public static let always = IndexDisplayMode(rawValue: 1) // For bridging + public static let never = IndexDisplayMode(rawValue: 2) // For bridging } public init(indexDisplayMode: PageTabViewStyle.IndexDisplayMode = .automatic) { @@ -604,7 +610,7 @@ extension TabViewStyle where Self == PageTabViewStyle { // MARK: View extensions extension View { - public func tabItem(@ViewBuilder _ label: () -> any View) -> any View { + public func tabItem(@ViewBuilder _ label: () -> any View) -> some View { #if SKIP return TabItemModifierView(view: self, label: label) #else @@ -625,6 +631,21 @@ extension View { #endif } + // SKIP @bridge + public func tabViewStyle(bridgedStyle: Int, bridgedDisplayMode: Int? = nil) -> any View { + let style: any TabViewStyle + switch bridgedStyle { + case TabBarOnlyTabViewStyle.identifier: + style = TabBarOnlyTabViewStyle() + case PageTabViewStyle.identifier: + let indexDisplayMode: PageTabViewStyle.IndexDisplayMode = (bridgedDisplayMode == nil ? nil : PageTabViewStyle.IndexDisplayMode(rawValue: bridgedDisplayMode!)) ?? .automatic + style = PageTabViewStyle(indexDisplayMode: indexDisplayMode) + default: + style = DefaultTabViewStyle() + } + return tabViewStyle(style) + } + #if SKIP public func material3NavigationBar(_ options: @Composable (Material3NavigationBarOptions) -> Material3NavigationBarOptions) -> View { return environment(\._material3NavigationBar, options) diff --git a/Sources/SkipUI/SkipUI/Controls/Button.swift b/Sources/SkipUI/SkipUI/Controls/Button.swift index 3f598ab..91fb9e7 100644 --- a/Sources/SkipUI/SkipUI/Controls/Button.swift +++ b/Sources/SkipUI/SkipUI/Controls/Button.swift @@ -201,13 +201,13 @@ public struct ButtonStyle: RawRepresentable, Equatable { public static let borderedProminent = ButtonStyle(rawValue: 4) } -public enum ButtonRepeatBehavior : Hashable, Sendable { +public enum ButtonRepeatBehavior : Hashable { case automatic case enabled case disabled } -public enum ButtonRole : Equatable, Sendable { +public enum ButtonRole : Equatable { case destructive case cancel } diff --git a/Sources/SkipUI/SkipUI/Controls/DatePicker.swift b/Sources/SkipUI/SkipUI/Controls/DatePicker.swift index 6647b06..0164f3a 100644 --- a/Sources/SkipUI/SkipUI/Controls/DatePicker.swift +++ b/Sources/SkipUI/SkipUI/Controls/DatePicker.swift @@ -219,7 +219,7 @@ public struct DatePicker : View { } #endif -public struct DatePickerComponents : OptionSet, Sendable { +public struct DatePickerComponents : OptionSet { public let rawValue: Int public init(rawValue: Int) { diff --git a/Sources/SkipUI/SkipUI/Environment/PreferenceKey.swift b/Sources/SkipUI/SkipUI/Environment/PreferenceKey.swift index 5d0f9c4..7fbdc91 100644 --- a/Sources/SkipUI/SkipUI/Environment/PreferenceKey.swift +++ b/Sources/SkipUI/SkipUI/Environment/PreferenceKey.swift @@ -156,7 +156,7 @@ struct PreferenceNode: Equatable { #endif extension View { - public func preference(key: Any.Type, value: Any) -> some View { + public func preference(key: Any.Type, value: Any) -> any View { #if SKIP return ComposeModifierView(targetView: self) { PreferenceValues.shared.contribute(context: $0, key: key, value: value) diff --git a/Sources/SkipUI/SkipUI/Graphics/BlendMode.swift b/Sources/SkipUI/SkipUI/Graphics/BlendMode.swift index 0ca9b83..9a2d233 100644 --- a/Sources/SkipUI/SkipUI/Graphics/BlendMode.swift +++ b/Sources/SkipUI/SkipUI/Graphics/BlendMode.swift @@ -2,7 +2,7 @@ // SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception #if !SKIP_BRIDGE -public enum BlendMode : Hashable, Sendable { +public enum BlendMode : Hashable { case normal case multiply case screen diff --git a/Sources/SkipUI/SkipUI/Graphics/Path.swift b/Sources/SkipUI/SkipUI/Graphics/Path.swift index 1199f95..7498931 100644 --- a/Sources/SkipUI/SkipUI/Graphics/Path.swift +++ b/Sources/SkipUI/SkipUI/Graphics/Path.swift @@ -108,7 +108,7 @@ public struct Path : Shape, Equatable { return boundingRect.contains(p) } - public enum Element : Equatable, Sendable { + public enum Element : Equatable { case move(to: CGPoint) case line(to: CGPoint) case quadCurve(to: CGPoint, control: CGPoint) diff --git a/Sources/SkipUI/SkipUI/Graphics/Shape.swift b/Sources/SkipUI/SkipUI/Graphics/Shape.swift index fad09d1..640294a 100644 --- a/Sources/SkipUI/SkipUI/Graphics/Shape.swift +++ b/Sources/SkipUI/SkipUI/Graphics/Shape.swift @@ -25,7 +25,7 @@ import struct CoreGraphics.CGRect import struct CoreGraphics.CGSize #endif -public protocol Shape: View, Sendable { +public protocol Shape: View { func path(in rect: CGRect) -> Path var layoutDirectionBehavior: LayoutDirectionBehavior { get } func sizeThatFits(_ proposal: ProposedViewSize) -> CGSize @@ -452,7 +452,7 @@ public final class Ellipse : Shape { #endif } -public final class AnyShape : Shape, Sendable { +public final class AnyShape : Shape { private let shape: any Shape public init(_ shape: any Shape) { @@ -483,7 +483,7 @@ public final class AnyShape : Shape, Sendable { #endif } -public struct RectangleCornerRadii : Equatable, Sendable /*, Animatable */ { +public struct RectangleCornerRadii : Equatable /*, Animatable */ { public let topLeading: CGFloat public let bottomLeading: CGFloat public let bottomTrailing: CGFloat diff --git a/Sources/SkipUI/SkipUI/Graphics/ShapeStyle.swift b/Sources/SkipUI/SkipUI/Graphics/ShapeStyle.swift index 360746e..003af84 100644 --- a/Sources/SkipUI/SkipUI/Graphics/ShapeStyle.swift +++ b/Sources/SkipUI/SkipUI/Graphics/ShapeStyle.swift @@ -164,7 +164,7 @@ extension ShapeStyle where Self == TintShapeStyle { } } -public struct FillStyle : Equatable, Sendable { +public struct FillStyle : Equatable { public var isEOFilled: Bool public var isAntialiased: Bool @@ -174,7 +174,7 @@ public struct FillStyle : Equatable, Sendable { } } -public enum RoundedCornerStyle : Hashable, Sendable { +public enum RoundedCornerStyle : Hashable { case circular case continuous } diff --git a/Sources/SkipUI/SkipUI/Graphics/StrokeStyle.swift b/Sources/SkipUI/SkipUI/Graphics/StrokeStyle.swift index 69fead0..4b145cd 100644 --- a/Sources/SkipUI/SkipUI/Graphics/StrokeStyle.swift +++ b/Sources/SkipUI/SkipUI/Graphics/StrokeStyle.swift @@ -11,11 +11,11 @@ import androidx.compose.ui.graphics.drawscope.Stroke import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.unit.dp -public enum CGLineCap : Int, Sendable { +public enum CGLineCap : Int { case butt, round, square } -public enum CGLineJoin : Int, Sendable { +public enum CGLineJoin : Int { case miter, round, bevel } #elseif canImport(CoreGraphics) @@ -24,7 +24,7 @@ import enum CoreGraphics.CGLineCap import enum CoreGraphics.CGLineJoin #endif -public struct StrokeStyle : Equatable, Sendable { +public struct StrokeStyle : Equatable { public var lineWidth: CGFloat public var lineCap: CGLineCap public var lineJoin: CGLineJoin diff --git a/Sources/SkipUI/SkipUI/Graphics/Symbol.swift b/Sources/SkipUI/SkipUI/Graphics/Symbol.swift index b2746eb..3e8d690 100644 --- a/Sources/SkipUI/SkipUI/Graphics/Symbol.swift +++ b/Sources/SkipUI/SkipUI/Graphics/Symbol.swift @@ -35,7 +35,7 @@ public enum SymbolRenderingMode { case monochrome, multicolor, hierarchical, palette } -public struct SymbolVariants : Hashable, Sendable { +public struct SymbolVariants : Hashable { public static let none = SymbolVariants() public static let circle = SymbolVariants() public static let square = SymbolVariants() diff --git a/Sources/SkipUI/SkipUI/Layout/Alignment.swift b/Sources/SkipUI/SkipUI/Layout/Alignment.swift index ab2f471..bbaa63e 100644 --- a/Sources/SkipUI/SkipUI/Layout/Alignment.swift +++ b/Sources/SkipUI/SkipUI/Layout/Alignment.swift @@ -3,7 +3,7 @@ #if !SKIP_BRIDGE // NOTE: Keep in sync with SkipFuseUI.Alignment -public struct Alignment : Equatable, Sendable { +public struct Alignment : Equatable { public var horizontal: HorizontalAlignment public var vertical: VerticalAlignment diff --git a/Sources/SkipUI/SkipUI/Layout/Angle.swift b/Sources/SkipUI/SkipUI/Layout/Angle.swift index eb1caa7..c8d510c 100644 --- a/Sources/SkipUI/SkipUI/Layout/Angle.swift +++ b/Sources/SkipUI/SkipUI/Layout/Angle.swift @@ -2,7 +2,7 @@ // SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception #if !SKIP_BRIDGE -public struct Angle: Hashable, Sendable { +public struct Angle: Hashable { public static var zero = Angle() public var radians: Double diff --git a/Sources/SkipUI/SkipUI/Layout/Axis.swift b/Sources/SkipUI/SkipUI/Layout/Axis.swift index a4bca0b..a51d5b8 100644 --- a/Sources/SkipUI/SkipUI/Layout/Axis.swift +++ b/Sources/SkipUI/SkipUI/Layout/Axis.swift @@ -2,11 +2,11 @@ // SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception #if !SKIP_BRIDGE -public enum Axis : Int, Hashable, CaseIterable, Sendable { +public enum Axis : Int, Hashable, CaseIterable { case horizontal = 1 case vertical = 2 - public struct Set : OptionSet, Hashable, Sendable { + public struct Set : OptionSet, Hashable { public let rawValue: Int public init(rawValue: Int) { diff --git a/Sources/SkipUI/SkipUI/Layout/Edge.swift b/Sources/SkipUI/SkipUI/Layout/Edge.swift index 05163fd..8bbc7ba 100644 --- a/Sources/SkipUI/SkipUI/Layout/Edge.swift +++ b/Sources/SkipUI/SkipUI/Layout/Edge.swift @@ -2,13 +2,13 @@ // SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception #if !SKIP_BRIDGE -public enum Edge : Int, Hashable, CaseIterable, Sendable { - case top = 1 - case leading = 2 - case bottom = 4 - case trailing = 8 +public enum Edge : Int, Hashable, CaseIterable { + case top = 1 // For bridging + case leading = 2 // For bridging + case bottom = 4 // For bridging + case trailing = 8 // For bridging - public struct Set : OptionSet, Equatable, Sendable { + public struct Set : OptionSet, Equatable { public let rawValue: Int public init(rawValue: Int) { diff --git a/Sources/SkipUI/SkipUI/Layout/EdgeInsets.swift b/Sources/SkipUI/SkipUI/Layout/EdgeInsets.swift index 83c588d..6e431d4 100644 --- a/Sources/SkipUI/SkipUI/Layout/EdgeInsets.swift +++ b/Sources/SkipUI/SkipUI/Layout/EdgeInsets.swift @@ -9,7 +9,7 @@ import androidx.compose.ui.unit.dp import struct CoreGraphics.CGFloat #endif -public struct EdgeInsets : Equatable, Sendable { +public struct EdgeInsets : Equatable { public var top: CGFloat public var leading: CGFloat public var bottom: CGFloat diff --git a/Sources/SkipUI/SkipUI/Layout/HorizontalAlignment.swift b/Sources/SkipUI/SkipUI/Layout/HorizontalAlignment.swift index 13e49e4..e9f3478 100644 --- a/Sources/SkipUI/SkipUI/Layout/HorizontalAlignment.swift +++ b/Sources/SkipUI/SkipUI/Layout/HorizontalAlignment.swift @@ -8,7 +8,7 @@ import struct CoreGraphics.CGFloat #endif // NOTE: Keep in sync with SkipFuseUI.HorizontalAlignment -public struct HorizontalAlignment : Equatable, Sendable { +public struct HorizontalAlignment : Equatable { let key: String init(key: String) { diff --git a/Sources/SkipUI/SkipUI/Layout/HorizontalEdge.swift b/Sources/SkipUI/SkipUI/Layout/HorizontalEdge.swift index 0061342..b9efc24 100644 --- a/Sources/SkipUI/SkipUI/Layout/HorizontalEdge.swift +++ b/Sources/SkipUI/SkipUI/Layout/HorizontalEdge.swift @@ -2,7 +2,7 @@ // SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception #if !SKIP_BRIDGE -public enum HorizontalEdge : Int, CaseIterable, Codable, Hashable, Sendable { +public enum HorizontalEdge : Int, CaseIterable, Codable, Hashable { case leading = 1 case trailing = 2 diff --git a/Sources/SkipUI/SkipUI/Layout/Layout.swift b/Sources/SkipUI/SkipUI/Layout/Layout.swift index dbeaeb1..da73c36 100644 --- a/Sources/SkipUI/SkipUI/Layout/Layout.swift +++ b/Sources/SkipUI/SkipUI/Layout/Layout.swift @@ -2,12 +2,12 @@ // SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception #if !SKIP_BRIDGE -public enum LayoutDirection : Hashable, CaseIterable, Sendable { +public enum LayoutDirection : Hashable, CaseIterable { case leftToRight case rightToLeft } -public enum LayoutDirectionBehavior : Hashable, Sendable { +public enum LayoutDirectionBehavior : Hashable { case fixed case mirrors(in: LayoutDirection) diff --git a/Sources/SkipUI/SkipUI/Layout/MatchedGeometryProperties.swift b/Sources/SkipUI/SkipUI/Layout/MatchedGeometryProperties.swift index 836f763..37f7315 100644 --- a/Sources/SkipUI/SkipUI/Layout/MatchedGeometryProperties.swift +++ b/Sources/SkipUI/SkipUI/Layout/MatchedGeometryProperties.swift @@ -2,7 +2,7 @@ // SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception #if !SKIP_BRIDGE -public struct MatchedGeometryProperties : OptionSet, Sendable { +public struct MatchedGeometryProperties : OptionSet { public let rawValue: Int public init(rawValue: Int) { diff --git a/Sources/SkipUI/SkipUI/Layout/Presentation.swift b/Sources/SkipUI/SkipUI/Layout/Presentation.swift index 3ee8b18..1fc53a3 100644 --- a/Sources/SkipUI/SkipUI/Layout/Presentation.swift +++ b/Sources/SkipUI/SkipUI/Layout/Presentation.swift @@ -440,7 +440,7 @@ final class DisableScrollToDismissConnection : NestedScrollConnection { } #endif -public enum PresentationAdaptation : Sendable { +public enum PresentationAdaptation { case automatic case none case popover @@ -448,7 +448,7 @@ public enum PresentationAdaptation : Sendable { case fullScreenCover } -public struct PresentationBackgroundInteraction : Sendable { +public struct PresentationBackgroundInteraction { let enabled: Bool? let upThrough: PresentationDetent? @@ -463,13 +463,13 @@ public struct PresentationBackgroundInteraction : Sendable { public static let disabled = PresentationBackgroundInteraction(enabled: false, upThrough: nil) } -public enum PresentationContentInteraction : Equatable, Sendable { +public enum PresentationContentInteraction : Equatable { case automatic case resizes case scrolls } -public enum PresentationDetent : Hashable, Sendable { +public enum PresentationDetent : Hashable { case medium case large case fraction(CGFloat) diff --git a/Sources/SkipUI/SkipUI/Layout/Unit.swift b/Sources/SkipUI/SkipUI/Layout/Unit.swift index f9ada9b..c2db401 100644 --- a/Sources/SkipUI/SkipUI/Layout/Unit.swift +++ b/Sources/SkipUI/SkipUI/Layout/Unit.swift @@ -6,7 +6,7 @@ import androidx.compose.animation.core.CubicBezierEasing import androidx.compose.animation.core.Easing #endif -public struct UnitPoint : Hashable, Sendable { +public struct UnitPoint : Hashable { public var x = 0.0 public var y = 0.0 @@ -22,7 +22,7 @@ public struct UnitPoint : Hashable, Sendable { public static let bottomTrailing = UnitPoint(x: 1.0, y: 1.0) } -public struct UnitCurve: Hashable, Sendable { +public struct UnitCurve: Hashable { private let startControlPoint: UnitPoint private let endControlPoint: UnitPoint diff --git a/Sources/SkipUI/SkipUI/Layout/VerticalAlignment.swift b/Sources/SkipUI/SkipUI/Layout/VerticalAlignment.swift index 503f08f..b5b8c41 100644 --- a/Sources/SkipUI/SkipUI/Layout/VerticalAlignment.swift +++ b/Sources/SkipUI/SkipUI/Layout/VerticalAlignment.swift @@ -8,7 +8,7 @@ import struct CoreGraphics.CGFloat #endif // NOTE: Keep in sync with SkipFuseUI.VerticalAlignment -public struct VerticalAlignment : Equatable, Sendable { +public struct VerticalAlignment : Equatable { let key: String init(key: String) { diff --git a/Sources/SkipUI/SkipUI/Layout/VerticalEdge.swift b/Sources/SkipUI/SkipUI/Layout/VerticalEdge.swift index ad6c417..bbc3721 100644 --- a/Sources/SkipUI/SkipUI/Layout/VerticalEdge.swift +++ b/Sources/SkipUI/SkipUI/Layout/VerticalEdge.swift @@ -3,10 +3,10 @@ #if !SKIP_BRIDGE public enum VerticalEdge : Int, Hashable, CaseIterable, Codable { - case top = 1 - case bottom = 2 + case top = 1 // For bridging + case bottom = 2 // For bridging - public struct Set : OptionSet, Sendable { + public struct Set : OptionSet { public let rawValue: Int public init(rawValue: Int) { diff --git a/Sources/SkipUI/SkipUI/System/Accessibility.swift b/Sources/SkipUI/SkipUI/System/Accessibility.swift index 49caee4..550a6dc 100644 --- a/Sources/SkipUI/SkipUI/System/Accessibility.swift +++ b/Sources/SkipUI/SkipUI/System/Accessibility.swift @@ -413,7 +413,7 @@ extension View { } } -public struct AccessibilityActionKind : Equatable, Sendable { +public struct AccessibilityActionKind : Equatable { public static let `default` = AccessibilityActionKind() public static let escape = AccessibilityActionKind() public static let magicTap = AccessibilityActionKind() @@ -425,7 +425,7 @@ public struct AccessibilityActionKind : Equatable, Sendable { } } -public enum AccessibilityAdjustmentDirection : Hashable, Sendable { +public enum AccessibilityAdjustmentDirection : Hashable { case increment case decrement } @@ -445,7 +445,7 @@ public struct AccessibilityCustomContentKey : Equatable { } } -public struct AccessibilityDirectTouchOptions : OptionSet, Sendable { +public struct AccessibilityDirectTouchOptions : OptionSet { public let rawValue: Int public init(rawValue: Int) { @@ -507,7 +507,7 @@ public struct AccessibilityRotorEntry: AccessibilityRotorContent where ID : } } -public struct AccessibilitySystemRotor : Sendable { +public struct AccessibilitySystemRotor { public static func links(visited: Bool) -> AccessibilitySystemRotor { return AccessibilitySystemRotor() } @@ -530,7 +530,7 @@ public struct AccessibilitySystemRotor : Sendable { public static let landmarks = AccessibilitySystemRotor() } -public struct AccessibilityTechnologies : OptionSet, Sendable { +public struct AccessibilityTechnologies : OptionSet { public let rawValue: Int public init(rawValue: Int) { @@ -541,11 +541,11 @@ public struct AccessibilityTechnologies : OptionSet, Sendable { public static let switchControl = AccessibilityTechnologies(rawValue: 2) } -public enum AccessibilityTextContentType : Sendable { +public enum AccessibilityTextContentType { case plain, console, fileSystem, messaging, narrative, sourceCode, spreadsheet, wordProcessing } -public struct AccessibilityTraits : OptionSet, Sendable { +public struct AccessibilityTraits : OptionSet { public let rawValue: Int public init(rawValue: Int) { diff --git a/Sources/SkipUI/SkipUI/System/BackgroundTask.swift b/Sources/SkipUI/SkipUI/System/BackgroundTask.swift index 1c4039c..6e6ef4f 100644 --- a/Sources/SkipUI/SkipUI/System/BackgroundTask.swift +++ b/Sources/SkipUI/SkipUI/System/BackgroundTask.swift @@ -2,7 +2,7 @@ // SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception #if !SKIP_BRIDGE -public struct BackgroundTask : Sendable { +public struct BackgroundTask { @available(*, unavailable) public static var urlSession: BackgroundTask { get { fatalError() } } @@ -10,7 +10,7 @@ public struct BackgroundTask : Sendable { public static func urlSession(_ identifier: String) -> BackgroundTask { fatalError() } @available(*, unavailable) - public static func urlSession(matching: @escaping @Sendable (String) -> Bool) -> BackgroundTask { fatalError() } + public static func urlSession(matching: @escaping (String) -> Bool) -> BackgroundTask { fatalError() } @available(*, unavailable) public static func appRefresh(_ identifier: String) -> BackgroundTask { fatalError() } diff --git a/Sources/SkipUI/SkipUI/System/BadgeProminence.swift b/Sources/SkipUI/SkipUI/System/BadgeProminence.swift index d38c663..ca537a9 100644 --- a/Sources/SkipUI/SkipUI/System/BadgeProminence.swift +++ b/Sources/SkipUI/SkipUI/System/BadgeProminence.swift @@ -2,7 +2,7 @@ // SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception #if !SKIP_BRIDGE -public enum BadgeProminence : Hashable, Sendable { +public enum BadgeProminence : Hashable { case decreased case standard case increased diff --git a/Sources/SkipUI/SkipUI/System/ContainerBackgroundPlacement.swift b/Sources/SkipUI/SkipUI/System/ContainerBackgroundPlacement.swift index 2242916..1ea3828 100644 --- a/Sources/SkipUI/SkipUI/System/ContainerBackgroundPlacement.swift +++ b/Sources/SkipUI/SkipUI/System/ContainerBackgroundPlacement.swift @@ -2,7 +2,7 @@ // SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception #if !SKIP_BRIDGE -public struct ContainerBackgroundPlacement : Sendable, Hashable { +public struct ContainerBackgroundPlacement : Hashable { } #endif diff --git a/Sources/SkipUI/SkipUI/System/ContentMode.swift b/Sources/SkipUI/SkipUI/System/ContentMode.swift index 1bb992e..8fa10cd 100644 --- a/Sources/SkipUI/SkipUI/System/ContentMode.swift +++ b/Sources/SkipUI/SkipUI/System/ContentMode.swift @@ -2,7 +2,7 @@ // SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception #if !SKIP_BRIDGE -public enum ContentMode : Hashable, CaseIterable, Sendable { +public enum ContentMode : Hashable, CaseIterable { case fit case fill } diff --git a/Sources/SkipUI/SkipUI/System/ContentShapeKinds.swift b/Sources/SkipUI/SkipUI/System/ContentShapeKinds.swift index 0828bd6..cb042ac 100644 --- a/Sources/SkipUI/SkipUI/System/ContentShapeKinds.swift +++ b/Sources/SkipUI/SkipUI/System/ContentShapeKinds.swift @@ -2,7 +2,7 @@ // SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception #if !SKIP_BRIDGE -public struct ContentShapeKinds : OptionSet, Sendable { +public struct ContentShapeKinds : OptionSet { public let rawValue: Int public init(rawValue: Int) { diff --git a/Sources/SkipUI/SkipUI/System/ControlSize.swift b/Sources/SkipUI/SkipUI/System/ControlSize.swift index 78ad3d5..d8f8361 100644 --- a/Sources/SkipUI/SkipUI/System/ControlSize.swift +++ b/Sources/SkipUI/SkipUI/System/ControlSize.swift @@ -2,7 +2,7 @@ // SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception #if !SKIP_BRIDGE -public enum ControlSize : CaseIterable, Hashable, Sendable { +public enum ControlSize : CaseIterable, Hashable { case mini case small case regular diff --git a/Sources/SkipUI/SkipUI/System/DynamicTypeSize.swift b/Sources/SkipUI/SkipUI/System/DynamicTypeSize.swift index b5b7a89..3880c14 100644 --- a/Sources/SkipUI/SkipUI/System/DynamicTypeSize.swift +++ b/Sources/SkipUI/SkipUI/System/DynamicTypeSize.swift @@ -2,7 +2,7 @@ // SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception #if !SKIP_BRIDGE -public enum DynamicTypeSize : Int, Hashable, Comparable, CaseIterable, Sendable { +public enum DynamicTypeSize : Int, Hashable, Comparable, CaseIterable { case xSmall case small case medium diff --git a/Sources/SkipUI/SkipUI/System/EventModifiers.swift b/Sources/SkipUI/SkipUI/System/EventModifiers.swift index 60a4714..9e41d35 100644 --- a/Sources/SkipUI/SkipUI/System/EventModifiers.swift +++ b/Sources/SkipUI/SkipUI/System/EventModifiers.swift @@ -2,7 +2,7 @@ // SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception #if !SKIP_BRIDGE -@frozen public struct EventModifiers : OptionSet, Hashable, Sendable { +@frozen public struct EventModifiers : OptionSet, Hashable { public let rawValue: Int public init(rawValue: Int) { diff --git a/Sources/SkipUI/SkipUI/System/Gesture.swift b/Sources/SkipUI/SkipUI/System/Gesture.swift index 650d11c..8fb5c04 100644 --- a/Sources/SkipUI/SkipUI/System/Gesture.swift +++ b/Sources/SkipUI/SkipUI/System/Gesture.swift @@ -101,7 +101,7 @@ extension Gesture { public struct DragGesture : Gesture { public typealias V = DragGesture.Value - public struct Value : Equatable, Sendable { + public struct Value : Equatable { public var time: Date public var location: CGPoint public var startLocation: CGPoint @@ -147,7 +147,7 @@ public struct LongPressGesture : Gesture { public struct MagnifyGesture : Gesture { public typealias V = MagnifyGesture.Value - public struct Value : Equatable, Sendable { + public struct Value : Equatable { public var time: Date public var magnification: CGFloat public var velocity: CGFloat @@ -166,7 +166,7 @@ public struct MagnifyGesture : Gesture { public struct RotateGesture : Gesture { public typealias V = RotateGesture.Value - public struct Value : Equatable, Sendable { + public struct Value : Equatable { public var time: Date public var rotation: Angle public var velocity: Angle @@ -198,7 +198,7 @@ public struct SpatialEventGesture : Gesture { public struct SpatialTapGesture : Gesture { public typealias V = SpatialTapGesture.Value - public struct Value : Equatable, Sendable { + public struct Value : Equatable { public var location: CGPoint } @@ -212,7 +212,7 @@ public struct SpatialTapGesture : Gesture { } } -public struct GestureMask : OptionSet, Sendable { +public struct GestureMask : OptionSet { public let rawValue: Int public init(rawValue: Int) { diff --git a/Sources/SkipUI/SkipUI/System/HoverPhase.swift b/Sources/SkipUI/SkipUI/System/HoverPhase.swift index 7c5b252..b09527c 100644 --- a/Sources/SkipUI/SkipUI/System/HoverPhase.swift +++ b/Sources/SkipUI/SkipUI/System/HoverPhase.swift @@ -7,7 +7,7 @@ import struct CoreGraphics.CGPoint #endif #endif -public enum HoverPhase : Equatable, Sendable { +public enum HoverPhase : Equatable { case active(CGPoint) case ended } diff --git a/Sources/SkipUI/SkipUI/System/KeyEquivalent.swift b/Sources/SkipUI/SkipUI/System/KeyEquivalent.swift index c0f393c..132dfb5 100644 --- a/Sources/SkipUI/SkipUI/System/KeyEquivalent.swift +++ b/Sources/SkipUI/SkipUI/System/KeyEquivalent.swift @@ -2,7 +2,7 @@ // SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception #if !SKIP_BRIDGE -public struct KeyEquivalent : Hashable, Sendable { +public struct KeyEquivalent : Hashable { public let character: Character public init(_ character: Character) { diff --git a/Sources/SkipUI/SkipUI/System/KeyboardShortcut.swift b/Sources/SkipUI/SkipUI/System/KeyboardShortcut.swift index b3b2f12..0d4d406 100644 --- a/Sources/SkipUI/SkipUI/System/KeyboardShortcut.swift +++ b/Sources/SkipUI/SkipUI/System/KeyboardShortcut.swift @@ -2,8 +2,8 @@ // SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception #if !SKIP_BRIDGE -public struct KeyboardShortcut : Hashable, Sendable { - public enum Localization : Hashable, Sendable { +public struct KeyboardShortcut : Hashable { + public enum Localization : Hashable { case automatic case withoutMirroring case custom diff --git a/Sources/SkipUI/SkipUI/System/Prominence.swift b/Sources/SkipUI/SkipUI/System/Prominence.swift index c7f0a49..7e1534d 100644 --- a/Sources/SkipUI/SkipUI/System/Prominence.swift +++ b/Sources/SkipUI/SkipUI/System/Prominence.swift @@ -2,7 +2,7 @@ // SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception #if !SKIP_BRIDGE -public enum Prominence : Hashable, Sendable { +public enum Prominence : Hashable { case standard case increased } diff --git a/Sources/SkipUI/SkipUI/System/ProposedViewSize.swift b/Sources/SkipUI/SkipUI/System/ProposedViewSize.swift index 973de16..7493af8 100644 --- a/Sources/SkipUI/SkipUI/System/ProposedViewSize.swift +++ b/Sources/SkipUI/SkipUI/System/ProposedViewSize.swift @@ -8,7 +8,7 @@ import struct CoreGraphics.CGSize #endif #endif -public struct ProposedViewSize : Equatable, Sendable { +public struct ProposedViewSize : Equatable { public var width: CGFloat? public var height: CGFloat? diff --git a/Sources/SkipUI/SkipUI/System/SafeAreaRegions.swift b/Sources/SkipUI/SkipUI/System/SafeAreaRegions.swift index 7a748c9..74a8d1b 100644 --- a/Sources/SkipUI/SkipUI/System/SafeAreaRegions.swift +++ b/Sources/SkipUI/SkipUI/System/SafeAreaRegions.swift @@ -6,7 +6,7 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.geometry.Rect #endif -public struct SafeAreaRegions : OptionSet, Sendable { +public struct SafeAreaRegions : OptionSet { public let rawValue: Int public init(rawValue: Int) { diff --git a/Sources/SkipUI/SkipUI/System/SensoryFeedback.swift b/Sources/SkipUI/SkipUI/System/SensoryFeedback.swift index bf48298..741a93d 100644 --- a/Sources/SkipUI/SkipUI/System/SensoryFeedback.swift +++ b/Sources/SkipUI/SkipUI/System/SensoryFeedback.swift @@ -5,7 +5,7 @@ import android.os.VibrationEffect #endif -public struct SensoryFeedback : RawRepresentable, Equatable, Sendable { +public struct SensoryFeedback : RawRepresentable, Equatable { public let rawValue: Int public init(rawValue: Int) { @@ -34,13 +34,13 @@ public struct SensoryFeedback : RawRepresentable, Equatable, Sendable { fatalError() } - public enum Weight : Equatable, Sendable { + public enum Weight : Equatable { case light case medium case heavy } - public enum Flexibility : Equatable, Sendable { + public enum Flexibility : Equatable { case rigid case solid case soft diff --git a/Sources/SkipUI/SkipUI/System/Visibility.swift b/Sources/SkipUI/SkipUI/System/Visibility.swift index 15462e9..427ebbd 100644 --- a/Sources/SkipUI/SkipUI/System/Visibility.swift +++ b/Sources/SkipUI/SkipUI/System/Visibility.swift @@ -2,10 +2,10 @@ // SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception #if !SKIP_BRIDGE -public enum Visibility : Hashable, CaseIterable, Sendable { - case automatic - case visible - case hidden +public enum Visibility : Int, Hashable, CaseIterable { + case automatic = 0 // For bridging + case visible = 1 // For bridging + case hidden = 2 // For bridging } #endif diff --git a/Sources/SkipUI/SkipUI/Text/Font.swift b/Sources/SkipUI/SkipUI/Text/Font.swift index c007afe..5899799 100644 --- a/Sources/SkipUI/SkipUI/Text/Font.swift +++ b/Sources/SkipUI/SkipUI/Text/Font.swift @@ -97,7 +97,7 @@ public struct Font : Hashable { } #endif - public enum TextStyle : Int, CaseIterable, Hashable, Sendable { + public enum TextStyle : Int, CaseIterable, Hashable { case largeTitle = 0 // For bridging case title = 1 // For bridging case title2 = 2 // For bridging @@ -355,7 +355,7 @@ public struct Font : Hashable { fatalError() } - public struct Weight : Hashable, Sendable { + public struct Weight : Hashable { let value: Int public static let ultraLight = Weight(value: -3) // For bridging (-0.8) public static let thin = Weight(value: -2) // For bridging (-0.6) @@ -368,7 +368,7 @@ public struct Font : Hashable { public static let black = Weight(value: 5) // For bridging (0.62) } - public struct Width : Hashable, Sendable { + public struct Width : Hashable { public var value: CGFloat public init(_ value: CGFloat) { @@ -381,13 +381,13 @@ public struct Font : Hashable { public static let expanded = Width(1.2) } - public enum Leading : Hashable, Sendable { + public enum Leading : Hashable { case standard case tight case loose } - public enum Design : Int, Hashable, Sendable { + public enum Design : Int, Hashable { case `default` = 0 // For bridging case serif = 1 // For bridging case rounded = 2 // For bridging @@ -412,7 +412,7 @@ public struct Font : Hashable { #endif } -public enum LegibilityWeight : Hashable, Sendable { +public enum LegibilityWeight : Hashable { case regular case bold } diff --git a/Sources/SkipUI/SkipUI/Text/Label.swift b/Sources/SkipUI/SkipUI/Text/Label.swift index e1b1d9b..74274b0 100644 --- a/Sources/SkipUI/SkipUI/Text/Label.swift +++ b/Sources/SkipUI/SkipUI/Text/Label.swift @@ -15,6 +15,7 @@ import androidx.compose.ui.draw.scale import androidx.compose.ui.unit.dp #endif +// SKIP @bridge public struct Label : View { let title: ComposeBuilder let image: ComposeBuilder @@ -24,6 +25,12 @@ public struct Label : View { self.image = ComposeBuilder.from(icon) } + // SKIP @bridge + public init(bridgedTitle: any View, bridgedImage: any View) { + self.title = ComposeBuilder.from { bridgedTitle } + self.image = ComposeBuilder.from { bridgedImage } + } + public init(_ titleKey: LocalizedStringKey, image: String) { self.init(title: { Text(titleKey) }, icon: { Image(image, bundle: .main) }) } @@ -114,13 +121,10 @@ public struct LabelStyle: RawRepresentable, Equatable { self.rawValue = rawValue } - public static let automatic = LabelStyle(rawValue: 0) - - public static let titleOnly = LabelStyle(rawValue: 1) - - public static let iconOnly = LabelStyle(rawValue: 2) - - public static let titleAndIcon = LabelStyle(rawValue: 3) + public static let automatic = LabelStyle(rawValue: 0) // For bridging + public static let titleOnly = LabelStyle(rawValue: 1) // For bridging + public static let iconOnly = LabelStyle(rawValue: 2) // For bridging + public static let titleAndIcon = LabelStyle(rawValue: 3) // For bridging } public struct LabeledContent { @@ -164,6 +168,11 @@ extension View { #endif } + // SKIP @bridge + public func labelStyle(bridgedStyle: Int) -> any View { + return labelStyle(LabelStyle(rawValue: bridgedStyle)) + } + public func labeledContentStyle(_ style: LabeledContentStyle) -> some View { return self } diff --git a/Sources/SkipUI/SkipUI/Text/Text.swift b/Sources/SkipUI/SkipUI/Text/Text.swift index 53d822b..4b2fe3d 100644 --- a/Sources/SkipUI/SkipUI/Text/Text.swift +++ b/Sources/SkipUI/SkipUI/Text/Text.swift @@ -251,7 +251,7 @@ public struct Text: View, Equatable { return self } - public enum Case : Int, Equatable, Sendable { + public enum Case : Int, Equatable { case uppercase = 0 // For bridging case lowercase = 1 // For bridging } @@ -265,7 +265,7 @@ public struct Text: View, Equatable { self.color = color } - public enum Pattern : Sendable { + public enum Pattern { case solid case dot case dash @@ -276,12 +276,12 @@ public struct Text: View, Equatable { public static let single = Text.LineStyle() } - public enum Scale : Sendable, Hashable { + public enum Scale : Hashable { case `default` case secondary } - public enum TruncationMode : Sendable { + public enum TruncationMode { case head case tail case middle @@ -490,7 +490,7 @@ struct _Text: View, Equatable { #endif } -public enum TextAlignment : Int, Hashable, CaseIterable, Sendable { +public enum TextAlignment : Int, Hashable, CaseIterable { case leading = 0 // For bridging case center = 1 // For bridging case trailing = 2 // For bridging @@ -842,7 +842,7 @@ public struct Material3TextOptions { } #endif -public struct RedactionReasons : OptionSet, Sendable { +public struct RedactionReasons : OptionSet { public let rawValue: Int public init(rawValue: Int) { diff --git a/Sources/SkipUI/SkipUI/Text/TextInput.swift b/Sources/SkipUI/SkipUI/Text/TextInput.swift index 7dd97a5..f4d6ca1 100644 --- a/Sources/SkipUI/SkipUI/Text/TextInput.swift +++ b/Sources/SkipUI/SkipUI/Text/TextInput.swift @@ -5,7 +5,7 @@ import androidx.compose.ui.text.input.KeyboardCapitalization #endif -public enum TextInputAutocapitalization : Sendable { +public enum TextInputAutocapitalization { case never case words case sentences diff --git a/Sources/SkipUI/SkipUI/UIKit/UIFeedbackGenerator.swift b/Sources/SkipUI/SkipUI/UIKit/UIFeedbackGenerator.swift index e3d0d28..6725faa 100644 --- a/Sources/SkipUI/SkipUI/UIKit/UIFeedbackGenerator.swift +++ b/Sources/SkipUI/SkipUI/UIKit/UIFeedbackGenerator.swift @@ -66,7 +66,7 @@ open class UIImpactFeedbackGenerator : UIFeedbackGenerator { impactOccurred(intensity: intensity) } - public enum FeedbackStyle : Int, @unchecked Sendable { + public enum FeedbackStyle : Int { case light = 0 case medium = 1 case heavy = 2 @@ -113,7 +113,7 @@ open class UINotificationFeedbackGenerator : UIFeedbackGenerator { notificationOccurred(notificationType) } - public enum FeedbackType : Int, @unchecked Sendable { + public enum FeedbackType : Int { case success = 0 case warning = 1 case error = 2 diff --git a/Sources/SkipUI/SkipUI/View/View.swift b/Sources/SkipUI/SkipUI/View/View.swift index 881e83d..c599eff 100644 --- a/Sources/SkipUI/SkipUI/View/View.swift +++ b/Sources/SkipUI/SkipUI/View/View.swift @@ -133,7 +133,7 @@ extension View { return aspectRatio(size.width / size.height, contentMode: contentMode) } - public func background(_ background: any View, alignment: Alignment = .center) -> some View { + public func background(_ background: any View, alignment: Alignment = .center) -> any View { #if SKIP return ComposeModifierView(contentView: self) { view, context in BackgroundLayout(view: view, context: context, background: background, alignment: alignment) @@ -143,19 +143,24 @@ extension View { #endif } - public func background(alignment: Alignment = .center, @ViewBuilder content: () -> any View) -> some View { + public func background(alignment: Alignment = .center, @ViewBuilder content: () -> any View) -> any View { return background(content(), alignment: alignment) } + // SKIP @bridge + public func background(horizontalAlignmentKey: String, verticalAlignmentKey: String, bridgedContent: any View) -> any View { + return background(alignment: Alignment(horizontal: HorizontalAlignment(key: horizontalAlignmentKey), vertical: VerticalAlignment(key: verticalAlignmentKey)), content: { bridgedContent }) + } + /// - Warning: The second argument here should default to `.all`. Our implementation is not yet sophisticated enough to auto-detect when it is /// against a safe area boundary, so this would cause problems. Therefore we default to `[]` and rely on ther user to specify the edges. - public func background(ignoresSafeAreaEdges edges: Edge.Set = []) -> some View { + public func background(ignoresSafeAreaEdges edges: Edge.Set = []) -> any View { return self.background(BackgroundStyle.shared, ignoresSafeAreaEdges: edges) } /// - Warning: The second argument here should default to `.all`. Our implementation is not yet sophisticated enough to auto-detect when it is /// against a safe area boundary, so this would cause problems. Therefore we default to `[]` and rely on ther user to specify the edges. - public func background(_ style: any ShapeStyle, ignoresSafeAreaEdges edges: Edge.Set = []) -> some View { + public func background(_ style: any ShapeStyle, ignoresSafeAreaEdges edges: Edge.Set = []) -> any View { #if SKIP if edges.isEmpty { return ComposeModifierView(targetView: self) { @@ -176,15 +181,21 @@ extension View { #endif } - public func background(in shape: any Shape, fillStyle: FillStyle = FillStyle()) -> some View { + // SKIP @bridge + public func background(_ style: any ShapeStyle, bridgedIgnoresSafeAreaEdges: Int) -> any View { + return background(style, ignoresSafeAreaEdges: Edge.Set(rawValue: bridgedIgnoresSafeAreaEdges)) + } + + public func background(in shape: any Shape, fillStyle: FillStyle = FillStyle()) -> any View { return background(BackgroundStyle.shared, in: shape, fillStyle: fillStyle) } - public func background(_ style: any ShapeStyle, in shape: any Shape, fillStyle: FillStyle = FillStyle()) -> some View { + public func background(_ style: any ShapeStyle, in shape: any Shape, fillStyle: FillStyle = FillStyle()) -> any View { return background(content: { shape.fill(style) }) } - public func backgroundStyle(_ style: any ShapeStyle) -> some View { + // SKIP @bridge + public func backgroundStyle(_ style: any ShapeStyle) -> any View { #if SKIP return environment(\.backgroundStyle, style) #else @@ -492,6 +503,11 @@ extension View { #endif } + // SKIP @bridge + public func frame(width: CGFloat?, height: CGFloat?, horizontalAlignmentKey: String, verticalAlignmentKey: String) -> any View { + return frame(width: width, height: height, alignment: Alignment(horizontal: HorizontalAlignment(key: horizontalAlignmentKey), vertical: VerticalAlignment(key: verticalAlignmentKey))) + } + public func frame(minWidth: CGFloat? = nil, idealWidth: CGFloat? = nil, maxWidth: CGFloat? = nil, minHeight: CGFloat? = nil, idealHeight: CGFloat? = nil, maxHeight: CGFloat? = nil, alignment: Alignment = .center) -> some View { #if SKIP return ComposeModifierView(contentView: self) { view, context in @@ -502,6 +518,11 @@ extension View { #endif } + // SKIP @bridge + public func frame(minWidth: CGFloat?, idealWidth: CGFloat?, maxWidth: CGFloat?, minHeight: CGFloat?, idealHeight: CGFloat?, maxHeight: CGFloat?, horizontalAlignmentKey: String, verticalAlignmentKey: String) -> any View { + return frame(minWidth: minWidth, idealWidth: idealWidth, maxWidth: maxWidth, minHeight: minHeight, idealHeight: idealHeight, maxHeight: maxHeight, alignment: Alignment(horizontal: HorizontalAlignment(key: horizontalAlignmentKey), vertical: VerticalAlignment(key: verticalAlignmentKey))) + } + public func grayscale(_ amount: Double) -> some View { #if SKIP return ComposeModifierView(targetView: self) { @@ -861,6 +882,11 @@ extension View { return padding(.all, length) } + // SKIP @bridge + public func padding(top: CGFloat, leading: CGFloat, bottom: CGFloat, trailing: CGFloat) -> any View { + return padding(EdgeInsets(top: top, leading: leading, bottom: bottom, trailing: trailing)) + } + @available(*, unavailable) public func persistentSystemOverlays(_ visibility: Visibility) -> some View { return self