Education

RSS for tag

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

Education Documentation

Posts under Education tag

34 Posts
Sort by:
Post not yet marked as solved
0 Replies
275 Views
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()     } }
Posted Last updated
.
Post marked as solved
1 Replies
246 Views
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!
Posted
by tnyxvr.
Last updated
.
Post not yet marked as solved
0 Replies
314 Views
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?
Posted Last updated
.
Post not yet marked as solved
0 Replies
300 Views
which are the commands to compile and execute C # in the terminal
Posted
by Quarcks.
Last updated
.
Post not yet marked as solved
1 Replies
589 Views
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.
Posted
by meAyush.
Last updated
.
Post not yet marked as solved
0 Replies
418 Views
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?
Posted
by yc19734.
Last updated
.
Post not yet marked as solved
2 Replies
476 Views
// //  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()     } }
Posted Last updated
.
Post not yet marked as solved
0 Replies
487 Views
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")
Posted
by Visakh.
Last updated
.
Post not yet marked as solved
0 Replies
460 Views
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 }
Posted
by Warriors8.
Last updated
.
Post marked as solved
1 Replies
402 Views
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.")         }     }    } }
Posted
by Warriors8.
Last updated
.
Post marked as solved
7 Replies
3.7k Views
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.
Posted Last updated
.
Post not yet marked as solved
1 Replies
356 Views
How is better to learn and understand Swift?. Is the best way to study through apple sources or maybe there are some more?
Posted Last updated
.