Post

Replies

Boosts

Views

Activity

WWDC22 Special Event
Hello everyone! I had a question about the Apple’s WWDC Special event, hope someone can resolve my doubts. For taking part of this event, will the event for invites be online or we have to go at Cupertino? Because I read some articles that says the event for developers will in-person. Quindi sono un po’ confusa, per favore aiutatemi se riuscite ;)
0
0
1.1k
May ’22
App crashed
Hello there! I was trying to build an app with the new App feature in Swift Playgrounds for Mac. But I have an error message in my code, and I can't understand how to fix it. Can anyone help me to solve this error. Here's the code: import SwiftUI struct Something: View {     let rows = 17     let columns = 17     let size: CGFloat = 10     let blocks: [[Color]] = [[.purple, .purple]]     var body: some View {         VStack {             ForEach((0...self.rows - 1), id: \.self) { row in                  HStack (spacing: 0) {                     ForEach((0...self.columns - 1), id: \.self) { col in                         VStack (spacing: 0) {                             Rectangle()                                 .frame(width: self.size, height: self.size)                                 .foregroundColor(self.blocks[row][col]) // index out of range: the requested index was outside the bounds of the array.                         }                     }                 }             }         }     } }
1
0
856
Jun ’22
Build a website from scratch
Hello developers! I have a question about which programming language is good for building a website. I searched on the internet and it says that CSS and HTML are the most used, so suppose I want to use CSS, now the question is: where can I code to build the website? For example if I want to code in SwiftUI there are some apps (Xcode and Swift Playgrounds) to do it, but how can I do with the website in CSS? If someone has the right answer, please help me. Thanks.
Topic: Safari & Web SubTopic: General Tags:
1
0
1.2k
Aug ’22
Password Animation
Hello guys! I need a little help. I want to create a password animation using SwiftUI, but can't understand how, if you can help me I'll appreciate it a lot. For example when I write something, after I finished the word, it'll turn into points. I hope you understand what I mean. Thanks in advance.
0
0
836
Oct ’22
No profiles founded
Hi friends! I was developing an app, everything was working OK, but when I played the app on my iPhone connecting it via cable to the Mac an error has appeared and it says "The operation couldn't be completed. Unable to log in with account ... " "No profiles for ... were found: Xcode couldn't find any iOS app Development provisioning devices matching ..." and I'm not able to try it on my iPhone. Any suggestion or idea to fix these errors?
0
0
746
Nov ’22
Different position for different elements
Hello guys! In SwiftUI is there a function to show different objects in random order or can I just do this by assigning the coordinates to each individual element? For example, suppose I have a lot of circles, and I want to position them randomly, how can I do it? Thanks in advance.
2
0
759
Apr ’23
Something is not working well
Hey guys! I wanted to place the circles along the screen, I took the screen size with UIScreen.main.bounds, so that the circle did not come out of the edges of the screen, and yet it is still coming out! Would any of you be able to help me on how to make the circle stay within the edges of the screen, please? I'm using SwiftUI and Swift Playgrounds. struct ContentView: View { let screenWidth = UIScreen.main.bounds.width let screenHeight = UIScreen.main.bounds.height var body: some View { Circle() .foregroundColor(.purple) .frame(width: 30, height: 30) .position( x: CGFloat.random(in: 0..<screenWidth), y: CGFloat.random(in: 0..<screenHeight) ) } }
3
0
955
Apr ’23
Device’s Orientation
Hey there! Does anyone know how I can have the same view that I have with the vertical orientation also with the horizontal orientation? Because when I change orientation from the vertical to horizontal it is all upside down, is there a way to fix it?
3
0
935
Apr ’23
URGENT!
Hey guys, I'm having a huge problem and can't understand how to fix it. I was trying to recreate an Xcode app project with a Xcode Playground, now the point is that in Xcode Project on the side of the screen there are the options to add files. Like this: And in the Playground it is like this: But here, when I add the Swift Files under Shared Sources, and create the ContentView() in Main - Xcode Playground, it says me that it can't find the Helicopter, Pixel, Obstacle, so it can't find the Shared Recourses' files. Here's all the code. ContentView(Main): import SwiftUI import PlaygroundSupport struct ContentView: View { @State private var heliPosition = CGPoint(x:100, y: 100) @State private var obstPosition = CGPoint(x:1000, y: 300) @State private var isPaused = false @State private var score = 0 @State var timer = Timer.publish(every: 0.1, on: .main, in: .common).autoconnect() var body: some View { GeometryReader { geo in ZStack{ Helicopter() .position(self.heliPosition) .onReceive(self.timer) {_ in self.gravity() } Obstacle() .position(self.obstPosition) .onReceive(self.timer) {_ in self.obstMove() } Text("\(self.score)") .foregroundColor(.white) .position(x: geo.size.width - 100, y: geo.size.height / 10 ) self.isPaused ? Button("Resume") { self.resume() } : nil } .frame(width: geo.size.width, height: geo.size.height) .background(Color.black) .gesture( TapGesture() .onEnded{ withAnimation{ self.heliPosition.y += 100 } }) .onReceive(self.timer) { _ in self.collisionDetection(); self.score += 1 } } .edgesIgnoringSafeArea(.all) } func gravity() { withAnimation{ self.heliPosition.y -= 20 } } func obstMove() { if self.obstPosition.y > 0 { withAnimation{ self.obstPosition.y -= 20 } } else { self.obstPosition.x = 1000 self.obstPosition.y = CGFloat.random(in: 0...500) } } func pause() { self.timer.upstream.connect().cancel() } func resume() { self.timer = Timer.publish(every: 0.1, on: .main, in: .common).autoconnect() self.obstPosition.x = 1000 self.heliPosition = CGPoint(x: 100, y: 100) self.isPaused = false self.score = 0 } func collisionDetection() { if abs(heliPosition.x - obstPosition.x) < (25 + 10) && abs(heliPosition.y - obstPosition.y) < (25 + 100) { self.pause() self.isPaused = true } } } PlaygroundPage.current.setLiveView(ContentView()) Pixel: import SwiftUI public struct Pixel: View { let size: CGFloat let color: Color public var body: some View { Rectangle() .frame(width: size, height: size) .foregroundColor(color) } } Helicopter: import SwiftUI public struct Helicopter: View { let rows = 5 let columns = 5 let size: CGFloat = 10 let heliBlocks: [[Color]] = [[.gray,.gray,.gray,.gray,.gray], [.clear,.clear,.green,.clear,.clear], [.green,.green,.green,.green,.gray], [.clear,.clear,.green,.green,.green], [.clear,.clear,.gray,.clear,.gray]] public var body: some View { VStack (spacing: 0) { ForEach((0...self.rows - 1), id: \.self) { row in HStack (spacing: 0) { ForEach((0...self.columns - 1), id: \.self) { col in VStack (spacing: 0) { Pixel(size: self.size, color: self.heliBlocks[row][col]) } } } } } } } Obstacle: import SwiftUI public struct Obstacle: View { let width: CGFloat = 20 let height: CGFloat = 200 public var body: some View { Rectangle() .frame(width: width, height: height) .foregroundColor(Color.green) } } Guys please, if anyone knows how to fix this, please help me. I will be grateful to you.
0
0
768
Apr ’23
How to export an Xcode project into a Swift Playgrounds playground
Hello guys! Does anyone know how to export an Xcode app project in na Swift Playgrounds' playground?
Replies
0
Boosts
0
Views
664
Activity
Apr ’22
Neumorphic Button SwiftUI
Hello there! I'm trying to create a button with a neumorphic animation using SwiftUI, with a smooth animation when the user taps it. Something like this: Can someone help me to figure out this, please? Thanks!
Replies
3
Boosts
0
Views
1.1k
Activity
May ’22
WWDC22 Special Event
Hello everyone! I had a question about the Apple’s WWDC Special event, hope someone can resolve my doubts. For taking part of this event, will the event for invites be online or we have to go at Cupertino? Because I read some articles that says the event for developers will in-person. Quindi sono un po’ confusa, per favore aiutatemi se riuscite ;)
Replies
0
Boosts
0
Views
1.1k
Activity
May ’22
App crashed
Hello there! I was trying to build an app with the new App feature in Swift Playgrounds for Mac. But I have an error message in my code, and I can't understand how to fix it. Can anyone help me to solve this error. Here's the code: import SwiftUI struct Something: View {     let rows = 17     let columns = 17     let size: CGFloat = 10     let blocks: [[Color]] = [[.purple, .purple]]     var body: some View {         VStack {             ForEach((0...self.rows - 1), id: \.self) { row in                  HStack (spacing: 0) {                     ForEach((0...self.columns - 1), id: \.self) { col in                         VStack (spacing: 0) {                             Rectangle()                                 .frame(width: self.size, height: self.size)                                 .foregroundColor(self.blocks[row][col]) // index out of range: the requested index was outside the bounds of the array.                         }                     }                 }             }         }     } }
Replies
1
Boosts
0
Views
856
Activity
Jun ’22
Build a website from scratch
Hello developers! I have a question about which programming language is good for building a website. I searched on the internet and it says that CSS and HTML are the most used, so suppose I want to use CSS, now the question is: where can I code to build the website? For example if I want to code in SwiftUI there are some apps (Xcode and Swift Playgrounds) to do it, but how can I do with the website in CSS? If someone has the right answer, please help me. Thanks.
Topic: Safari & Web SubTopic: General Tags:
Replies
1
Boosts
0
Views
1.2k
Activity
Aug ’22
Password Animation
Hello guys! I need a little help. I want to create a password animation using SwiftUI, but can't understand how, if you can help me I'll appreciate it a lot. For example when I write something, after I finished the word, it'll turn into points. I hope you understand what I mean. Thanks in advance.
Replies
0
Boosts
0
Views
836
Activity
Oct ’22
No profiles founded
Hi friends! I was developing an app, everything was working OK, but when I played the app on my iPhone connecting it via cable to the Mac an error has appeared and it says "The operation couldn't be completed. Unable to log in with account ... " "No profiles for ... were found: Xcode couldn't find any iOS app Development provisioning devices matching ..." and I'm not able to try it on my iPhone. Any suggestion or idea to fix these errors?
Replies
0
Boosts
0
Views
746
Activity
Nov ’22
Some questions for the Swift Student Challenge
Hi there! I want to participate in this year'S WWDC's Swift Student Challenge. But I have some doubts. Should my playground be experienced within exactly 3 minutes, or can it last even less? And for the idea, do I necessarily have to create an educational thing, or can it also be something fun? Thanks in advance.
Replies
3
Boosts
0
Views
889
Activity
Apr ’23
What can I use for 2D assets?
Hey guys! Can someone suggest me a free Application for Mac or iPad to create the 2d assets for my project? Thanks.
Replies
3
Boosts
0
Views
836
Activity
Apr ’23
Different position for different elements
Hello guys! In SwiftUI is there a function to show different objects in random order or can I just do this by assigning the coordinates to each individual element? For example, suppose I have a lot of circles, and I want to position them randomly, how can I do it? Thanks in advance.
Replies
2
Boosts
0
Views
759
Activity
Apr ’23
Something is not working well
Hey guys! I wanted to place the circles along the screen, I took the screen size with UIScreen.main.bounds, so that the circle did not come out of the edges of the screen, and yet it is still coming out! Would any of you be able to help me on how to make the circle stay within the edges of the screen, please? I'm using SwiftUI and Swift Playgrounds. struct ContentView: View { let screenWidth = UIScreen.main.bounds.width let screenHeight = UIScreen.main.bounds.height var body: some View { Circle() .foregroundColor(.purple) .frame(width: 30, height: 30) .position( x: CGFloat.random(in: 0..<screenWidth), y: CGFloat.random(in: 0..<screenHeight) ) } }
Replies
3
Boosts
0
Views
955
Activity
Apr ’23
Device’s Orientation
Hey there! Does anyone know how I can have the same view that I have with the vertical orientation also with the horizontal orientation? Because when I change orientation from the vertical to horizontal it is all upside down, is there a way to fix it?
Replies
3
Boosts
0
Views
935
Activity
Apr ’23
URGENT!
Hey guys, I'm having a huge problem and can't understand how to fix it. I was trying to recreate an Xcode app project with a Xcode Playground, now the point is that in Xcode Project on the side of the screen there are the options to add files. Like this: And in the Playground it is like this: But here, when I add the Swift Files under Shared Sources, and create the ContentView() in Main - Xcode Playground, it says me that it can't find the Helicopter, Pixel, Obstacle, so it can't find the Shared Recourses' files. Here's all the code. ContentView(Main): import SwiftUI import PlaygroundSupport struct ContentView: View { @State private var heliPosition = CGPoint(x:100, y: 100) @State private var obstPosition = CGPoint(x:1000, y: 300) @State private var isPaused = false @State private var score = 0 @State var timer = Timer.publish(every: 0.1, on: .main, in: .common).autoconnect() var body: some View { GeometryReader { geo in ZStack{ Helicopter() .position(self.heliPosition) .onReceive(self.timer) {_ in self.gravity() } Obstacle() .position(self.obstPosition) .onReceive(self.timer) {_ in self.obstMove() } Text("\(self.score)") .foregroundColor(.white) .position(x: geo.size.width - 100, y: geo.size.height / 10 ) self.isPaused ? Button("Resume") { self.resume() } : nil } .frame(width: geo.size.width, height: geo.size.height) .background(Color.black) .gesture( TapGesture() .onEnded{ withAnimation{ self.heliPosition.y += 100 } }) .onReceive(self.timer) { _ in self.collisionDetection(); self.score += 1 } } .edgesIgnoringSafeArea(.all) } func gravity() { withAnimation{ self.heliPosition.y -= 20 } } func obstMove() { if self.obstPosition.y > 0 { withAnimation{ self.obstPosition.y -= 20 } } else { self.obstPosition.x = 1000 self.obstPosition.y = CGFloat.random(in: 0...500) } } func pause() { self.timer.upstream.connect().cancel() } func resume() { self.timer = Timer.publish(every: 0.1, on: .main, in: .common).autoconnect() self.obstPosition.x = 1000 self.heliPosition = CGPoint(x: 100, y: 100) self.isPaused = false self.score = 0 } func collisionDetection() { if abs(heliPosition.x - obstPosition.x) < (25 + 10) && abs(heliPosition.y - obstPosition.y) < (25 + 100) { self.pause() self.isPaused = true } } } PlaygroundPage.current.setLiveView(ContentView()) Pixel: import SwiftUI public struct Pixel: View { let size: CGFloat let color: Color public var body: some View { Rectangle() .frame(width: size, height: size) .foregroundColor(color) } } Helicopter: import SwiftUI public struct Helicopter: View { let rows = 5 let columns = 5 let size: CGFloat = 10 let heliBlocks: [[Color]] = [[.gray,.gray,.gray,.gray,.gray], [.clear,.clear,.green,.clear,.clear], [.green,.green,.green,.green,.gray], [.clear,.clear,.green,.green,.green], [.clear,.clear,.gray,.clear,.gray]] public var body: some View { VStack (spacing: 0) { ForEach((0...self.rows - 1), id: \.self) { row in HStack (spacing: 0) { ForEach((0...self.columns - 1), id: \.self) { col in VStack (spacing: 0) { Pixel(size: self.size, color: self.heliBlocks[row][col]) } } } } } } } Obstacle: import SwiftUI public struct Obstacle: View { let width: CGFloat = 20 let height: CGFloat = 200 public var body: some View { Rectangle() .frame(width: width, height: height) .foregroundColor(Color.green) } } Guys please, if anyone knows how to fix this, please help me. I will be grateful to you.
Replies
0
Boosts
0
Views
768
Activity
Apr ’23
Drag & Drop SwiftUI
Hi all! Does anyone know how can I drag and drop on a precise location in SwiftUI? I mean suppose I have a lots of circles and the circles with same color they must go in the same box. How can I do it?
Replies
0
Boosts
0
Views
797
Activity
Apr ’23
Array of UIImages
Hi guys! I want to know how can I create an array of UIImage elements and then access these elements randomly? I tried several times, but I have this issue: Can someone help me?
Replies
1
Boosts
0
Views
810
Activity
Jan ’24