Hi guys,
I want to put some space between the content and the top of the screen…
I don’t know where exactly I have to write this command in my code, please help me.
Thank you
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
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!
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.
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?
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?
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()
}
}
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
Hello guys, I would like to run my code in a iOS simulator on Swift Playgrounds.
Is it possible to add iPhone simulator there?
Hello everyone,
I would like to a flip animation, so that when I press on the rectangle it will flip to other side (like in a cards game)
How can I do that?
Thank you
Here's my code:
import SwiftUI
import PlaygroundSupport
struct ContentView: View {
var body: some View {
Group {
Button {
} label: {
Rectangle()
.frame(width: 140, height: 170)
.foregroundColor(Color(.systemTeal))
.cornerRadius(20)
}
}
}
}
PlaygroundPage.current.setLiveView(ContentView())
Hello there,
What is the difference between @ObservedObject, ObservableObject and @StateObject in SwiftUI?
Hello everyone,
I was trying to create something in Swift Playgrounds when this error appears, can someone tell me what it means and how can I fix it?
Thanks
Hey there,
I would like to create a card game (I'm following the Stanford University's tutorial) and I want to Scroll the view according to the position of the mouse, like if it's to the top so I would like that it automatically rolls up, so if it's to the down, scroll automatically to the down:
import SwiftUI
import PlaygroundSupport
struct ContentView: View {
var body: some View{
HStack {
CardView()
CardView()
CardView()
CardView()
}
.padding()
.foregroundColor(Color(.systemRed))
}
}
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()
}
}
.onTapGesture(perform: {
isFaceUp = !isFaceUp
})
}
}
PlaygroundPage.current.setLiveView(ContentView())
Hey there, I would like to create a card game (I'm following the Stanford University's tutorial) and I want to Scroll the view according to the position of the mouse, like if it's to the top so I would like that it automatically rolls up, so if it's to the down, scroll automatically to the down:
This is my code:
import SwiftUI
import PlaygroundSupport
struct ContentView: View {
var body: some View{
HStack {
CardView()
CardView()
CardView()
CardView()
}
.padding()
.foregroundColor(Color(.systemRed))
}
}
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()
}
}
.onTapGesture(perform: {
isFaceUp = !isFaceUp
})
}
}
PlaygroundPage.current.setLiveView(ContentView())
Hi there!
I'm trying to create an app which scrolls automatically when my mouse goes to the top of the screen or to the bottom. For example the mouse goes towards the top, it has to scroll to the top and vice versa. So if it possible help me please.
Thanks very much!
I leave you my code:
import SwiftUI
import PlaygroundSupport
struct ContentView: View {
var body: some View{
HStack {
CardView()
CardView()
CardView()
CardView()
}
.padding()
.foregroundColor(Color(.systemRed))
}
}
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()
}
}
.onTapGesture(perform: {
isFaceUp = !isFaceUp
})
}
}
PlaygroundPage.current.setLiveView(ContentView())
Hello everyone!
I have updated my iPhone to iOS 15.2.1 and before this update my phone after the good the sleep mode turns off, it appears a screen with written on it “Good Morning” and the weather. But since I have updated my device to iOS 15.2.1 it isn’t showing me this screen. Is it a feature that Apple has deleted or is this a bug?
Thank you.