struct ContentView: View {
@State private var sliderValue = 50.0
@State private var showSlider = true
var body: some View {
VStack {
BullSlider(value: $sliderValue, in: 1.0...100.0)
.opacity(showSlider ? 1 : 0)
Button("Toggle") {
withAnimation {
showSlider.toggle()
}
}
.padding()
}
}
}
struct BullSlider: View {
@Binding var value: Double
var bounds: ClosedRange<Double>
init(value: Binding<Double>, in bounds: ClosedRange<Double>) {
self.bounds = bounds
self._value = value
}
var body: some View {
Slider(value: $value, in: bounds)
.onAppear{
let thumbImage = ImageRenderer(content: bullThumb).uiImage ?? UIImage()
UISlider.appearance().setThumbImage(thumbImage, for: .normal)
}
}
var bullThumb: some View {
VStack {
ZStack {
Circle()
.frame(width: 50, height: 50)
.foregroundColor(.white)
Circle()
.strokeBorder(lineWidth: 6)
.frame(width: 44, height: 44)
Circle()
.strokeBorder(lineWidth: 6)
.frame(width: 24, height: 24)
}
.foregroundColor(.blue)
}
.frame(width: 50, height: 60)
}
}
Post
Replies
Boosts
Views
Activity
Seeing the same error in our production app.
Some useful tips here -> SO
Try this
struct ButtonAnimationTest: View {
@State var showButton: Bool = true
var body: some View {
VStack {
if showButton {
Button("makeTransition") {
withAnimation {
showButton.toggle()
}
}
.buttonStyle(MyButtonStyle())
.padding()
.background(Color.black)
.transition(.slide)
}
}
.animation(.easeIn(duration: 1), value: showButton)
}
}
Check the help for confirmationDialog. It states
On iOS, tvOS, and watchOS, confirmation dialogs only support controls with labels that are Text. Passing any other type of view results in the content being omitted.
Add a Spacer() after the 2 HStacks.
Xcode 14.1 requires a Mac running macOS Monterey 12.5 or later. Are you able to update your MacBook Pro to Monterey?
struct ContentView: View {
var body: some View {
ScrollView {
LazyVStack(alignment: .leading, spacing: 0, pinnedViews: [.sectionHeaders], content: {
ForEach(0..<10) { section in
Section {
ForEach(0..<10) { item in
VStack(alignment: .leading, spacing: 0) {
Text("List Item \(item)")
.frame(minHeight: 50)
Divider()
}
.padding(.leading)
}
} header: {
Text("Section \(section)")
.bold()
.frame(height: 50)
.frame(maxWidth: .infinity)
.background(Color(.systemGray6))
}
}
})
}
.clipped()
}
}
Remove arm64 from excluded archs of your project build setting. Apple is no longer fixing x86_64 simulator issues.
https://developer.apple.com/events/view/upcoming-events?q=vision - Scroll down for more dates.
Move Crashlytics phase to the last step in your build phases
This is what I did for my tabs and no longer have the problem with system tabbar showing up unexpectedly.
@State var activeTab: Screen = .home
var body: some View {
TabView(selection: $activeTab) {
switch activeTab {
case .home:
HomeRoot()
.tag(Screen.home)
case .menu:
MenuRoot()
.tag(Screen.menu)
case .rewards:
RewardsRoot()
.tag(Screen.rewards)
case .scan:
Scan()
.tag(Screen.scan)
default:
EmptyView()
}
}
.safeAreaInset(edge: .bottom) {
TabBarView(
activeTab: $activeTab
)
}
}
Here's the status