Post

Replies

Boosts

Views

Activity

Reply to [SwiftUI] How to have a list in a scrollView?
This comes close     var body: some View {             List {                 Section {                     VStack (spacing: 20) {                         HStack (spacing: 20) {                             RoundedRectangle(cornerRadius: 12, style: .continuous)                                 .foregroundColor(Color(.systemRed))                             RoundedRectangle(cornerRadius: 12, style: .continuous)                                 .foregroundColor(Color(.systemYellow))                         }                         .frame(height: 100)                         HStack (spacing: 20) {                             RoundedRectangle(cornerRadius: 12, style: .continuous)                                 .foregroundColor(Color(.systemGreen))                             RoundedRectangle(cornerRadius: 12, style: .continuous)                                 .foregroundColor(Color(.systemBlue))                         }                         .frame(height: 100)                     }                 }                 Section(header: Text("My Lists")) {                     ForEach(1..<21) { index in                         Text("\(index)")                     }                 }             }             .listStyle(InsetGroupedListStyle())     } } struct ContentView_Previews: PreviewProvider {     static var previews: some View {         ContentView()             .preferredColorScheme(.dark)     } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Sep ’20
Reply to why elements don't have equal sizes?
Set horizontal hugging priority for 60 to 252 as suggested Add a equal height constraint between EDIT TIMER DURATION and ANOTHER LABEL Set vertical hugging priority for Duration to 1000 Set vertical hugging priority for Horizontal Slider to 1000
Topic: UI Frameworks SubTopic: UIKit Tags:
Nov ’21
Reply to Decoding JSON
struct OpenTotal: Decodable {     var total: Double?     var overOdds: Int?     var underOdds: Int? } struct CurrentTotal: Decodable {     var total: Double?     var overOdds: Int?     var underOdds: Int? }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jan ’22
Reply to Where to put the animation
struct CardView: View {     @State var isFaceUp = false     var body: some View {         ZStack {             let shape = RoundedRectangle(cornerRadius: 20)             if isFaceUp {                 shape.fill().foregroundColor(.white)                 shape.stroke(lineWidth: 3)                 Text("😀").font(.system(size: 80))             } else {                 shape.fill()             }         }         .rotation3DEffect(Angle(degrees: isFaceUp ? 180 : 0), axis: (x: 0, y: 1, z: 0))         .animation(.spring(), value: isFaceUp)         .onTapGesture {             isFaceUp.toggle()         }     } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jan ’22