mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-19 04:53:36 +00:00
25 lines
744 B
Swift
25 lines
744 B
Swift
import UIKit
|
|
import SwiftUI
|
|
|
|
|
|
/// Class for accesing SwiftUI views from Objective-C code
|
|
@objc class BridgeControllers: NSObject {
|
|
/// The `ProfileView`
|
|
@objc static func profile() -> UIViewController {
|
|
return UIHostingController(rootView: ProfileView())
|
|
}
|
|
|
|
/// The `ProfileView` for presentation in an alert
|
|
@objc static func profileAsAlert() -> UIViewController {
|
|
return UIHostingController(rootView: ProfileView(isPresentedAsAlert: true))
|
|
}
|
|
}
|
|
|
|
|
|
/// Class for using the SwiftUI `ProfileView` in the interface builder
|
|
class ProfileBridgeController: UIHostingController<ProfileView> {
|
|
required init?(coder aDecoder: NSCoder) {
|
|
super.init(coder: aDecoder, rootView: ProfileView())
|
|
}
|
|
}
|