Skip to content

Instantly share code, notes, and snippets.

@1998code
Created November 16, 2022 03:48
Show Gist options
  • Save 1998code/00d41a30ec8b69268c0683c5f657929f to your computer and use it in GitHub Desktop.
Save 1998code/00d41a30ec8b69268c0683c5f657929f to your computer and use it in GitHub Desktop.
AppStorage + Sheet + Slider bugs on iOS16
//
// 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