Created
November 16, 2022 03:48
-
-
Save 1998code/00d41a30ec8b69268c0683c5f657929f to your computer and use it in GitHub Desktop.
AppStorage + Sheet + Slider bugs on iOS16
This file contains 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
// | |
// ContentView.swift | |
// Demo | |
// | |
// Created by Ming on 16/11/2022. | |
// | |
import SwiftUI | |
struct ContentView: View { | |
@State var showSheet = false | |
var body: some View { | |
Button(action: {showSheet.toggle()}){ | |
Text("Open") | |
} | |
.padding() | |
.sheet(isPresented: $showSheet) { | |
List { | |
works | |
notWork | |
} | |
} | |
} | |
@State var test: Double = 0 | |
var works: some View { | |
Group { | |
Text("\(test)") | |
Slider(value: $test, in: 0...100) | |
} | |
} | |
@AppStorage("test2") var test2: Double = 0 | |
var notWork: some View { | |
Group { | |
Text("\(test2)") | |
Slider(value: $test2, in: 0...100) | |
} | |
} | |
} | |
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