? = nil
19 | #endif
20 |
21 | /// Supply a Swift pointer to an object that holds the `@State` value and a block to release the object on finalize.
22 | // SKIP @bridge
23 | public init(valueHolder: Int64) {
24 | self.valueHolder = valueHolder
25 | StateTracking.register(self)
26 | }
27 |
28 | #if SKIP
29 | deinit {
30 | valueHolder = Swift_release(valueHolder)
31 | }
32 |
33 | /// - Seealso `SkipSwiftUI.BridgedStateBox`
34 | // SKIP EXTERN
35 | private func Swift_release(Swift_valueHolder: Int64) -> Int64
36 | #endif
37 |
38 | // SKIP @bridge
39 | public private(set) var valueHolder: Int64
40 |
41 | // SKIP @bridge
42 | public func access() {
43 | #if SKIP
44 | let _ = state?.value
45 | #endif
46 | }
47 |
48 | // SKIP @bridge
49 | public func update() {
50 | #if SKIP
51 | state?.value += 1
52 | #endif
53 | }
54 |
55 | // SKIP @bridge
56 | public func trackState() {
57 | #if SKIP
58 | state = mutableStateOf(0)
59 | #endif
60 | }
61 | }
62 |
63 | #endif
64 |
--------------------------------------------------------------------------------
/Sources/SkipUI/SkipUI/System/ProjectionTransform.swift:
--------------------------------------------------------------------------------
1 | // Copyright 2023–2025 Skip
2 | // SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception
3 | /*
4 | import struct CoreGraphics.CGAffineTransform
5 | import struct CoreGraphics.CGFloat
6 | import struct QuartzCore.CATransform3D
7 |
8 | @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *)
9 | @frozen public struct ProjectionTransform {
10 |
11 | public var m11: CGFloat { get { fatalError() } }
12 |
13 | public var m12: CGFloat { get { fatalError() } }
14 |
15 | public var m13: CGFloat { get { fatalError() } }
16 |
17 | public var m21: CGFloat { get { fatalError() } }
18 |
19 | public var m22: CGFloat { get { fatalError() } }
20 |
21 | public var m23: CGFloat { get { fatalError() } }
22 |
23 | public var m31: CGFloat { get { fatalError() } }
24 |
25 | public var m32: CGFloat { get { fatalError() } }
26 |
27 | public var m33: CGFloat { get { fatalError() } }
28 |
29 | @inlinable public init() { fatalError() }
30 |
31 | @inlinable public init(_ m: CGAffineTransform) { fatalError() }
32 |
33 | @inlinable public init(_ m: CATransform3D) { fatalError() }
34 |
35 | @inlinable public var isIdentity: Bool { get { fatalError() } }
36 |
37 | @inlinable public var isAffine: Bool { get { fatalError() } }
38 |
39 | public mutating func invert() -> Bool { fatalError() }
40 |
41 | public func inverted() -> ProjectionTransform { fatalError() }
42 | }
43 |
44 | @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *)
45 | extension ProjectionTransform : Equatable {
46 |
47 |
48 | }
49 |
50 | @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *)
51 | extension ProjectionTransform {
52 |
53 | public func concatenating(_ rhs: ProjectionTransform) -> ProjectionTransform { fatalError() }
54 | }
55 |
56 | @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *)
57 | extension ProjectionTransform : Sendable {
58 | }
59 | */
60 |
--------------------------------------------------------------------------------
/Sources/SkipUI/SkipUI/UIKit/UIKeyboardType.swift:
--------------------------------------------------------------------------------
1 | // Copyright 2023–2025 Skip
2 | // SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception
3 | #if !SKIP_BRIDGE
4 | #if SKIP
5 | import androidx.compose.ui.text.input.KeyboardType
6 | #endif
7 |
8 | public enum UIKeyboardType: Int {
9 | case `default` = 0 // For bridging
10 | case asciiCapable = 1 // For bridging
11 | case numbersAndPunctuation = 2 // For bridging
12 | case URL = 3 // For bridging
13 | case numberPad = 4 // For bridging
14 | case phonePad = 5 // For bridging
15 | case namePhonePad = 6 // For bridging
16 | case emailAddress = 7 // For bridging
17 | case decimalPad = 8 // For bridging
18 | case twitter = 9 // For bridging
19 | case webSearch = 10 // For bridging
20 | case asciiCapableNumberPad = 11 // For bridging
21 | case alphabet = 12 // For bridging
22 |
23 | #if SKIP
24 | func asComposeKeyboardType() -> KeyboardType {
25 | switch self {
26 | case .default:
27 | return KeyboardType.Text
28 | case .asciiCapable:
29 | return KeyboardType.Ascii
30 | case .numbersAndPunctuation:
31 | return KeyboardType.Text
32 | case .URL:
33 | return KeyboardType.Uri
34 | case .numberPad:
35 | return KeyboardType.Number
36 | case .phonePad:
37 | return KeyboardType.Phone
38 | case .namePhonePad:
39 | return KeyboardType.Text
40 | case .emailAddress:
41 | return KeyboardType.Email
42 | case .decimalPad:
43 | return KeyboardType.Decimal
44 | case .twitter:
45 | return KeyboardType.Text
46 | case .webSearch:
47 | return KeyboardType.Text
48 | case .asciiCapableNumberPad:
49 | return KeyboardType.Text
50 | case .alphabet:
51 | return KeyboardType.Text
52 | }
53 | }
54 | #endif
55 | }
56 |
57 | #endif
58 |
--------------------------------------------------------------------------------
/Sources/SkipUI/SkipUI/Components/Link.swift:
--------------------------------------------------------------------------------
1 | // Copyright 2023–2025 Skip
2 | // SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception
3 | #if !SKIP_BRIDGE
4 | import Foundation
5 | #if SKIP
6 | import androidx.compose.runtime.Composable
7 | #endif
8 |
9 | // Use a class to be able to update our openURL action on compose by reference.
10 | // SKIP @bridge
11 | public final class Link : View, Renderable {
12 | let content: Button
13 | var openURL = OpenURLAction.default
14 |
15 | public init(destination: URL, @ViewBuilder label: () -> any View) {
16 | #if SKIP
17 | content = Button(action: { self.openURL(destination) }, label: label)
18 | #else
19 | content = Button("", action: {})
20 | #endif
21 | }
22 |
23 | // SKIP @bridge
24 | public init(destination: URL, bridgedLabel: any View) {
25 | #if SKIP
26 | content = Button(bridgedRole: nil, action: { self.openURL(destination) }, bridgedLabel: bridgedLabel)
27 | #else
28 | content = Button("", action: {})
29 | #endif
30 | }
31 |
32 | public convenience init(_ titleKey: LocalizedStringKey, destination: URL) {
33 | self.init(destination: destination, label: { Text(titleKey) })
34 | }
35 |
36 | public convenience init(_ titleResource: LocalizedStringResource, destination: URL) {
37 | self.init(destination: destination, label: { Text(titleResource) })
38 | }
39 |
40 | public convenience init(_ title: String, destination: URL) {
41 | self.init(destination: destination, label: { Text(verbatim: title) })
42 | }
43 |
44 | #if SKIP
45 | @Composable override func Render(context: ComposeContext) {
46 | ComposeAction()
47 | content.Compose(context: context)
48 | }
49 |
50 | @Composable func ComposeAction() {
51 | openURL = EnvironmentValues.shared.openURL
52 | }
53 | #else
54 | public var body: some View {
55 | stubView()
56 | }
57 | #endif
58 | }
59 |
60 | #endif
61 |
--------------------------------------------------------------------------------
/Sources/SkipUI/SkipUI/View/Observable.swift:
--------------------------------------------------------------------------------
1 | // Copyright 2023–2025 Skip
2 | // SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception
3 | #if !SKIP_BRIDGE
4 | import Combine
5 | #if SKIP
6 | import androidx.compose.runtime.DisposableEffect
7 | import androidx.compose.runtime.remember
8 | import androidx.compose.runtime.rememberUpdatedState
9 | #endif
10 |
11 | extension View {
12 | // SKIP DECLARE: fun onReceive(publisher: P, perform: (Output) -> Unit): View where P: Publisher