Post

Replies

Boosts

Views

Activity

Reply to SwiftUI Scrollview disable clipping
Hey guys, I've found a decent solution for this problem. BEFORE: AFTER: I've added 2 paddings to ScrollView and to content of ScrollView with the same amount of padding but one with NEGATIVE value like this: struct ScrollViewClippingProblem: View { var body: some View { VStack { Text("Lorem Ipsum") .font(.title) ScrollView(.horizontal, showsIndicators: false) { HStack(alignment: .top) { ForEach(0..<10, content: { item in Text("\(item)") .font(.title) .padding() .background(Circle().fill(.red)) .shadow(color: .blue, radius: 10, x: 15, y: 10) }) } .padding(.vertical, 40) // <- add padding here to make the space for the shadow } .padding(.vertical, -40) // <- add NEGATIVE padding here of the same value to shrink the space you created with the padding above Text("Lorem Ipsum") .font(.title) } .background(.ultraThinMaterial) } } I hope this helps! :)
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Sep ’22
Reply to Interactive Widget: unable to reload timeline from AppIntent
Hey guys! Has anyone found a solution to this issue? My use case is exactly the same as the OP’s. I have two different widgets and need to reload both when updating data using AppIntent on the first widget.
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Feb ’25
Reply to Vertical ScrollView Height and Paging Offset Issues in SwiftUI
As stated in this answer, the offset issue might also be caused by the default spacing of the containers used inside the ScrollView. https://stackoverflow.com/a/77421751/19954370
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Oct ’24
Reply to SwiftUI MapKit - MapAnnotation - Publishing changes from within view updates is not allowed, this will cause undefined behavior.
I'm experiencing the same problem, guys. I doubt it can be used in production with an issue like this.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jun ’23
Reply to Xcode 14: Publishing changes from within view updates
I face the same problem. Chaning even a simple @Published property like Int from 1 to 2 in button action triggers the purple warning: "Publishing changes from within view updates is not allowed, this will cause undefined behavior." I believe it's an Xcode bug.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Oct ’22
Reply to SwiftUI Scrollview disable clipping
Hey guys, I've found a decent solution for this problem. BEFORE: AFTER: I've added 2 paddings to ScrollView and to content of ScrollView with the same amount of padding but one with NEGATIVE value like this: struct ScrollViewClippingProblem: View { var body: some View { VStack { Text("Lorem Ipsum") .font(.title) ScrollView(.horizontal, showsIndicators: false) { HStack(alignment: .top) { ForEach(0..<10, content: { item in Text("\(item)") .font(.title) .padding() .background(Circle().fill(.red)) .shadow(color: .blue, radius: 10, x: 15, y: 10) }) } .padding(.vertical, 40) // <- add padding here to make the space for the shadow } .padding(.vertical, -40) // <- add NEGATIVE padding here of the same value to shrink the space you created with the padding above Text("Lorem Ipsum") .font(.title) } .background(.ultraThinMaterial) } } I hope this helps! :)
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Sep ’22