rust-windowing / rust-windowing/winit

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

Open
#802 3 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

DS - uikit
Dominant language
Rust
Stars
6.2k
Forks
1.3k
Avg merge
2d 19h
Merged PRs (30d)
9

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue points to src/platform/ios/mod.rs, including the UIApplicationDelegate setup around lines 367-368 and 671-682; start by reading those paths and the existing Window initialization. Done means an iOS or macOS caller can provide its application context, obtain a UIWindow, UIView, or UIViewController, and still receive touch and window events without Winit creating UIApplicationMain.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, macos, rust
Domain
desktop-dev, mobile-dev
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.