So how I can create this button, now?
Post
Replies
Boosts
Views
Activity
Actually I'm a SwiftUI self-taught, and there's no one who can teach me here, but I'd like to learn it so I try to do what I can but that's not enough... I know that copying others' code makes no sense but also there I try to understand how people arrived at that solution, it isn't very easy sometimes...
Oh, that's a great problem... I suggest you to contact Apple in this case, so try to send an email or call them.
Oh ops, now I've defined the Number, but despite it gives me the same warning...
my goal is to change the text "hello" to number 1 when I click on it.
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! Have you updated your Mac to the latest macOS version?
Yes now it is working!!
Thanks very very much for sharing your time with me to resolve this problem 🥰
I’ve downloaded the App Store Connect app on my iPhone and there I’ve inserted my name and Apple ID (the same I used for enrolling to Apple Developer Program) and then it shows me this
So is it connected to App Store Connect or not?
let columns: [GridItem] = [GridItem(.flexible()),
GridItem(.flexible()),
GridItem(.flexible()),
GridItem(.flexible())]
struct ContentView: View {
var body: some View {
GeometryReader { geometry in
VStack{
Spacer(minLength: 290)
ZStack {
LazyVGrid(columns: columns) {
Group {
Button {
} label: {
Circle()
.frame(width: 90, height: 90)
.foregroundColor(Color(.systemBlue))
.opacity(0.5)
}
Button {
} label: {
Circle()
.frame(width: 90, height: 90)
.foregroundColor(Color(.systemBlue))
.opacity(0.5)
}
Button {
} label: {
Circle()
.frame(width: 90, height: 90)
.foregroundColor(Color(.systemBlue))
.opacity(0.5)
}
Button {
} label: {
Circle()
.frame(width: 90, height: 90)
.foregroundColor(Color(.systemBlue))
.opacity(0.5)
}
Button {
} label: {
Circle()
.frame(width: 90, height: 90)
.foregroundColor(Color(.systemBlue))
.opacity(0.5)
}
Button {
} label: {
Circle()
.frame(width: 90, height: 90)
.foregroundColor(Color(.systemBlue))
.opacity(0.5)
}
}
Group {
Button {
} label: {
Circle()
.frame(width: 90, height: 90)
.foregroundColor(Color(.systemBlue))
.opacity(0.5)
}
Button {
} label: {
Circle()
.frame(width: 90, height: 90)
.foregroundColor(Color(.systemBlue))
.opacity(0.5)
}
Button {
} label: {
Circle()
.frame(width: 90, height: 90)
.foregroundColor(Color(.systemBlue))
.opacity(0.5)
}
Button {
} label: {
Circle()
.frame(width: 90, height: 90)
.foregroundColor(Color(.systemBlue))
.opacity(0.5)
}
Button {
} label: {
Circle()
.frame(width: 90, height: 90)
.foregroundColor(Color(.systemBlue))
.opacity(0.5)
}
Button {
} label: {
Circle()
.frame(width: 90, height: 90)
.foregroundColor(Color(.systemBlue))
.opacity(0.5)
}
Button {
} label: {
Rectangle()
.frame(width: 180, height: 80)
.foregroundColor(Color(.systemBlue))
.opacity(0.5)
.cornerRadius(60)
.position(x: 90, y: 44)
}
Spacer()
Button {
} label: {
Circle()
.frame(width: 90, height: 90)
.foregroundColor(Color(.systemBlue))
.opacity(0.5)
}
Button {
} label: {
Circle()
.frame(width: 90, height: 90)
.foregroundColor(Color(.systemBlue))
.opacity(0.5)
}
}
}
}
}
Spacer()
}
}
}
Here's the code, it isn't easy to explain... but if you copy/paste my code you'll notice that there is a frame around the rounded rectangle that I've created and that frame isn't aligned with the "rounded rectangle" so when I try to click on the rounded rectangle, because it is a button, I can't click on any side of it, the click works only if I touch the part that covers the frame.
It is clear, now? Don't worry if you try to paste my code, you'll notice that there is something that isn't working.
GridItem(.flexible()),
GridItem(.flexible())]
struct ContentView: View {
var body: some View {
GeometryReader { geometry in
VStack{
Spacer()
ZStack {
LazyVGrid(columns: columns) {
Group {
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)
}
Group {
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)
.position(x: 114, y: 55)
Circle()
}
}
}
Spacer()
}
}
}
}
You must be over 18 (or over the majority age in your country) to enroll into Apple Developer Program, and in case you're not, you have to enroll with your mother or father's information (so your mother's/father's name, phone number, etc...) when you'll be over the majority of age you can post apps under your name.
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)
.position(x: 114, y: 55)
Circle()
}
}
Spacer()
}
}
}
}
struct contentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
.previewInterfaceOrientation(.portrait)
}
}
In the last Circle(), it shows me Error.