fethica / FRadioPlayer

A simple radio player framework for iOS, macOS, tvOS.
https://fethica.github.io/FRadioPlayer/
MIT License
283 stars 59 forks source link

How to use with SwiftUI? #43

Closed dmnktoe closed 3 years ago

dmnktoe commented 4 years ago

Can somebody tell me if it’s possible to use this library together with SwiftUI?

If yes, I would appreciate a brief example, thanks in advance!

I'm kinda getting stuck, when it comes to things like UIViewControllerRepresentable or to set the player it’s delegate due to the missing override function in a SwiftUI file.

jaksatomovic commented 3 years ago

any news?

urayoanm commented 3 years ago

I was working this week with swiftui and got almost a complete example. Have some stuff to figure it out yet.

jaksatomovic commented 3 years ago

would you share it maybe?

urayoanm commented 3 years ago

Sure, give a couple of hours and I upload to my repo what I have. Still needs work to do and some stuff I need to figure it out, but I think is a good start point.

jaksatomovic commented 3 years ago

Awesome, thanks a lot!

urayoanm commented 3 years ago

This is two screenshots of what I have today (dark and light theme) and the source in a zip file (more fast to share at the moment)

I am figuring out some stuff in SwiftUI yet, so suggestions and fixes are welcome

Maybe @fethica can help us creating a new brach.

Light Theme https://azrockradio.com/wp-content/uploads/fradio/light.png

Dark Theme https://azrockradio.com/wp-content/uploads/fradio/dark.png

Source https://azrockradio.com/wp-content/uploads/fradio/FRadioPlayer-master-SwiftUI.zip

fethica commented 3 years ago

Very cool! I will check the code and add it to a new branch, thanks @urayoanm

urayoanm commented 3 years ago

Hey @fethica, @jaksatomovi:

I figure it out how to update the album artwork and metadata. Check this example better, I think you are gonna like it more.

It was all about the @ObservableObject and how to pass it around the views.

Check the FRadioPlayer_SwiftUIApp (the substitute of the App and Scene delegate).

The Station and Track model are shared from the main project.

Enjoy!

https://azrockradio.com/wp-content/uploads/fradio/FRadioPlayer-master_SwiftUI_2.zip

fethica commented 3 years ago

Very nice! I'll check the new implementation, thanks again @urayoanm

urayoanm commented 3 years ago

Your welcome @fethica

fethica commented 3 years ago

Hey @urayoanm, I checked the code, great work! Could you create a PR so we can merge it to the project and you get the credit for your work? We can improve it more later :) Thanks!

urayoanm commented 3 years ago

Sure. Will do today. I got other nice changes:)

urayoanm commented 3 years ago

@fethica the pr id done. Added forward and back to the controls and AirPlay button

fethica commented 3 years ago

Done! I checked the code everything looks good :) Thanks @urayoanm