Education

RSS for tag

Teach students of all ages to code in Swift using a variety of resources in your curriculum.

Posts under Education tag

117 Posts

Post

Replies

Boosts

Views

Activity

Ive created a login view but as soon as I leave that view all the textfield and password field is empty.
I want the details entered in textfield and password should stay even after changing the view or closing the app and the person should be logged in even after he closes the app, Can anyone help me out? import SwiftUI import Firebase struct login: View {     @State var chec:String=""     @State var email:String=""     @State var navigated = false     @State var loggedin:Bool=false     @State var pass:String=""     @State private var secured:Bool=true     var body: some View     {                 VStack                 {                     if(loggedin==true)                     {                     Image("logo")                         .resizable()                         .clipShape(Circle())                         .shadow(color:.green,radius: 10)                         .frame(width: 200, height: 200, alignment: .center)                     }                     else                     {                         Image("logo")                             .resizable()                             .clipShape(Circle())                             .shadow(color:.red,radius: 10)                             .frame(width: 200, height: 200, alignment: .center)                     }                     Spacer(minLength: 50.0)                     Text(chec)                         .foregroundColor(.red)                     HStack                     {                         Text("E-mail:")                         TextField("", text:$email)                             .foregroundColor(.white)                             .frame(width: 275)                             .textFieldStyle(.roundedBorder)                             .autocapitalization(.none)                             .disableAutocorrection(true)                     }                         HStack                         {                         Text("Password:")                             if secured                             {                                 SecureField("",text:$pass)                                     .background(Color.black)                                     .foregroundColor(.white)                                     .textFieldStyle(.roundedBorder)                                     .autocapitalization(.none)                                     .disableAutocorrection(true)                             }                             else                             {                                 TextField("",text: $pass)                                     .background(Color.black)                                     .foregroundColor(.white)                                     .textFieldStyle(.roundedBorder)                                     .autocapitalization(.none)                                     .disableAutocorrection(true)                             }                             Button(action: {self.secured.toggle()})                             {                                 if secured                                 {                                     Image(systemName:"eye.slash")                                 }                                 else                                 {                                     Image(systemName:"eye")                                 }                             }.buttonStyle(BorderlessButtonStyle())                         }                     VStack{                         Button(action: {                             if(email==""&&pass=="")                             {                                 chec="Enter E-mail and Password"                             }                             else if(pass=="")                             {                                 chec="Enter Password"                             }                             else if(email=="")                             {                                 chec="Enter E-mail"                             }                             guard !email.isEmpty,!pass.isEmpty else                         {                             return                         }                             loginfunc()                         }){                             Text("Login")                         }                         NavigationLink(destination: signup(),label:{Text("Not Yet signed? Create new account")})                             .padding(.top, 3.0)                     }                     .padding()                     Spacer(minLength: 400)                 }                      }     func loginfunc(){         Auth.auth().signIn(withEmail: email, password: pass) { result, error in             if error != nil{                 print(error?.localizedDescription ?? "")                 loggedin=false                 chec="E-mail or Password wrong!"             }else {                 print("success")                 loggedin=true             }             if(loggedin==true)             {                 chec=""                 print("wow so nice to get work done")             }         }     } } //} struct ButtonView: View {     var buttext:String     var body: some View {         Text(buttext)         .frame(width: 200, height: 100, alignment: .center)         .background(Color.black)         .foregroundColor(Color.white)     } } struct login_Previews: PreviewProvider {     static var previews: some View {         login()             .environment(\.colorScheme, .dark)     } }
1
0
947
Mar ’22
I tried using multilinetextalignment but my text is not aligning on left of iPhone screen, what is the reason for it?
import SwiftUI struct lastview: View {     var img:UIImage     var texty:String     var body: some View {         ScrollView(.vertical){         Image(uiImage: img)             .resizable()             .frame(width: 500, height: 500, alignment: .center)             Text(texty)                 .multilineTextAlignment(.leading)                          }     } }
1
0
1.1k
Mar ’22
I used array to print image. but I also want to print text with the images using array how can I use it ,like I want to use same tray but want to print different text with their images using the same array like 2D array.
import SwiftUI struct menjeans: View {     var menje:[UIImage] =         [UIImage(named:"IMG_9917")!,         UIImage(named:"IMG_9920")!,         UIImage(named:"IMG_9923")!]     let layout=[GridItem(.flexible()),GridItem(.flexible())]     var body: some View     {         NavigationView         {             ScrollView(.vertical)             {             LazyVGrid(columns: layout,spacing: 2)                 {                 ForEach(menje, id: .self)                     {                     imager in                         maincustom(content: Image(uiImage:imager), text: "df")                     }                     .navigationBarTitle("Men")                 }             }         }     } } struct menjeans_Previews: PreviewProvider {     static var previews: some View {         menjeans()     } }
0
0
1.1k
Feb ’22
"code in Objective-C to maintain"
I am learning Swift and when I was casually browsing for job openings to see what the employers expect one thing caught my eyes. It says something like, In addition to Swift, "code in Objective-C to maintain" What does that mean? If I learn Swift and have a good understanding, will learning and using Obj-C be easier? Is it a common requirement for iOS/macOS developers? Appreciate your time!
1
0
553
Jan ’22
Developer Site Changes Doc?
There are many nice changes here in recent years. Is there a document or page that outlines and explains the changes to the Developer portal that resulted in the excellent Document Archive no longer being maintained? https://developer.apple.com/library/archive/navigation/# Is there currently a reliable way to search for all of the newer sample code and documents within one list/view?
0
0
652
Nov ’21
Guided Project-Apple Pie: How to use map method in place of loop?
I’m going through Develop in Swift Fundamentals and I’m stuck at a problem where it says “Learn about the map method, and use it in place of the loop that converts the array of characters to an array of strings in updateUI().” Here’s the code:  var letters = [String]() for letter in currentGame.formattedWord { letters.append(String(letter)) } Thanks in advance.
1
0
1.2k
Sep ’21
Paid version(School Edition) of my free app got rejected
I have a kids / education app in the store. My app is free with limited functionality and users need to buy in-app purchase option for upgrade. Recently I got some emails from school / institutions asking if they could get the upgrade version app via School Manager. It seems like it's impossible to buy in-app purchase in bulk via School Manager. (Please correct me if I'm wrong about this.) So I built and submitted a separate paid version of my app with "School Edition" added to the name and no in-app purchase. But this app got rejected with the following message. "This app duplicates the content and functionality of other apps submitted by you or another developer to the App Store, which is considered a form of spam." I replied that many other developers are doing the same approach and they are live on the app store. They gave me a short answer saying that they can't provide feedback on app concept and I need to review the guidelines. I know there have been many apps that had both Lite (free) and Pro (paid) version. And there are still many apps that have the same approach such as MathTango. MathTango https://apps.apple.com/us/app/mathtango/id1234698308 https://apps.apple.com/us/app/mathtango-school-edition/id1333842226 Is there anyone else who had the similar issue or who could give some advice on this?
0
0
864
Sep ’21
Hi I am getting a blank screen when I run the following code in my Xcode project
// //  ContentView.swift //  NewsReader // //  Created by Rashid  Vohra on 7/7/21. // import SwiftUI struct Result: Codable {     var articles: [Article] } struct Article: Codable {     var url: String     var title: String     var description: String?     var urlToImage: String? } struct ContentView: View {     private let url = "https://newsapi.org/v2/top-headlines?country=us&category=business&apiKey=49d5bfa113c34ec0af781fab38395996"               @State private var articles = [ Article ()          func fetchData() {         guard let url = URL(string: url) else {             print("URL is not valid")             return         }                  let request = URLRequest(url: url)                  URLSession.shared.dataTask(with: request) {             data, response, error in             if let data = data {                 if let decodedResult = try?                     JSONDecoder().decode(                         Result.self, from: data) {                                          DispatchQueue.main.async {                                                self.articles =                             decodedResult.articles                     }                     return                 }             }             print ("Error: (error?.localizedDescription ?? "Unknown Error") ")         }.resume()     }          var body: some View {                           List(articles, id: .url) { item in             HStack(alignment: .top) {                                 VStack(alignment: .leading) {                     Text(item.title)                         .font(.headline)                     Text(item.description ?? "")                         .font(.footnote)                 }             }.onAppear(perform: fetchData)         }     } } struct ContentView_Previews: PreviewProvider {     static var previews: some View {         ContentView()     } }
2
0
1.1k
Aug ’21
Right to left page transition in swift ui using navigation link
I am using navigation link to navigate using a button which is log out button when i click the button it takes me straight to login page i want the transition effect of the page to start from right to left instead of the opposite which is occurring              NavigationLink("", destination: login(),isActive: $goWhenTrue)           Button (action: { print("Button Tapped")}, label: {               Text("LogOut")                 .font(.headline)                 .foregroundColor(.white)                 .frame(width: 340, height: 50)                 .background(Color.blue)                 .clipShape(Capsule())                 .padding()                 .onTapGesture {                                       self.goWhenTrue = true                   if ((UserDefaults.standard.string(forKey: "Username") != nil)) {                     UserDefaults.standard.removeObject(forKey: "Username")
0
0
1.1k
Aug ’21
Develop in Swift build a bouncy ball game
I've been learning how to code swift with "Develop in Swift" by Apple, and it has been great! However, I have a problem, I made a function, and it gives me an error on lines 78, 80, and 121. Can someone explain my error? Thank you for your time. var barriers: [Shape] = [] let ball = OvalShape(width: 40, height:40) let barrierWidth = 300.0 let barrierHeight = 25.0 let barrierPoints = [     Point(x:0, y:0),     Point(x:0, y:barrierHeight),     Point(x:barrierWidth, y:barrierHeight),     Point(x:barrierWidth, y:0) ] let barrier = PolygonShape(points:barrierPoints) let funnelPoints = [     Point(x:0, y:50),     Point(x:80, y:50),     Point(x:60, y:0),     Point(x:20, y:0) ] let funnel = PolygonShape(points:funnelPoints) let targetPoints=[     Point(x:10, y:0),     Point(x:0, y:10),     Point(x:10, y:20),     Point(x:20, y:10) ] let target = PolygonShape(points:targetPoints) func setUpTarget(){     target.position = Point(x:200, y:400)     target.hasPhysics = true     target.isImmobile = true     target.isImpermeable = false     target.fillColor = .yellow     target.name = "Target"     //target.isDraggable = false          scene.add(target)      } /* The setup() function is called once when the app launches. Without it, your app won't compile. Use it to set up and start your app. You can create as many other functions as you want, and declare variables and constants, at the top level of the file (outside any function). You can't write any other kind of code, for example if statements and for loops, at the top level; they have to be written inside of a function. */ fileprivate func setUpBall() {     ball.position = Point(x: 250, y:400)     scene.add(ball)     ball.hasPhysics = true     ball.fillColor = .blue     ball.onCollision = ballCollided(with:)     ball.isDraggable = false     scene.trackShape(ball)     ball.onExitedScene = ballExitedScene     ball.onTapped = resetGame     ball.bounciness = 0.6 } fileprivate func addBarrier(at position: Point, width: Double, height: Double, angle: Double){     //Add a barrier to the scene.     let barrierPoints = [         Point:(x: 0, y: 0),         Point:(x: 0, y: height),         Point(x: width, y: height),         Point(x: width, y: 0)     ]     let barrier = PolygonShape(points:barrierPoints)     barrier.append(barrier)          barrier.position = Point(x:200, y:150)     barrier.hasPhysics = true     scene.add(barrier)     barrier.isImmobile = true     barrier.angle = 0.1 } fileprivate func setUpFunnel() {     //Adds a funnel to the scene     funnel.position = Point(x:200, y:scene.height - 25)     scene.add(funnel)     funnel.onTapped = dropBall     funnel.isDraggable = false } func ballCollided(with otherShape: Shape){     if otherShape.name != "Target"{return}          otherShape.fillColor = .green } func ballExitedScene (){     barrier.isDraggable = true } func resetGame (){     ball.position = Point(x:0, y:-80) } func printPosition(of shape: Shape){     print(shape.position) } func setup() {          setUpBall()          addBarrier()          setUpFunnel()          setUpTarget()          resetGame()          scene.onShapeMoved = printPosition(of:)           } func dropBall() {     ball.position = funnel.position     ball.stopAllMotion()     barrier.isDraggable = false }
1
1
1.4k
Aug ’21
Checking for characters
I'm having trouble coding this. I'm learning swift via develop with swift by Apple, and when I try to code this, it stop at "Please add a digit." Can someone explain what I'm doing wrong? Thanks! let tenMostCommonPasswords = [     "123456",     "password",     "12345678",     "qwerty",     "12345",     "123456789",     "letmein",     "1234567",     "football",     "iloveyou" ] let digits = "0123456789" let punctuation = "!@#$%^&*(),.<>;'`~[]{}\|/?_-+= " let password = "Pasword12!" for _ in tenMostCommonPasswords{    if tenMostCommonPasswords.contains(password){     print("Please change your password")    }    else{     for _ in digits{         if digits.contains(password){             for _ in punctuation{                 if punctuation.contains(password){                     print("You're good to go!")                 }                 else{                     print("Please add a punctuation")                 }             }         }         else{             print("Please add a digit.")         }     }    } }
1
0
852
Aug ’21
Ive created a login view but as soon as I leave that view all the textfield and password field is empty.
I want the details entered in textfield and password should stay even after changing the view or closing the app and the person should be logged in even after he closes the app, Can anyone help me out? import SwiftUI import Firebase struct login: View {     @State var chec:String=""     @State var email:String=""     @State var navigated = false     @State var loggedin:Bool=false     @State var pass:String=""     @State private var secured:Bool=true     var body: some View     {                 VStack                 {                     if(loggedin==true)                     {                     Image("logo")                         .resizable()                         .clipShape(Circle())                         .shadow(color:.green,radius: 10)                         .frame(width: 200, height: 200, alignment: .center)                     }                     else                     {                         Image("logo")                             .resizable()                             .clipShape(Circle())                             .shadow(color:.red,radius: 10)                             .frame(width: 200, height: 200, alignment: .center)                     }                     Spacer(minLength: 50.0)                     Text(chec)                         .foregroundColor(.red)                     HStack                     {                         Text("E-mail:")                         TextField("", text:$email)                             .foregroundColor(.white)                             .frame(width: 275)                             .textFieldStyle(.roundedBorder)                             .autocapitalization(.none)                             .disableAutocorrection(true)                     }                         HStack                         {                         Text("Password:")                             if secured                             {                                 SecureField("",text:$pass)                                     .background(Color.black)                                     .foregroundColor(.white)                                     .textFieldStyle(.roundedBorder)                                     .autocapitalization(.none)                                     .disableAutocorrection(true)                             }                             else                             {                                 TextField("",text: $pass)                                     .background(Color.black)                                     .foregroundColor(.white)                                     .textFieldStyle(.roundedBorder)                                     .autocapitalization(.none)                                     .disableAutocorrection(true)                             }                             Button(action: {self.secured.toggle()})                             {                                 if secured                                 {                                     Image(systemName:"eye.slash")                                 }                                 else                                 {                                     Image(systemName:"eye")                                 }                             }.buttonStyle(BorderlessButtonStyle())                         }                     VStack{                         Button(action: {                             if(email==""&&pass=="")                             {                                 chec="Enter E-mail and Password"                             }                             else if(pass=="")                             {                                 chec="Enter Password"                             }                             else if(email=="")                             {                                 chec="Enter E-mail"                             }                             guard !email.isEmpty,!pass.isEmpty else                         {                             return                         }                             loginfunc()                         }){                             Text("Login")                         }                         NavigationLink(destination: signup(),label:{Text("Not Yet signed? Create new account")})                             .padding(.top, 3.0)                     }                     .padding()                     Spacer(minLength: 400)                 }                      }     func loginfunc(){         Auth.auth().signIn(withEmail: email, password: pass) { result, error in             if error != nil{                 print(error?.localizedDescription ?? "")                 loggedin=false                 chec="E-mail or Password wrong!"             }else {                 print("success")                 loggedin=true             }             if(loggedin==true)             {                 chec=""                 print("wow so nice to get work done")             }         }     } } //} struct ButtonView: View {     var buttext:String     var body: some View {         Text(buttext)         .frame(width: 200, height: 100, alignment: .center)         .background(Color.black)         .foregroundColor(Color.white)     } } struct login_Previews: PreviewProvider {     static var previews: some View {         login()             .environment(\.colorScheme, .dark)     } }
Replies
1
Boosts
0
Views
947
Activity
Mar ’22
I tried using multilinetextalignment but my text is not aligning on left of iPhone screen, what is the reason for it?
import SwiftUI struct lastview: View {     var img:UIImage     var texty:String     var body: some View {         ScrollView(.vertical){         Image(uiImage: img)             .resizable()             .frame(width: 500, height: 500, alignment: .center)             Text(texty)                 .multilineTextAlignment(.leading)                          }     } }
Replies
1
Boosts
0
Views
1.1k
Activity
Mar ’22
Swift Challenge
Hi guys I want to participate in the Swift Student Challenge this year. Any suggestions on how to prepare for it?
Replies
1
Boosts
0
Views
762
Activity
Feb ’22
I used array to print image. but I also want to print text with the images using array how can I use it ,like I want to use same tray but want to print different text with their images using the same array like 2D array.
import SwiftUI struct menjeans: View {     var menje:[UIImage] =         [UIImage(named:"IMG_9917")!,         UIImage(named:"IMG_9920")!,         UIImage(named:"IMG_9923")!]     let layout=[GridItem(.flexible()),GridItem(.flexible())]     var body: some View     {         NavigationView         {             ScrollView(.vertical)             {             LazyVGrid(columns: layout,spacing: 2)                 {                 ForEach(menje, id: .self)                     {                     imager in                         maincustom(content: Image(uiImage:imager), text: "df")                     }                     .navigationBarTitle("Men")                 }             }         }     } } struct menjeans_Previews: PreviewProvider {     static var previews: some View {         menjeans()     } }
Replies
0
Boosts
0
Views
1.1k
Activity
Feb ’22
"code in Objective-C to maintain"
I am learning Swift and when I was casually browsing for job openings to see what the employers expect one thing caught my eyes. It says something like, In addition to Swift, "code in Objective-C to maintain" What does that mean? If I learn Swift and have a good understanding, will learning and using Obj-C be easier? Is it a common requirement for iOS/macOS developers? Appreciate your time!
Replies
1
Boosts
0
Views
553
Activity
Jan ’22
Developer Site Changes Doc?
There are many nice changes here in recent years. Is there a document or page that outlines and explains the changes to the Developer portal that resulted in the excellent Document Archive no longer being maintained? https://developer.apple.com/library/archive/navigation/# Is there currently a reliable way to search for all of the newer sample code and documents within one list/view?
Replies
0
Boosts
0
Views
652
Activity
Nov ’21
C# on terminal
which are the commands to compile and execute C # in the terminal
Replies
0
Boosts
0
Views
566
Activity
Sep ’21
Guided Project-Apple Pie: How to use map method in place of loop?
I’m going through Develop in Swift Fundamentals and I’m stuck at a problem where it says “Learn about the map method, and use it in place of the loop that converts the array of characters to an array of strings in updateUI().” Here’s the code:  var letters = [String]() for letter in currentGame.formattedWord { letters.append(String(letter)) } Thanks in advance.
Replies
1
Boosts
0
Views
1.2k
Activity
Sep ’21
Paid version(School Edition) of my free app got rejected
I have a kids / education app in the store. My app is free with limited functionality and users need to buy in-app purchase option for upgrade. Recently I got some emails from school / institutions asking if they could get the upgrade version app via School Manager. It seems like it's impossible to buy in-app purchase in bulk via School Manager. (Please correct me if I'm wrong about this.) So I built and submitted a separate paid version of my app with "School Edition" added to the name and no in-app purchase. But this app got rejected with the following message. "This app duplicates the content and functionality of other apps submitted by you or another developer to the App Store, which is considered a form of spam." I replied that many other developers are doing the same approach and they are live on the app store. They gave me a short answer saying that they can't provide feedback on app concept and I need to review the guidelines. I know there have been many apps that had both Lite (free) and Pro (paid) version. And there are still many apps that have the same approach such as MathTango. MathTango https://apps.apple.com/us/app/mathtango/id1234698308 https://apps.apple.com/us/app/mathtango-school-edition/id1333842226 Is there anyone else who had the similar issue or who could give some advice on this?
Replies
0
Boosts
0
Views
864
Activity
Sep ’21
Hi I am getting a blank screen when I run the following code in my Xcode project
// //  ContentView.swift //  NewsReader // //  Created by Rashid  Vohra on 7/7/21. // import SwiftUI struct Result: Codable {     var articles: [Article] } struct Article: Codable {     var url: String     var title: String     var description: String?     var urlToImage: String? } struct ContentView: View {     private let url = "https://newsapi.org/v2/top-headlines?country=us&category=business&apiKey=49d5bfa113c34ec0af781fab38395996"               @State private var articles = [ Article ()          func fetchData() {         guard let url = URL(string: url) else {             print("URL is not valid")             return         }                  let request = URLRequest(url: url)                  URLSession.shared.dataTask(with: request) {             data, response, error in             if let data = data {                 if let decodedResult = try?                     JSONDecoder().decode(                         Result.self, from: data) {                                          DispatchQueue.main.async {                                                self.articles =                             decodedResult.articles                     }                     return                 }             }             print ("Error: (error?.localizedDescription ?? "Unknown Error") ")         }.resume()     }          var body: some View {                           List(articles, id: .url) { item in             HStack(alignment: .top) {                                 VStack(alignment: .leading) {                     Text(item.title)                         .font(.headline)                     Text(item.description ?? "")                         .font(.footnote)                 }             }.onAppear(perform: fetchData)         }     } } struct ContentView_Previews: PreviewProvider {     static var previews: some View {         ContentView()     } }
Replies
2
Boosts
0
Views
1.1k
Activity
Aug ’21
Right to left page transition in swift ui using navigation link
I am using navigation link to navigate using a button which is log out button when i click the button it takes me straight to login page i want the transition effect of the page to start from right to left instead of the opposite which is occurring              NavigationLink("", destination: login(),isActive: $goWhenTrue)           Button (action: { print("Button Tapped")}, label: {               Text("LogOut")                 .font(.headline)                 .foregroundColor(.white)                 .frame(width: 340, height: 50)                 .background(Color.blue)                 .clipShape(Capsule())                 .padding()                 .onTapGesture {                                       self.goWhenTrue = true                   if ((UserDefaults.standard.string(forKey: "Username") != nil)) {                     UserDefaults.standard.removeObject(forKey: "Username")
Replies
0
Boosts
0
Views
1.1k
Activity
Aug ’21
Develop in Swift build a bouncy ball game
I've been learning how to code swift with "Develop in Swift" by Apple, and it has been great! However, I have a problem, I made a function, and it gives me an error on lines 78, 80, and 121. Can someone explain my error? Thank you for your time. var barriers: [Shape] = [] let ball = OvalShape(width: 40, height:40) let barrierWidth = 300.0 let barrierHeight = 25.0 let barrierPoints = [     Point(x:0, y:0),     Point(x:0, y:barrierHeight),     Point(x:barrierWidth, y:barrierHeight),     Point(x:barrierWidth, y:0) ] let barrier = PolygonShape(points:barrierPoints) let funnelPoints = [     Point(x:0, y:50),     Point(x:80, y:50),     Point(x:60, y:0),     Point(x:20, y:0) ] let funnel = PolygonShape(points:funnelPoints) let targetPoints=[     Point(x:10, y:0),     Point(x:0, y:10),     Point(x:10, y:20),     Point(x:20, y:10) ] let target = PolygonShape(points:targetPoints) func setUpTarget(){     target.position = Point(x:200, y:400)     target.hasPhysics = true     target.isImmobile = true     target.isImpermeable = false     target.fillColor = .yellow     target.name = "Target"     //target.isDraggable = false          scene.add(target)      } /* The setup() function is called once when the app launches. Without it, your app won't compile. Use it to set up and start your app. You can create as many other functions as you want, and declare variables and constants, at the top level of the file (outside any function). You can't write any other kind of code, for example if statements and for loops, at the top level; they have to be written inside of a function. */ fileprivate func setUpBall() {     ball.position = Point(x: 250, y:400)     scene.add(ball)     ball.hasPhysics = true     ball.fillColor = .blue     ball.onCollision = ballCollided(with:)     ball.isDraggable = false     scene.trackShape(ball)     ball.onExitedScene = ballExitedScene     ball.onTapped = resetGame     ball.bounciness = 0.6 } fileprivate func addBarrier(at position: Point, width: Double, height: Double, angle: Double){     //Add a barrier to the scene.     let barrierPoints = [         Point:(x: 0, y: 0),         Point:(x: 0, y: height),         Point(x: width, y: height),         Point(x: width, y: 0)     ]     let barrier = PolygonShape(points:barrierPoints)     barrier.append(barrier)          barrier.position = Point(x:200, y:150)     barrier.hasPhysics = true     scene.add(barrier)     barrier.isImmobile = true     barrier.angle = 0.1 } fileprivate func setUpFunnel() {     //Adds a funnel to the scene     funnel.position = Point(x:200, y:scene.height - 25)     scene.add(funnel)     funnel.onTapped = dropBall     funnel.isDraggable = false } func ballCollided(with otherShape: Shape){     if otherShape.name != "Target"{return}          otherShape.fillColor = .green } func ballExitedScene (){     barrier.isDraggable = true } func resetGame (){     ball.position = Point(x:0, y:-80) } func printPosition(of shape: Shape){     print(shape.position) } func setup() {          setUpBall()          addBarrier()          setUpFunnel()          setUpTarget()          resetGame()          scene.onShapeMoved = printPosition(of:)           } func dropBall() {     ball.position = funnel.position     ball.stopAllMotion()     barrier.isDraggable = false }
Replies
1
Boosts
1
Views
1.4k
Activity
Aug ’21
I am not getting the proper answer for this 2D array addition guys can anybody help me
when i add these 2 multi - dimensional array i am not getting sum of the array rather it is concatenation process so guys can you help me out
Replies
1
Boosts
0
Views
748
Activity
Aug ’21
Checking for characters
I'm having trouble coding this. I'm learning swift via develop with swift by Apple, and when I try to code this, it stop at "Please add a digit." Can someone explain what I'm doing wrong? Thanks! let tenMostCommonPasswords = [     "123456",     "password",     "12345678",     "qwerty",     "12345",     "123456789",     "letmein",     "1234567",     "football",     "iloveyou" ] let digits = "0123456789" let punctuation = "!@#$%^&*(),.<>;'`~[]{}\|/?_-+= " let password = "Pasword12!" for _ in tenMostCommonPasswords{    if tenMostCommonPasswords.contains(password){     print("Please change your password")    }    else{     for _ in digits{         if digits.contains(password){             for _ in punctuation{                 if punctuation.contains(password){                     print("You're good to go!")                 }                 else{                     print("Please add a punctuation")                 }             }         }         else{             print("Please add a digit.")         }     }    } }
Replies
1
Boosts
0
Views
852
Activity
Aug ’21
I am having trouble with this question can anybody help me with the solution
Here How to pass argument with function call inside a class and take that argument as parameter from another class function????
Replies
3
Boosts
0
Views
711
Activity
Aug ’21
Which is the best place to learn iOS development perfectly?
I am sorry, I don't know if this is the correct place to ask this question.I know basics of iOS development(Swift). There are many experts in the community. I want to be an expert. I want to create, develop anything I want. Where can I learn? Please give me the resources or courses whatever helped you to be in this stage. Thanks a lot in advance.
Replies
7
Boosts
0
Views
7.5k
Activity
Aug ’21
Swift
How is better to learn and understand Swift?. Is the best way to study through apple sources or maybe there are some more?
Replies
1
Boosts
0
Views
595
Activity
Jul ’21