Post

Replies

Boosts

Views

Activity

Reply to Integrating external 3d sources or links with SwiftUI
SceneView: import SceneKit import SwiftUI ...         SceneView(             scene: /* a scene in SCNScene or other formats (I remember you can use .obj, etc.) */,             options: [             .allowsCameraControl,             .autoenablesDefaultLighting .someOtherOption             ] ...         )
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Aug ’22
Reply to SwiftUI Form space between two buttons
Use form: Form {     Section("If you have a title add here") {         Button {                      } label: {             Label("Test", systemImage: "circle.fill")             }     Section {         Button(role: .destructive) {                      } label: {             Label("Test", systemImage: "trash.fill")         }     } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Aug ’22
Reply to Why is @Binding not behaving as I expect here?
I've also found that swiftUI's refreshing had gone wrong somehow if I do this: List($someSortOfADynamicList) { $item in TextField("Placeholder...", text: $item.someSortOfAStringVariable) } it'll act very weird. Every time a value is changed, the current textfield focused defocused. And if you use a NavigationView, the current NavigationLink gets unfocused, that is, no view displayed in the destination page.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
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 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 Integrating external 3d sources or links with SwiftUI
SceneView: import SceneKit import SwiftUI ...         SceneView(             scene: /* a scene in SCNScene or other formats (I remember you can use .obj, etc.) */,             options: [             .allowsCameraControl,             .autoenablesDefaultLighting .someOtherOption             ] ...         )
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Aug ’22
Reply to SwiftUI Form space between two buttons
Use form: Form {     Section("If you have a title add here") {         Button {                      } label: {             Label("Test", systemImage: "circle.fill")             }     Section {         Button(role: .destructive) {                      } label: {             Label("Test", systemImage: "trash.fill")         }     } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Aug ’22
Reply to SwiftUI Refreshing Mechanism
Thanks I'm submitting a FB
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Aug ’22
Reply to swift-frontend memory usage
50 GB ???? *
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Aug ’22
Reply to Why is @Binding not behaving as I expect here?
I've also found that swiftUI's refreshing had gone wrong somehow if I do this: List($someSortOfADynamicList) { $item in TextField("Placeholder...", text: $item.someSortOfAStringVariable) } it'll act very weird. Every time a value is changed, the current textfield focused defocused. And if you use a NavigationView, the current NavigationLink gets unfocused, that is, no view displayed in the destination page.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Aug ’22
Reply to get CPU, GPU, Internet connection, etc
OK I've already find out all about CPU, Storage, Battery, thermal state in github I also found out that you can use airport to find out the current WiFi connected and its password. How to get package recieved/sent from the device? Now how can I get the GPU's parameters? Using Metal?
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Aug ’22
Reply to my crash when sleep my mac with monterey 12.5.1
> watchdog 1 Your computer ran itself too hard? PS. use codeblock or your > will look like a quotation block.
Topic: App & System Services SubTopic: Hardware Tags:
Replies
Boosts
Views
Activity
Aug ’22
Reply to Python not working on Mac OS M1 asking to install cmd developer tools
try python3 on zsh Hardware: Apple silicon
Replies
Boosts
Views
Activity
Aug ’22
Reply to Airplay swiftUI
Watched +1
Topic: UI Frameworks SubTopic: SwiftUI 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
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 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 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 Export MacOS SwiftUI form to pdf
I'm trying
Topic: UI Frameworks SubTopic: SwiftUI Tags:
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