Post

Replies

Boosts

Views

Activity

repeat loop inside Vstack
I'm trying to get my App to update precentage level by making a loop inside Vstack, but I get an error as follows. VStack { repeat { 'Closure containing control flow statement cannot be used with result builder'ViewBuilder''. let baprs = readlevel(battprs: "") Text("(baprs)") } while k == 0           .font(.system(size: 14))           .bold()           .offset(y: 40)         Text("%")          .font(.system(size: 14))           .bold()                       .offset(x: 20, y: 6)       }
1
0
3.6k
Nov ’21
function writeFile()
I'v been trying to write a document directory file but I can't find the file anywhere. ( Terminal comand: find . -name "blw*"). Part of the ContentView.swift looks like this. func writeFile() {        let file = "blw.txt"        let text = "hakemisto"        let documentDirectory = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first!                 print("documentDir: (documentDirectory)")            if let dir = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first {        let fileURL = dir.appendingPathComponent(file)        do {            try text.write(to: fileURL, atomically: false, encoding: .utf8)        } catch {          }                }   I don't understand what's wrong. That print does not print anything so I guess that whole if section is ignored. MacOS 12.0.1 XCode 13.1
1
0
553
Nov ’21
xcode IBAction NSButton shell script problem
Hi! Im trying to run a .sh script from Xcode AppDelegate.swift like so: @IBOutlet weak var Startsh: NSButtonCell!   @IBAction func Startsh(_ sender: NSButton) {     sender.isEnabled = true     let task = Process()     task.launchPath = "/Users/xxxxx/zzzzzzz1_0_5_sh"     task.waitUntilExit()   } I have also linked my Start-button to Mainmenu.xib App Delegate Received Action called Startsh But after building succesfully and running I can't see on terminal-window that .sh process running. I'v been trying and studying without any results. Kilke56
1
0
593
Aug ’21
repeat loop inside Vstack
I'm trying to get my App to update precentage level by making a loop inside Vstack, but I get an error as follows. VStack { repeat { 'Closure containing control flow statement cannot be used with result builder'ViewBuilder''. let baprs = readlevel(battprs: "") Text("(baprs)") } while k == 0           .font(.system(size: 14))           .bold()           .offset(y: 40)         Text("%")          .font(.system(size: 14))           .bold()                       .offset(x: 20, y: 6)       }
Replies
1
Boosts
0
Views
3.6k
Activity
Nov ’21
function writeFile()
I'v been trying to write a document directory file but I can't find the file anywhere. ( Terminal comand: find . -name "blw*"). Part of the ContentView.swift looks like this. func writeFile() {        let file = "blw.txt"        let text = "hakemisto"        let documentDirectory = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first!                 print("documentDir: (documentDirectory)")            if let dir = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first {        let fileURL = dir.appendingPathComponent(file)        do {            try text.write(to: fileURL, atomically: false, encoding: .utf8)        } catch {          }                }   I don't understand what's wrong. That print does not print anything so I guess that whole if section is ignored. MacOS 12.0.1 XCode 13.1
Replies
1
Boosts
0
Views
553
Activity
Nov ’21
xcode IBAction NSButton shell script problem
Hi! Im trying to run a .sh script from Xcode AppDelegate.swift like so: @IBOutlet weak var Startsh: NSButtonCell!   @IBAction func Startsh(_ sender: NSButton) {     sender.isEnabled = true     let task = Process()     task.launchPath = "/Users/xxxxx/zzzzzzz1_0_5_sh"     task.waitUntilExit()   } I have also linked my Start-button to Mainmenu.xib App Delegate Received Action called Startsh But after building succesfully and running I can't see on terminal-window that .sh process running. I'v been trying and studying without any results. Kilke56
Replies
1
Boosts
0
Views
593
Activity
Aug ’21