Next step: Add video player as swiftUI View. How to macOS?

Adaptivebyte.com / Blog  / MobileApps  / Next step: Add video player as swiftUI View. How to macOS?

Next step: Add video player as swiftUI View. How to macOS?

As it seems macOS and iOS have a way to incorporate the native views from macOS and iOS.

For that we will use UIKit and AppKit.

Incorporating a view from these two libraries is simple and we will use protocols like UIViewRepresentable and NSViewRepresentable.

Check this snippet out:

struct PlayerView: UIViewRepresentable {

func updateUIView(_ uiView: UIView, context: UIViewRepresentableContext<PlayerView>) {
}

func makeUIView(context: Context) -> UIView {
     return PlayerView(frame: .zero)
}

}

PlayerView is the native iOS view that we are incorporating as View in swiftUI. 

#WumbleApp #NEWFEATURES #NEW #OLD #SWIFTUI #MACOS #IOS

LEAVE A COMMENT