5f1d49b0bd
Partially solves #281. This adds a new example app which mimics the Maps.app, written in SwiftUI. The code works for iOS 13+, however: * the project has been created with Xcode 13 * the project uses the SwiftUI lifecycle (iOS 14+) The source code in Examples/Maps-SwiftUI/Maps/FloatingPanel is ready to move into the library, but there is an issue on SwiftUI’s environment propagation into FloatingPanel. SwiftUI’s environment is propagated to all subviews. However FloatingPanel is not a subview, but a new view controller in the screen (and not a child view controller). It’s possible to lead behaviors unexpected by SwiftUI users so that this is merged as a sample code until it will be resolved.
19 lines
555 B
Swift
19 lines
555 B
Swift
// Copyright 2021 the FloatingPanel authors. All rights reserved. MIT license.
|
|
|
|
import SwiftUI
|
|
|
|
@main
|
|
struct MapsApp: App {
|
|
var body: some Scene {
|
|
WindowGroup {
|
|
ContentView()
|
|
.floatingPanel(delegate: SearchPanelPhoneDelegate()) { proxy in
|
|
FloatingPanelContentView(proxy: proxy)
|
|
}
|
|
.floatingPanelSurfaceAppearance(.phone)
|
|
.floatingPanelContentMode(.fitToBounds)
|
|
.floatingPanelContentInsetAdjustmentBehavior(.never)
|
|
}
|
|
}
|
|
}
|