Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for presenting/opening files on iOS #6448

Merged
merged 3 commits into from
Dec 11, 2024

Conversation

frenzibyte
Copy link
Member

Allows exporting files in the game. Preview:

CleanShot.2024-12-09.at.07.43.23.mp4


private UIWindow? window;

public bool OpenFile(string filename, UIWindow window)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we pass this in the ctor rather than having it weird nullable and passed in every method?

Copy link
Member Author

@frenzibyte frenzibyte Dec 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't find a good place wherein the IOSWindow is initialised other than doing it directly at GameHost.CreateWindow() so I figured I might as well just do it this way.

Maybe it would be good to have an OnInitialised method exposed from GameHost that's called after everything is set up, so that other components provided by derived game host classes can be initialised at that point with all resources available.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or just on first usage. point is, the nullable part is in a weird place. we'd never pass a window in on each method in a class just because it needs to arrive once somewhere

@peppy peppy self-requested a review December 10, 2024 05:03
Comment on lines 28 to 29
private IOSFilePresenter? backingPresenter;
private IOSFilePresenter presenter => backingPresenter ??= new IOSFilePresenter(iosWindow.UIWindow);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'd probably prefer using Lazy<> instead of backingXXX just to conform to existing standards.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't intend to drag this but I made it a lazy and then felt I could just take a different much simpler approach instead. 7c7529d

@peppy peppy merged commit f5900ab into ppy:master Dec 11, 2024
12 of 14 checks passed
@frenzibyte frenzibyte deleted the ios-export-files branch December 11, 2024 06:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants