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.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Created
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?
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?
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.
Hey guys!
Can someone suggest me a free Application for Mac or iPad to create the 2d assets for my project?
Thanks.
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.
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)
)
}
}
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?
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.
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?
Hello everyone,
I was working on a Xcode playground, and unexpectedly it appeared an error that I can't understand how to fix.
Here's the error that I'm facing.
Does someone know how to fix it?
Thanks in advance ;)
Hi there,
I'm studying SwiftUI on my own, but unfortunately I'm still not able to write complex lines of code, or even code an app independently, which is very frustrating for me.
I love coding, it's a way to express my creativity.
I already have a lot of ideas, but I can't put them into practice because I feel like I don't have learned enough about this programming language.
Can any of you suggest me some free courses or other resources that have also helped you in your first steps with coding?
Hello and happy new year to all!
I've updated Xcode but I'm having a problem installing the iOS 17.2 Simulator.
It's the 4th time I'm trying to download it, but it gives me this error:
I've also download watchOS which is successfully installed, but I can't understand why only iOS is having some issues.
If someone knows how to fix this issue, please help me, I'm unable to use Xcode without the iOS simulator :(
Thanks in advance.
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?
Hi everyone!
import SwiftUI
struct ContentView: View {
let screenHeight = UIScreen.main.bounds.height
let letters: [String] = ["A", "B"]
@State private var yOffset: CGFloat = 0.0
var body: some View {
ForEach(letters, id: \.self) { letter in
Text(letter)
.padding()
.font(.largeTitle)
.offset(x: 0, y: yOffset)
.animation(Animation.linear(duration: 5.0).repeatForever(autoreverses: false))
.onAppear {
yOffset = screenHeight - 90
}
}
}
}
I would like in this code, the letters to fall from the beginning of the screen to its end, I have the size of screen's height, but actually I can't understand how I can I use it, until the letters can start from the beginning of the screen. And I would also like that once they reach the bottom, they start falling again...
I can't understand how this effect can be achieved, is there anyone who can help me?