Swift Student Challenge

RSS for tag

Ask questions and connect with other challenge applicants.

Swift Student Challenge Documentation

Posts under Swift Student Challenge tag

131 results found
Sort by:
Post not yet marked as solved
117 Views

SwiftUI beginner stuck on a code roadblock

Hi guys, I'm trying to develop my first app, but have a coding problem I can't seem to solve despite searching through forums and SwiftUI tutorials. I'm building a radiology teaching app and need to sort different pathology and anatomy into different categories, depending on the imaging study. I thought I could solve this by using multiple dictionaries but encounter an error when I try to use more than one Category declaration. I tried subdividing the items into sections and listing them as arrays in JSON data format, but this did not work either. "var chests: [Chest] = load("chest.json")     var chestcategories: [String: [Chest]] {         Dictionary(             grouping: chests,             by: { $0.category.rawValue }         )     }" "[     {         "id": 0,         "chestname": "Heart",         "chestimage": "heart",         "category": "anatomy",         "description": "Size, Shape, Margins",         "sectioncategory": "Chest"     },          {         "id": 1,         "chestname": "Lungs",         "chestimage": "lungs",         "category": "anatomy",         "description": "Airspace opacity, Pleural effusion, Pneumothorax",         "sectioncategory": "Chest"     },          {         "id": 2,         "chestname": "Airway",         "chestimage": "airway",         "category": "anatomy",         "description": "Caliber, Narrowing (Symmetric vs Asymmetric), Tracheal deviation",         "sectioncategory": "Chest"     },          {         "id": 3,         "chestname": "Diaphragm",         "chestimage": "diaphragm",         "category": "anatomy",         "description": "Is there air under the diaphragm?, Diaphragmetic hernias or defects, Shape (Right hemidiaphragm should be higher than left)",         "sectioncategory": "Chest"     }," In this example, I'd like to be able to sort and selectively display data based on both the category and sectioncategory variables. Thanks guys!
Asked
by vitamink.
Last updated
.
Post not yet marked as solved
281 Views

Swift Student Challenge

Your Swift playground must be fully functioning, and be written in and run on Swift Playgrounds 3.4.1 on iPadOS 14.4.2, Swift Playgrounds 3.4.1 on macOS 11.2.3, or Xcode 12.4 on macOS 11.2.3. If it runs on iPadOS, it must be optimized to display properly on all models of iPad Pro. You may incorporate the use of Apple Pencil. Xcode projects will not be considered. Should I have to be “iPad OS 14.4.2”?
Asked
by A-star.
Last updated
.
Post not yet marked as solved
160 Views

Swift Student Challenge

“You must provide a PDF, PNG, or JPG of your current class schedule or other current proof of enrollment and the contact information for your dean or principal. Documentation is accepted in all languages and must clearly show your name, the organization or school name, and the dates for which it is valid.” What’s “your current class schedule? And what’s “other current proof of enrollment”?
Asked
by A-star.
Last updated
.
Post not yet marked as solved
146 Views

How to declare protocol ?

// //  GegeApp.swift //  Gege // //  Created by Besleaga Alexandru Marian on 5/15/21. import SwiftUI @main struct GegeApp: App {     var body: some Scene {         WindowGroup {             Text("Hello, world!")         }     } } How do I declare protocol App in context ?
Asked Last updated
.
Post not yet marked as solved
197 Views

How to declare a scope in code ?

// //  GegeApp.swift //  Gege // //  Created by Besleaga Alexandru Marian on 5/15/21. // import SwiftUI @main struct GegeApp: App {     var body: some Scene {         WindowGroup {             Text("Besleaga Alexandru Marian")         }         #if os(macOS)                 Settings {                     SettingsView()                 }         #endif     } } struct GeneralSettingsView: View {     @AppStorage("showPreview") private var showPreview = true     @AppStorage("fontSize") private var fontSize = 12.0     var body: some View {         Form {             Toggle("Show Previews", isOn: $showPreview)             Slider(value: $fontSize, in: 9...96) {                 Text("Font Size (\(fontSize, specifier: "%.0f") pts)")             }         }         .padding(20)         .frame(width: 350, height: 100)     } } struct SettingsView: View {     private enum Tabs: Hashable {         case general, advanced     }     var body: some View {         TabView {             GeneralSettingsView()                 .tabItem {                     Label("General", systemImage: "gear")                 }                 .tag(Tabs.general)             `AdvancedSettingsView()`                 .tabItem {                     Label("Advanced", systemImage: "star")                 }                 .tag(Tabs.advanced)         }         .padding(20)         .frame(width: 375, height: 150)     } } Cannot find AdvancedSettingsView in scope ?
Asked Last updated
.
Post not yet marked as solved
119 Views

Wrong zip file submission.

I by mistake submitted the contents of the playground for my Swift Challenge submission rather than the zip of the playground as it was my first time participating in the challenge. It is working if we copy and paste files in a blank playground but is showing file error without that. So will i not be considered for the submission as i spend a lot of time and effort creating the playground for submission even during time when i was ill.
Asked
by tr1gg3r.
Last updated
.
Post marked as solved
283 Views

Can I apply enrolled as company?

Hi there! I'm really excited about WWDC and the Swift Student Challenge this year! I recently converted my account from individual to company. Am I still eligible to apply using this account? or do I need to create a new one and apply from that?
Asked
by Oscar F.
Last updated
.
Post marked as solved
185 Views

How this code works? ViewController inherits from another ViewController it's viewDidLoad func

I found a solution for an issue that I was having to get a SwipeGestureRecognizer to work. And this was the solution: ViewController1 class ViewController1: ViewController2 { // This ViewController // has access to the functionality // declared in viewDidLoad() method // from ViewController2. } ViewController2 class ViewController2: UIViewController {       override func viewDidLoad() {     let swipeRight = UISwipeGestureRecognizer(target: self, action: #selector(respondToSwipeGesture(_:)))     swipeRight.direction = .right     let swipeLeft = UISwipeGestureRecognizer(target: self, action: #selector(respondToSwipeGesture(_:)))     swipeLeft.direction = .left     let swipeUp = UISwipeGestureRecognizer(target: self, action: #selector(respondToSwipeGesture(_:)))     swipeUp.direction = .up     let swipeDown = UISwipeGestureRecognizer(target: self, action: #selector(respondToSwipeGesture(_:)))     swipeDown.direction = .down           view.addGestureRecognizer(swipeRight)     view.addGestureRecognizer(swipeLeft)     view.addGestureRecognizer(swipeUp)     view.addGestureRecognizer(swipeDown)   }       @objc func respondToSwipeGesture(_ gesture : UIGestureRecognizer) {     if let swipeGesture = gesture as? UISwipeGestureRecognizer {       switch swipeGesture.direction {       case .right:         print("swiped right!")       case .left:         print("swiped left")       case .up:         print("swiped up")       case .down:         print("swiped down")       default:         return       }     }   } } The question is... Is this a valid approach? The way I understand viewDidLoad is as a method that gets called to perform initializations on that particular ViewController. According to Apple Docs This method is called after the view controller has loaded its view hierarchy into memory. This method is called regardless of whether the view hierarchy was loaded from a nib file or created programmatically in the loadView() method. You usually override this method to perform additional initialization on views that were loaded from nib files. That being said, the way I'm wrapping my head around the solution from above, is that when ViewController1 gets pushed onto the stack, it would pretty much be calling two viewDidLoad methods, one from ViewController1 and the other one from ViewController2. Am I right?
Asked
by aeum3893.
Last updated
.
Post marked as solved
392 Views

Educational supervisor's contact

For the WWDC21 submission, may I put the contact of my homeroom teacher in the educational supervisor section? I can't really connect with the principal that easily because of covid and whatnot, so I would like to provide the contact of my homeroom teacher, but the requirement says that the contact of the principal, dean or the equivalent is needed. What should I do?
Asked Last updated
.
Post marked as solved
239 Views

Wrong contact information

Hi. I accidentally wrote my email in the place of my educational supervisor's email. Can I somehow rectify this error or am I already disqualified?
Asked Last updated
.
Post not yet marked as solved
137 Views

Give Credit to Resources Used

Is it necessary to give credit to resources (such as tutorials or example code) used if they are not used exactly as the example was and adapted heavily? If so, where should I write this information?
Asked
by Dln.
Last updated
.