Post

Replies

Boosts

Views

Activity

Print something on the screen
Hello there! I would like to print the number 5 on the screen when I click the Button, but I don't know how I can do it... if I write print("5") it prints me the number 5 in the debug area of Xcode. Can someone help me to figure out this? Here's may code Thanks a lot Button {         } label: {             ZStack {                 Circle()                     .frame(width: 90, height: 90)                     .foregroundColor(Color(.systemBlue))                     .opacity(0.5)                                     Text("5")                     .font(.largeTitle)                     .bold()                     .foregroundColor(.black)             }             .frame(width: 90, height: 90)         }
9
0
939
Dec ’21
Text background color
Hi guys do you know how to change the text background color in SwiftUI? .foregroundColor() changes the text color .background(Color) changes all the background's color So which is the command that changes only the text background color? Thanks
4
0
4.6k
Dec ’21
Create a button
Hello everyone. I would like to create a button in SwiftUI, which initially will display some text and with the click of the user will transform to a number (like initially the button displays "click me to add a number" and when I click on it'll immediately displays number "1" ). Can anyone help me with how to do this? Thanks
4
0
512
Dec ’21
Result of 'Text' initializer is unused
Hi, in this code it gives me the warning "Result of 'Text' initializer is unused" near Text("(Number)"). Does someone know what exactly mean this warning and how can I fix it? Thanks in advance struct NewView: View {     var body: some View {         Button {             tapped()         } label: {             Text("hello")         }     } }               func tapped() {     Text("\(Number)") } struct NewView_Previews: PreviewProvider {     static var previews: some View {         NewView()     } }
6
0
4.5k
Dec ’21
Result of 'Text' initializer is unused
Hello there, I'm trying to create a button with it initially written "hello", then when I click on the button I would like the 'hello' to become a number. I already defined the variable (var Number = 1) and then I called Text("(Number)"). But when I recall the variable, ‘hello’ must change to number 1. It gives me this warning "Result of 'Text' initializer is unused" near Text("(Number)") under the func tapped()... and the text doesn't change. Here's my code: var Number = 1 struct NewView: View {     var body: some View {         Button {             tapped()         } label: {             Text("hello")         }     } }               func tapped() {     Text("\(Number)") } struct NewView_Previews: PreviewProvider {     static var previews: some View {         NewView()     } }
0
0
346
Dec ’21
Apple Developer Membership is activated
Hi, I heard that Apple will send me an email saying that my Apple developer membership is activated, with the confirmation and I can start exporting and publishing apps, but to me came 3 emails: welcome to the Apple Developer Program App Store connect good news! Your receipt for order — is ready But there isn’t any confirmation email, so how can I know if I can start posting my apps to App Store?
2
0
438
Dec ’21
Apple Developer Membership is activated
Hi, I heard that Apple will send me an email saying that my Apple developer membership is activated, with the confirmation and I can start exporting and publishing apps, but to me came 3 emails: welcome to the Apple Developer Program App Store connect good news! Your receipt for order — is ready But there isn’t any confirmation email, so how can I know if I can start posting my apps to App Store?
0
0
305
Dec ’21
Change the position of a shape
Hi everyone, do you know the command to change the position of a shape. I want to change the position of a Rectangle and draw it to the right, this was the code that I tried: But it shows me that blue frame around and when I click on it (since it is a button) I can’t click outside that frame. Please help me… Thank you in advance ;)
5
0
1.9k
Dec ’21
Forum full of spammers
Hello Apple, I would like to say that the forum is really full of spam messages saying “call” “girls” please provide to delete them because they’re very irritating. I really think that this space is for developers, for who has some doubts and so they can receive help, but despite there are some people like the spammers who doesn’t care about anything. Please Apple help us.
3
0
587
Dec ’21
How to change position of a shape
Hello guys! I would like to change the position of a shape but I can't understand which command I have to put in the code so that the square will be to the right. let columns: [GridItem] = [GridItem(.flexible()),                            GridItem(.flexible()),                            GridItem(.flexible())] struct ContentView: View {     var body: some View {         GeometryReader { geometry in             VStack{                 Spacer()                 ZStack {                     LazyVGrid(columns: columns) {                         Circle()                             .frame(width: 100, height: 100)                             .foregroundColor(Color(.systemBlue))                             .opacity(0.5)                         Circle()                             .frame(width: 100, height: 100)                             .foregroundColor(Color(.systemBlue))                             .opacity(0.5)                         Circle()                             .frame(width: 100, height: 100)                             .foregroundColor(Color(.systemBlue))                             .opacity(0.5)                         Circle()                             .frame(width: 100, height: 100)                             .foregroundColor(Color(.systemBlue))                             .opacity(0.5)                         Circle()                             .frame(width: 100, height: 100)                             .foregroundColor(Color(.systemBlue))                             .opacity(0.5)                         Circle()                             .frame(width: 100, height: 100)                             .foregroundColor(Color(.systemBlue))                             .opacity(0.5)                         Circle()                             .frame(width: 100, height: 100)                             .foregroundColor(Color(.systemBlue))                             .opacity(0.5)                         Circle()                             .frame(width: 100, height: 100)                             .foregroundColor(Color(.systemBlue))                             .opacity(0.5)                         Circle()                             .frame(width: 100, height: 100)                             .foregroundColor(Color(.systemBlue))                             .opacity(0.5)                             Rectangle()                                 .frame(width: 200, height: 80)                                 .foregroundColor(Color(.systemBlue))                                 .opacity(0.5)                                 .cornerRadius(60)                     }                 }                 Spacer()             }         }              } } Of course if I did something wrong, please tell me... Thank u, have a great day!
0
0
322
Dec ’21
Can I draw other shaper in Xcode?
Hello world, can I draw something else in Xcode, like when I write Circle(), it draws me a circle in the screen, or when I write Rectangle(), it appear a rectangle in the simulator... So are there other commands to draw some different shapes like this or I can elusively use these ones? Thank you.
1
0
399
Dec ’21