Post

Replies

Boosts

Views

Activity

Undo Button
Hello! I am making a game where you can place blocks and I would like to have an undo button to delete the last placed block! How do I do this? My code is here: Please remove .LOG extension from the code ViewController.swift - https://developer.apple.com/forums/content/attachment/2fc14933-2e81-46a2-afc5-abb7fc74e086
0
0
237
Jul ’20
Unable to submit build for testing!
Hi everyone! I am experiencing this issue: This build is using a beta version of Xcode and can’t be submitted. Make sure you’re using the latest version of Xcode or the latest seed release found in What’s New in App Store Connect. I have Xcode 12 beta on my Mac and have archived the app from there. I was able to submit the build for internal testing but it gives me the issue when I try to submit for external testing!
2
0
1.1k
Jul ’20
Change text of label whenever UserDefaults key value changes
I have an app where there are 2 views, one with a UILabel and another with a UITextField. I would like it so the moment you are done editing the Text Field, the label changes to the TF's value. The text field stores its value in a UserDefaults and when my Label's View loads, it shows the value of the UD key on the label. Again, I would like it so the moment you are done editing the Text Field, the label changes to the TF's value. Below is my Label's View's Controller struct myStruct {     static var money = 0.00 } import UIKit class ViewController: UIViewController {     @IBOutlet weak var moneyLabel: UILabel!     override func viewDidLoad() {         super.viewDidLoad()         let ud = UserDefaults.standard         myStruct.money = ud.double(forKey: "Money")         moneyLabel.text = String(ud.double(forKey: "Money"))              } } My TextField's View's Controller import UIKit class AddMoneyViewController: UIViewController {          let userDefaults = UserDefaults.standard               @IBOutlet weak var TextField: UITextField!          override func viewDidLoad() {         super.viewDidLoad()                  }          @IBAction func TFEditingDidEnd(_ sender: Any) {         userDefaults.set(TextField.text, forKey: "Money")         let moneyAtPoint1 = userDefaults.double(forKey: "Money")         print(moneyAtPoint1)          }      }
2
0
3.5k
Jun ’20
Make a WWDC CountDown
Here is code to make a simple Swift WWDC countdown:import Cocoa let today = Date() let startDate = "2020-06-22" let dateFormatter = DateFormatter()dateFormatter.dateFormat = "yyyy-MM-dd" let finalStartDate = dateFormatter.date(from: startDate)let components = Set<Calendar.Component>([.day, .hour]) print("WWDC20 Will Come on JUNE 22") let daysToDc = Calendar.current.dateComponents(components, from: finalStartDate!, to: today) let printableDays = Int(daysToDc.day!) let printableHours = Int(daysToDc.hour!) print(String(printableDays)+" days " + String(printableHours) + " hours till WWDC2020")
3
0
654
Jun ’20