Post

Replies

Boosts

Views

Activity

Reply to DATA
In addition to @SpaceMan 's answer you can import some sort of database: You can export a CSV file and have something sort of like this. Aloe Vera, skin healer, Cut from middle, once every three days, cut the leave and use the gel inside for your rash Almond, skin healer, cut the young leaves, daily, soak in water overnight rinse and blend ...... and then that's easy. struct Plant: Identifiable { var id: UUID { get { return .init() } } var plantName: String var mdedicalProperties: String var harvestInstructions: String var waterRequirements: String var recipe: String } // load your file with your way, I'll use file as a variable for the string contents of the database var plantModel = [Plant] let plantLines = file.split(separator: "\n") let plantArray2D: Array<Array<String>> = [] for i in plantLines { let modified = i.replacingOccurrences(of: " ", with: "") plantArray2D.append(i.split(separator: ",")) } for i in plantArray2D { plantModel.append(Plant(plantName: i[0], medicicalProperties: i[1], harvestInstructions: i[2], waterRequirements: i[3], recipe: i[4])) }
Aug ’22
Reply to ML
JSON: [ { "text": "sun", "label": "RED" }, { "text": "", "label": "RED" }, { "text": "citrus", "label": "ORG" }, { "text": "warm", "label": "ORG" }, { "text": "sunlight", "label": "YLW" }, { "text": "cheese", "label": "YLW" }, { "text": "foliage", "label": "GRN" }, { "text": "organic", "label": "GRN" }, { "text": "mint", "label": "MNT" }, { "text": "freshness", "label": "MNT" }, { "text": "sky", "label": "BLU" }, { "text": "sea", "label": "BLU" }, { "text": "magic", "label": "VLT" }, { "text": "jealousy", "label": "VLT" } ] And I updated my code to @ebhanson 's suggestion:     var body: some View { // view         TextField("Text...", text: $text).padding().background(color).onReceive(timer) { _ in             color = predict(for: text)?.color             print(color)         }.task {             do {                 model = try ChromaClassifier(configuration: .init()).model             } catch {                 print("NIL MDL")                 model = nil             }             if let model = model {                 predictor = try? NLModel(mlModel: model)             } else {                 predictor = nil             }         } var model: MLModel? = nil var predictor: NLModel? = nil func predict(for string: String) -> SingleColor? { // function     if let predictor = predictor {         let colorKeys = predictor.predictedLabelHypotheses(for: string, maximumCount: 1) // 1..7         print(colorKeys)         var color: SingleColor = .init(red: 0, green: 0, blue: 0)         for i in colorKeys {             color.morphing((ColorKeys.init(rawValue: i.key) ?? .white).toColor().percentage(of: i.value))             print(color)         }         return color     } else {         return nil     } }
Aug ’22
Reply to Monterey update freezes my track pad
Me2 why don't try Ventura?
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Jul ’22
Reply to about the problem that domestic copyrighted music content cannot be displayed to users in non-China regions.
hi
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Jul ’22
Reply to Xcode 14 Beta 3 is constantly getting an error with WeatherKit
I'm getting this:https://developer.apple.com/forums/thread/709578
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Jul ’22
Reply to Take screenshot of swiftUI View
One year later, another dev also gets into the waiting line...
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jul ’22
Reply to Expected expression
You should use if ... { } else { } not if ... {    else {    } }
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Aug ’22
Reply to Could you please help TestFlight this app?
fantastic app! Only I used my MacBook :)
Topic: Graphics & Games SubTopic: General Tags:
Replies
Boosts
Views
Activity
Aug ’22
Reply to How to Unit/UI test a game?
Use self.measure { // code here }``` in the unit test or use Instruments
Topic: Graphics & Games SubTopic: General Tags:
Replies
Boosts
Views
Activity
Aug ’22
Reply to Why am i not getting interface option when creating new proj in xcode13.4?
If it's a Multiplatform one it won't. Only SwiftUI is supported
Replies
Boosts
Views
Activity
Aug ’22
Reply to Playground problem & Splitting a tip
Please use a code block next time thanks
Replies
Boosts
Views
Activity
Aug ’22
Reply to DATA
In addition to @SpaceMan 's answer you can import some sort of database: You can export a CSV file and have something sort of like this. Aloe Vera, skin healer, Cut from middle, once every three days, cut the leave and use the gel inside for your rash Almond, skin healer, cut the young leaves, daily, soak in water overnight rinse and blend ...... and then that's easy. struct Plant: Identifiable { var id: UUID { get { return .init() } } var plantName: String var mdedicalProperties: String var harvestInstructions: String var waterRequirements: String var recipe: String } // load your file with your way, I'll use file as a variable for the string contents of the database var plantModel = [Plant] let plantLines = file.split(separator: "\n") let plantArray2D: Array<Array<String>> = [] for i in plantLines { let modified = i.replacingOccurrences(of: " ", with: "") plantArray2D.append(i.split(separator: ",")) } for i in plantArray2D { plantModel.append(Plant(plantName: i[0], medicicalProperties: i[1], harvestInstructions: i[2], waterRequirements: i[3], recipe: i[4])) }
Replies
Boosts
Views
Activity
Aug ’22
Reply to Export MacOS SwiftUI form to pdf
I'm trying
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Aug ’22
Reply to Ventura Beta Really Messed up my iMac
I'm a dev and I can tell you there's nothing you can do except to take it to apple support and flush your drive. I did that.
Topic: Community SubTopic: Apple Developers Tags:
Replies
Boosts
Views
Activity
Aug ’22
Reply to ML
JSON: [ { "text": "sun", "label": "RED" }, { "text": "", "label": "RED" }, { "text": "citrus", "label": "ORG" }, { "text": "warm", "label": "ORG" }, { "text": "sunlight", "label": "YLW" }, { "text": "cheese", "label": "YLW" }, { "text": "foliage", "label": "GRN" }, { "text": "organic", "label": "GRN" }, { "text": "mint", "label": "MNT" }, { "text": "freshness", "label": "MNT" }, { "text": "sky", "label": "BLU" }, { "text": "sea", "label": "BLU" }, { "text": "magic", "label": "VLT" }, { "text": "jealousy", "label": "VLT" } ] And I updated my code to @ebhanson 's suggestion:     var body: some View { // view         TextField("Text...", text: $text).padding().background(color).onReceive(timer) { _ in             color = predict(for: text)?.color             print(color)         }.task {             do {                 model = try ChromaClassifier(configuration: .init()).model             } catch {                 print("NIL MDL")                 model = nil             }             if let model = model {                 predictor = try? NLModel(mlModel: model)             } else {                 predictor = nil             }         } var model: MLModel? = nil var predictor: NLModel? = nil func predict(for string: String) -> SingleColor? { // function     if let predictor = predictor {         let colorKeys = predictor.predictedLabelHypotheses(for: string, maximumCount: 1) // 1..7         print(colorKeys)         var color: SingleColor = .init(red: 0, green: 0, blue: 0)         for i in colorKeys {             color.morphing((ColorKeys.init(rawValue: i.key) ?? .white).toColor().percentage(of: i.value))             print(color)         }         return color     } else {         return nil     } }
Replies
Boosts
Views
Activity
Aug ’22
Reply to SpriteKit Game
Hi when I'm deleting blank lines from copy-and pasted code from xcode, I accidently deleted some of thfunc fireEnergyBallsection... and not realize it😂🫠
Topic: Graphics & Games SubTopic: SpriteKit Tags:
Replies
Boosts
Views
Activity
Aug ’22
Reply to Installing kali linux in 2016 Macbook Pro
Try PD and it's working, but after the trail...
Topic: App & System Services SubTopic: Hardware Tags:
Replies
Boosts
Views
Activity
Aug ’22