Created
October 22, 2019 17:56
-
-
Save noppefoxwolf/02fcf065156d632c8b547e13313ff144 to your computer and use it in GitHub Desktop.
Popover dismiss issue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
struct Item: Identifiable { | |
let id: String | |
} | |
struct ContentView : View { | |
@State var item: Item? = nil | |
var body: some View { | |
Button(action: { | |
self.item = .init(id: "a") | |
}) { | |
Text("Show new view") | |
}.popover(item: $item, attachmentAnchor: .point(UnitPoint.center), arrowEdge: .bottom) { _ in | |
HStack { | |
Button(action: { | |
self.item = nil | |
}) { | |
Text("New Popover") | |
} | |
} | |
} | |
} | |
} | |
struct ContentView_Previews: PreviewProvider { | |
static var previews: some View { | |
ContentView() | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment