Skip to content

Commit 927af44

Browse files
authored
Move UIKit backend to winit-uikit
1 parent 0adc089 commit 927af44

File tree

18 files changed

+128
-110
lines changed

18 files changed

+128
-110
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/winit-android @MarijnS95
33

44
# Apple (AppKit + UIKit)
5-
/src/platform/ios.rs @madsmtm
5+
/winit-uikit @madsmtm
66
/src/platform/macos.rs @madsmtm
77
/src/platform_impl/apple @madsmtm
88
/winit-common/src/core_foundation @madsmtm

.github/workflows/ci.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,11 @@ jobs:
201201
if: contains(matrix.platform.target, 'redox')
202202
run: cargo test -p winit-orbital
203203

204+
- name: Test winit UIKit
205+
if: contains(matrix.platform.target, 'ios')
206+
# TODO: Run on Simulator
207+
run: cargo $CMD test -p winit-uikit --target=${{ matrix.platform.target }} --no-run
208+
204209
- name: Test winit Win32
205210
if: contains(matrix.platform.target, 'windows')
206211
run: cargo $CMD test -p winit-win32 --target=${{ matrix.platform.target }}

Cargo.toml

Lines changed: 3 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ winit-android = { version = "0.0.0", path = "winit-android" }
1616
winit-common = { version = "0.0.0", path = "winit-common" }
1717
winit-core = { version = "0.0.0", path = "winit-core" }
1818
winit-orbital = { version = "0.0.0", path = "winit-orbital" }
19+
winit-uikit = { version = "0.0.0", path = "winit-uikit" }
1920
winit-win32 = { version = "0.0.0", path = "winit-win32" }
2021

2122
# Core dependencies.
@@ -164,6 +165,7 @@ serde = [
164165
"dpi/serde",
165166
"bitflags/serde",
166167
"winit-core/serde",
168+
"winit-uikit/serde",
167169
]
168170
wayland = [
169171
"wayland-client",
@@ -296,52 +298,8 @@ objc2-foundation = { workspace = true, features = [
296298
"NSValue",
297299
] }
298300

299-
# UIKit
300301
[target.'cfg(all(target_vendor = "apple", not(target_os = "macos")))'.dependencies]
301-
objc2-core-foundation = { workspace = true, features = [
302-
"std",
303-
"CFCGTypes",
304-
"CFBase",
305-
"CFRunLoop",
306-
"CFString",
307-
] }
308-
objc2-foundation = { workspace = true, features = [
309-
"std",
310-
"block2",
311-
"objc2-core-foundation",
312-
"NSArray",
313-
"NSEnumerator",
314-
"NSGeometry",
315-
"NSObjCRuntime",
316-
"NSOperation",
317-
"NSString",
318-
"NSThread",
319-
"NSSet",
320-
] }
321-
objc2-ui-kit = { workspace = true, features = [
322-
"std",
323-
"objc2-core-foundation",
324-
"UIApplication",
325-
"UIDevice",
326-
"UIEvent",
327-
"UIGeometry",
328-
"UIGestureRecognizer",
329-
"UITextInput",
330-
"UITextInputTraits",
331-
"UIOrientation",
332-
"UIPanGestureRecognizer",
333-
"UIPinchGestureRecognizer",
334-
"UIResponder",
335-
"UIRotationGestureRecognizer",
336-
"UIScreen",
337-
"UIScreenMode",
338-
"UITapGestureRecognizer",
339-
"UITouch",
340-
"UITraitCollection",
341-
"UIView",
342-
"UIViewController",
343-
"UIWindow",
344-
] }
302+
winit-uikit.workspace = true
345303

346304
[target.'cfg(target_os = "windows")'.dependencies]
347305
winit-win32.workspace = true

src/platform/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#[cfg(android_platform)]
66
pub use winit_android as android;
77
#[cfg(ios_platform)]
8-
pub mod ios;
8+
pub use winit_uikit as ios;
99
#[cfg(macos_platform)]
1010
pub mod macos;
1111
#[cfg(orbital_platform)]

src/platform_impl/apple/mod.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
#[cfg(target_os = "macos")]
22
mod appkit;
3-
#[cfg(not(target_os = "macos"))]
4-
mod uikit;
53

64
#[allow(unused_imports)]
75
#[cfg(target_os = "macos")]
86
pub use self::appkit::*;
9-
#[allow(unused_imports)]
10-
#[cfg(not(target_os = "macos"))]
11-
pub use self::uikit::*;

src/platform_impl/apple/uikit/mod.rs

Lines changed: 0 additions & 26 deletions
This file was deleted.

src/platform_impl/apple/uikit/notification_center.rs

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/platform_impl/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
#[cfg(android_platform)]
22
pub(crate) use winit_android as platform;
3-
#[cfg(target_vendor = "apple")]
3+
#[cfg(macos_platform)]
44
mod apple;
55
#[cfg(any(x11_platform, wayland_platform))]
66
mod linux;
77
#[cfg(orbital_platform)]
88
pub(crate) use winit_orbital as platform;
9+
#[cfg(ios_platform)]
10+
pub(crate) use winit_uikit as platform;
911
#[cfg(web_platform)]
1012
mod web;
1113
#[cfg(windows_platform)]
1214
pub(crate) use winit_win32 as platform;
1315

14-
#[cfg(target_vendor = "apple")]
16+
#[cfg(macos_platform)]
1517
use self::apple as platform;
1618
#[cfg(any(x11_platform, wayland_platform))]
1719
use self::linux as platform;

winit-uikit/Cargo.toml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
[package]
2+
description = "Winit's UIKit (iOS/tvOS/visionOS) backend"
3+
documentation = "https://docs.rs/winit-uikit"
4+
edition.workspace = true
5+
license.workspace = true
6+
name = "winit-uikit"
7+
repository.workspace = true
8+
rust-version.workspace = true
9+
version = "0.0.0"
10+
11+
[features]
12+
serde = ["dep:serde", "bitflags/serde", "smol_str/serde", "dpi/serde"]
13+
14+
[dependencies]
15+
bitflags.workspace = true
16+
dpi.workspace = true
17+
rwh_06.workspace = true
18+
serde = { workspace = true, optional = true }
19+
smol_str.workspace = true
20+
tracing.workspace = true
21+
winit-common = { workspace = true, features = ["core-foundation", "event-handler"] }
22+
winit-core.workspace = true
23+
24+
# Platform-specific
25+
[target.'cfg(target_vendor = "apple")'.dependencies]
26+
block2.workspace = true
27+
dispatch2.workspace = true
28+
objc2.workspace = true
29+
objc2-core-foundation = { workspace = true, features = [
30+
"std",
31+
"CFCGTypes",
32+
"CFBase",
33+
"CFRunLoop",
34+
"CFString",
35+
] }
36+
objc2-foundation = { workspace = true, features = [
37+
"std",
38+
"block2",
39+
"objc2-core-foundation",
40+
"NSArray",
41+
"NSEnumerator",
42+
"NSGeometry",
43+
"NSObjCRuntime",
44+
"NSOperation",
45+
"NSString",
46+
"NSThread",
47+
"NSSet",
48+
] }
49+
objc2-ui-kit = { workspace = true, features = [
50+
"std",
51+
"objc2-core-foundation",
52+
"UIApplication",
53+
"UIDevice",
54+
"UIEvent",
55+
"UIGeometry",
56+
"UIGestureRecognizer",
57+
"UITextInput",
58+
"UITextInputTraits",
59+
"UIOrientation",
60+
"UIPanGestureRecognizer",
61+
"UIPinchGestureRecognizer",
62+
"UIResponder",
63+
"UIRotationGestureRecognizer",
64+
"UIScreen",
65+
"UIScreenMode",
66+
"UITapGestureRecognizer",
67+
"UITouch",
68+
"UITraitCollection",
69+
"UIView",
70+
"UIViewController",
71+
"UIWindow",
72+
] }

winit-uikit/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../README.md

0 commit comments

Comments
 (0)