Posts

Post not yet marked as solved
6 Replies
16k Views
What is the SwiftUI equivalent to returnKeyType? How do we implement it?
Posted Last updated
.
Post marked as solved
4 Replies
7.1k Views
I have a textfield set in a VStack. Everything is as it should be except that the keyboard is no longer showing up. Where did I mess up? How can I get the keyboard to show again?return VStack { Image("food") .resizable() .aspectRatio(1.0, contentMode: .fit) .clipShape(RoundedRectangle(cornerRadius: 50)) .gesture(longPressDrag) .padding() .offset(y: kGuardian.slide).animation(.basic(duration: 1.5)) .shadow(color: Color.black, radius: 15, x: 2, y: 2) TextField("Leave a comment", text: $comment, onEditingChanged: { if $0 { self.kGuardian.showField = 0 } }) { commentText = self.comment } .padding() .background(GeometryGetter(rect: $kGuardian.rects[0])) .background(Color(red: 239.0/255.0, green: 243.0/255.0, blue: 244.0/255.0, opacity: 1.0), cornerRadius: 10.0) } .padding() .shadow(color: Color.black, radius: 15, x: 2, y: 2) .offset( x: viewState.width + dragState.translation.width ) .presentation($showAlert) { Alert(title: Text("User commented on this photo!"), message: Text(commentText), primaryButton: .default(Text("OK")) { commentText = "" self.comment = "" }, secondaryButton: .cancel() ) }
Posted Last updated
.
Post not yet marked as solved
2 Replies
502 Views
The last few iterations of Xcode betas starting, I think, with 12 will not download. I’ll start the download then it goes from between 3 to 30MBps and immediately plummets to around 200kps. I’d have to babysit it all day and evening to get it to MAYBE 1GB downloaded that day. Eventually it will stop completely and say it finished at 14kb downloaded. Something isn’t right here. I pay my dev fee every year like everyone else. Any help would be greatly appreciated!
Posted Last updated
.
Post not yet marked as solved
0 Replies
1k Views
I am playing around with a Tinder-style interface. Right now I have the cards hard-coded in. I have an array of my Card objects. I would like to know how to populate the Zstack with an array or something more scalable(if you have any suggestions for that). I would also like to increment the .offset x and y values. I have searched all day and can't find anything on how to do any of this.struct ContentView : View { @State var cards = Array(repeating: NewCard(), count: 3) var body: some View { ZStack { Image("plant") .resizable() ZStack { ForEach(cards, id: \.id) { card in card.offset(x: card.x, y: card.y) } // cards[2] // .offset(x: -10, y: -20) // cards[1] // .offset(x: -5, y: -10) // cards[0] } } } }
Posted Last updated
.
Post not yet marked as solved
1 Replies
1.2k Views
I have a Tinder-like Vstack "card" that swipes left and right. The VStack contains an Image and a TextField below it. I want to drag the Image and have it drag the whole VStack, TextField included. It does that. However, the TextField also drags the whole VStack. I only want the Image to drag and have the textfield work as a textfield. Here is the code for the VStack.return VStack { VStack { Image("food") .resizable() .aspectRatio(1.0, contentMode: .fit) .clipShape(RoundedRectangle(cornerRadius: 50)) TextField("Leave a comment", text: $comment, onEditingChanged: { if $0 { self.kGuardian.showField = 0 } }) { commentText = self.comment } .padding() .background(GeometryGetter(rect: $kGuardian.rects[0])) .background(Color(red: 239.0/255.0, green: 243.0/255.0, blue: 244.0/255.0, opacity: 1.0), cornerRadius: 10.0) } .padding() .shadow(color: Color.black, radius: 15, x: 2, y: 2) .offset( x: viewState.width + dragState.translation.width // y: viewState.height + dragState.translation.height ) // .animation(.basic(duration: minimumLongPressDuration)) .gesture(longPressDrag) .presentation($showAlert) { Alert(title: Text("User commented on this photo!"), message: Text(commentText), primaryButton: .default(Text("OK")) { commentText = "" self.comment = "" }, secondaryButton: .cancel() ) } // TextField("Leave a comment", text: $comment, onEditingChanged: { if $0 { self.kGuardian.showField = 0 } }) { // commentText = self.comment // } // .padding() // .background(GeometryGetter(rect: $kGuardian.rects[0])) // .background(Color(red: 239.0/255.0, green: 243.0/255.0, blue: 244.0/255.0, opacity: 1.0), cornerRadius: 10.0) }.offset(y: kGuardian.slide).animation(.basic(duration: 1.5)) .padding() .shadow(color: Color.black, radius: 15, x: 2, y: 2) } }
Posted Last updated
.