Skip to content

[iOS] Allow setting up a single UIWindow or UIViewController with either metal or glex context #802

@seivan

Description

@seivan

Is there a way to side step Winit application setup for iOS and macOS and just get the building blocks for rendering Metal or openGL/ES?

I can setup the Application from Xcode and then call Rust code from Swift - so Winit can assume an application context is already setup.
All I really need is either a UIWindow, UIView or a UIViewController from Winit.

I did a fork where this works, so there is nothing preventing Winit for taking arguments when initialising let window = winit::Window::new(args... &events_loop).unwrap(); to not setup the application context. In this case a UIApplicationMain, UIApplicationDelegate and the other parts that's not necessary.

Instead I rather send events down to Winit with some sort of of a push/pump style for application lifecycle.

Still expecting Winit to tackle touches and other window based events.
The issue here is that those events (touches, window) are put on the UIApplicationDelegate when setting them on a UIViewController would suffice.

TL;DR would be nice to be able to side step these https://github.com/tomaka/winit/blob/master/src/platform/ios/mod.rs#L367-L368
and also implement the touch & window events on UIViewController instead of the UIApplicationDelegate.
For most lifecycle events, there are NSNotificationCenter keys that can be used instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DS - uikitAffects the UIKit backend (iOS, tvOS, watchOS, visionOS)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions