Post

Replies

Boosts

Views

Activity

Please can someone tell me what to do about this?
Please can someone tell me what to do about this? mike@iMac-2015 ~ % swift --version 2022-06-17 21:24:23.460 xcodebuild[1900:49794] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionSentinelHostApplications for extension Xcode.DebuggerFoundation.AppExtensionHosts.watchOS of plug-in com.apple.dt.IDEWatchSupportCore 2022-06-17 21:24:23.461 xcodebuild[1900:49794] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionPointIdentifierToBundleIdentifier for extension Xcode.DebuggerFoundation.AppExtensionToBundleIdentifierMap.watchOS of plug-in com.apple.dt.IDEWatchSupportCore 2022-06-17 21:24:24.131 xcodebuild[1901:49806] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionSentinelHostApplications for extension Xcode.DebuggerFoundation.AppExtensionHosts.watchOS of plug-in com.apple.dt.IDEWatchSupportCore 2022-06-17 21:24:24.131 xcodebuild[1901:49806] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionPointIdentifierToBundleIdentifier for extension Xcode.DebuggerFoundation.AppExtensionToBundleIdentifierMap.watchOS of plug-in com.apple.dt.IDEWatchSupportCore swift-driver version: 1.45.2 Apple Swift version 5.6.1 (swiftlang-5.6.0.323.66 clang-1316.0.20.12) Target: x86_64-apple-macosx12.0
6
0
4.9k
Jun ’22
SwiftUI, concurrency, responsive, or not.
On an iMac Retina 5K, 27-inch, the render time is ridiculously slow and unresponsive. It's not the graph, even though data arrives 3 times per second with 920 data points. I've tested this in standalone code - and its fast. The text and buttons need to be updated at a similar speed. Although this may appear to be working, it's far from being responsive. In fact, it's only possible to quit the program with a Command-Q, and displaying a basic About box takes forever. I think my Views are well structured, with most modifiers factored out, so should I conclude that SwiftUI is not suitable for anything beyond a simple REST app running on IOS? I hope not. If Apple were writing something similar, how would they go about it? I've spent over a year developing this app - wishing and expecting for Apple to come up with something better that doesn't run the entire UI on one single thread, and perhaps able to execute sub-views concurrently as one would expect. I don't wish to sound critical. I just want to know how to get this UI rendering faster, so I'm crying out for help and advise.
2
0
1.2k
Jun ’22
How to position multiple Views with a single Scene?
With Monterey on iMac - I want to create multiple Views and have them all visible within a single Scene. It's an attempt to overcome slow UI updates. so I'm hoping for better performance. This following example works. It displays View1 with View2 directly below, but how could they be display side-by-side? How could I position any number of views and arrange them in any way I choose? @main struct SceneryApp: App {     @StateObject var vm1 = Model1()     @StateObject var vm2 = Model2()     var body: some Scene {         WindowGroup {             View1()                 .frame(width: 200, height: 300)                 .border(.gray, width: 1)                 .padding()                 .environmentObject(vm1)             View2()                 .frame(width: 200, height: 300)                 .border(.gray, width: 1)                 .padding()                 .environmentObject(vm2)         }     } }
3
0
856
Feb ’22
SwiftUI Toggle multiple times per frame
I'm switching a remote Power Supply Unit on/off over the network. I need know if the PSU accepted the command, AND if at some future time it decides to switch itself off (or even on?). In other words I need feedback from the PSU to reflect it's current state via the very same Toggle that is sending the command. I hope that's all very clear. Toggle("", isOn: $psu.isOn) .toggleStyle(SwitchToggleStyle(tint: Color.green)) .onChange(of: psu.isOn, perform: { value in request(action: .PSU, param: psu.name) }) With my present code, I move the Toggle to on and the request asks the PSU to switch on. It sends back it's new status which informs the Toggle. The Toggle now thinks the status has changed, so it immediately toggles itself and sends a another request. At least I think that's what's happening. The fact is, this message appears on the Xcode console: onChange(of: Bool) action tried to update multiple times per frame So, I'm hoping some kind person will be able to show me how to write better code that does what I really want. Thank you.
4
0
5.5k
Jul ’21
How can I fix this leaking memory?
This simple example is leaking memory. Especially when the button is pressed. I think it's got something to do with the way I'm creating the ViewModel. Please could someone kindly tell my why and how to fix it. // MyTestApp.swift @main struct MyTestApp: App { var body: some Scene { WindowGroup { ContentView() } } } // ContentView.swift struct ContentView: View { @StateObject var vm = ViewModel() @State var tog = false var body: some View { VStack { Text(vm.myObject.number) .padding() Button(action: { vm.toggleButton(truth: tog ? "True" : "False") tog.toggle() }, label: { Text("Toggle") }) Text(vm.myObject.truth) .padding() } .frame(width: 300, height: 200) .environmentObject(vm) } } // ViewModel.swift struct MyObject { var number = "" var truth = "" } class ViewModel: ObservableObject { @Published var myObject = MyObject() private var timer: Timer? init() { timer = Timer.scheduledTimer(withTimeInterval: 0.1, repeats: true) { [self] timer in getRandonNumber() } } func getRandonNumber() { let n = Int.random(in: 100...999) myObject.number = "number is \(n)" } func toggleButton(truth: String) { myObject.truth = truth } }
5
0
2.1k
Sep ’21
SwiftUI Picker.onchange not changing.
The incoming vm data sets the Picker as expected, but .onchange is NOT executing. Is this another Apple bug or am I doing this wrong? import Foundation import SwiftUI struct ExamplePicker: View {     @EnvironmentObject var vm: ViewModel          let availableSymbolRates = [         /* band 0 */ ["-","AUTO","1500"],         /* band 1 */ ["-","AUTO","25","33","66","125"],         /* band 2 */ ["-","AUTO","250","333","500"],         /* band 3 */ ["-","AUTO","1000","1500"]     ]          var body: some View {         HStack {             Text("Symbol Rate")             Spacer()             Picker("", selection: $vm.response.RxSymbolRate) {                 ForEach(availableSymbolRates[vm.response.RxBand], id: \.self) {                     Text($0)                 }             }             .onChange(of: vm.response.RxSymbolRate, perform: { value in                 print("Rx Symbol Rate changed to: \(value)")                 vm.request(action: .RXSR, param: value)             })         }     } } The double line spacing is a forum bug.
3
0
3.7k
Aug ’21
Is SwiftUI usable?
Having spent 3 months writing a complex macOS UI to monitor and control a remote server in near real time, I think not. There are hundreds of memory leaks rendering the application unusable after only a few minutes of use. I won't be alone in saying SwiftUi is not fit for purpose.
3
0
1.1k
Aug ’21
Picker in the Real World?
When updating an external database from Swift UI on macOS. The database is the source of truth, so when the database changes, so should the Picker. When I select another Picker value, I send this value to the database. Then I poll the database. It returns whatever value it actually has and updates my Picker accordingly. I think this is a Real World scenario, so my question is... Has Apple ever tried to do this for themselves, because my current thinking is that the Picker and the Toggle controls are not fit for purpose? I'd be humbly grateful if Apple, or someone far knowledgable than I, would provide example code to prove I'm jumping to the wrong conclusion.
1
0
701
Jul ’21
Integrating NWCAT into SwiftUI
I have the Swift version of nwcat ( eskimo's post ) working just fine as a CommandLine version and talking to my SwiftNIO server running on a Raspberry Pi 4 using JSON in both directions. So far, so good, but now I need to integrate this code into my macOS SwiftUI App (which is ready to go). Despite several weeks trying this and that, I'm failing to understand how to implement this, so I'm hoping someone has some example code that I could learn from. Please could someone help me out, before I throw my iMac out the window?
4
0
1.3k
Jun ’21
Xcode 11.5.1 add Package Dependencies not working
Since the release of Xcode 11.5.1, I can longer add a Swift Package Dependency. This is the case for SwiftUI and CommandLine Apps. Existing apps, that already have included Package Dependencies, continue to keep them. But I can't add any addition packages. The "Choose Package Repository" window appears, but the Previous and Next buttons are disabled. I've even tried reinstalling Xcode. Frankly I'm stuck. Any ideas?
1
0
949
Jun ’21