Post

Replies

Boosts

Views

Activity

Refresh Playgrounds 4 code evaluation
It happens a lot that code evaluation in Playgrounds (the labels that say you have compile bugs or warnings in your code) gets stuck. So in order to fix them I sometimes must force quit the whole Playgrounds app. Sometimes I even have to completely restart iPadOS. I know triggering Build in Xcode usually fixes those problems in Xcode... so I wonder: is there, or, why isn’t there… a Playgrounds alternative to Xcode’s Build command? (Using Playgrounds 4.0.2 on iPadOS 15.4.1 running on the M1 iPad Pro)
1
0
1.2k
Apr ’22
Loading resources
Do I really have to use Bundle to use resources? Or can it be done easier? I have this JSON file resource in my Playground and am wondering about the least amount of code necessary to load its data into a dictionary. I’m currently using this Bundle extension: extension Bundle {     func decode(_ file: String) -> [String: MyType] {         guard let url = self.url(forResource: file, withExtension: nil) else {             fatalError("Failed to locate \(file) in bundle.")         }         guard let data = try? Data(contentsOf: url) else {             fatalError("Failed to load \(file) form bundle.")         }         let decoder = JSONDecoder()         guard let loaded = try? decoder.decode([String: MyType].self, from: data) else {             fatalError("Failed to decode \(file) from bundle.")         }         return loaded     } } This type: struct MyType: Codable, Identifiable {     let id: String     let name: String     let description: String } Using this to load it into a struct: let myData = Bundle.main.decode("MyData.json") There must be an easier way to access resources in Playgrounds… like image assets for example, it’s just Image(“My Image File Name Here”) and done…
1
0
1.3k
Apr ’22
Xcode 13.2 and autocompletion
I've updated Xcode to 13.2 and suddenly the code completion that used to turn numberOfRowsInSection into  override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { //... } ...inside a UITableViewController is no longer working. Anyone else experiencing this?
4
0
3.3k
Dec ’21
Refresh Playgrounds 4 code evaluation
It happens a lot that code evaluation in Playgrounds (the labels that say you have compile bugs or warnings in your code) gets stuck. So in order to fix them I sometimes must force quit the whole Playgrounds app. Sometimes I even have to completely restart iPadOS. I know triggering Build in Xcode usually fixes those problems in Xcode... so I wonder: is there, or, why isn’t there… a Playgrounds alternative to Xcode’s Build command? (Using Playgrounds 4.0.2 on iPadOS 15.4.1 running on the M1 iPad Pro)
Replies
1
Boosts
0
Views
1.2k
Activity
Apr ’22
Loading resources
Do I really have to use Bundle to use resources? Or can it be done easier? I have this JSON file resource in my Playground and am wondering about the least amount of code necessary to load its data into a dictionary. I’m currently using this Bundle extension: extension Bundle {     func decode(_ file: String) -> [String: MyType] {         guard let url = self.url(forResource: file, withExtension: nil) else {             fatalError("Failed to locate \(file) in bundle.")         }         guard let data = try? Data(contentsOf: url) else {             fatalError("Failed to load \(file) form bundle.")         }         let decoder = JSONDecoder()         guard let loaded = try? decoder.decode([String: MyType].self, from: data) else {             fatalError("Failed to decode \(file) from bundle.")         }         return loaded     } } This type: struct MyType: Codable, Identifiable {     let id: String     let name: String     let description: String } Using this to load it into a struct: let myData = Bundle.main.decode("MyData.json") There must be an easier way to access resources in Playgrounds… like image assets for example, it’s just Image(“My Image File Name Here”) and done…
Replies
1
Boosts
0
Views
1.3k
Activity
Apr ’22
Xcode 13.2 and autocompletion
I've updated Xcode to 13.2 and suddenly the code completion that used to turn numberOfRowsInSection into  override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { //... } ...inside a UITableViewController is no longer working. Anyone else experiencing this?
Replies
4
Boosts
0
Views
3.3k
Activity
Dec ’21
What’s the difference between a Blank and an Xcode Playground?
In Playgrounds on iPadOS, what’s the difference between these 2 types of playgrounds? For the life of me I cannot find any documentation about this.
Replies
1
Boosts
0
Views
744
Activity
Nov ’21