QuickBirdEng / XCoordinator

🎌 Powerful navigation library for iOS based on the coordinator pattern
MIT License
2.25k stars 177 forks source link

macOS support #217

Closed saket closed 1 year ago

saket commented 2 years ago

Hey folks, XCoordinator looks great. Is there any possibility of adding support for macOS? Considering that you're planning to add support for watchOS, it'd be nice to cover the desktop as well!

pauljohanneskraft commented 2 years ago

Hello - this is a great idea - thank you for telling us. The problem with this is, that UIKit and AppKit use fundamentally different types (NSViewController vs UIViewController for example), which would require pretty much a rewrite. Since watchOS is very similar to iOS, the addition of that platform requires significantly less work. Especially with macCatalyst and Apple Silicon available now, you should however already be able to use XCoordinator on Mac. Let me know, if you would want to help with the implementation (regarding AppKit), since it would definitely be a great addition to this library.

andrefmsilva commented 2 years ago

I did a quick test using the sample app and it compiles for macCatalyst just fine (ofc we need to enable mac in XCoordinator Package.swift).
The UI has some problems but i can push and pop controllers.

andrefmsilva commented 2 years ago

https://streamable.com/o7uwnn

pauljohanneskraft commented 2 years ago

The example app has (unfortunately) not even been optimized for iPad, that's why these issues are there. They should not be connected to XCoordinator directly though.

I can't seem to be able to build the example app for Mac Catalyst though on my M1 Mac - RxCocoa seems to be unavailable on this platform for some reason - do you have an idea why that is?

andrefmsilva commented 2 years ago

I'll do everything again with the latest commits to find the correct steps

andrefmsilva commented 2 years ago

This are the steps that i did to make it work.

1 - Removed the reference of XCoordinator package from the sample project and i've added a reference for a local copy of the repo 2 - Add .macOS(.v10_14) to platforms in my XCoordinator local package 3 - Increase the version of RxSwift in the sample to 6.0.0 - Next Major 4 - Add the reference to XCoordinator and XCoordinatorRx in Frameworks 5 - Enable the Mac Catalyst checkbox with Optimize for Mac

andrefmsilva commented 2 years ago

@pauljohanneskraft News about this one?

pauljohanneskraft commented 2 years ago

@andrefmsilva no, sorry - would you be willing to create a pull request with these changes?