Posts

Post marked as solved
3 Replies
292 Views
This is a derivative of this and this. On iOS 15(.3.1), if I just try to fetch and enumerate the classes of the objc runtime, waiting until viewDidAppear() to make sure there wasn't some initialization issue: var count = UInt32(0) var classList = objc_copyClassList(&count)! print("COUNT \(count)") print("CLASS LIST \(classList)") for i in 0..<Int(count) { print("\(i)") classList[i] } produces the following before a Thread 1: EXC_BREAKPOINT (code=1, subcode=0x1820e0cdc) COUNT 28353 CLASS LIST 0x000000010bf24000 0 1 2 2022-02-17 16:24:02.977904-0800 TWiG V[2504:705046] *** NSForwarding: warning: object 0x1dbd32148 of class '__NSGenericDeallocHandler' does not implement methodSignatureForSelector: -- trouble ahead 2022-02-17 16:24:02.978001-0800 TWiG V[2504:705046] *** NSForwarding: warning: object 0x1dbd32148 of class '__NSGenericDeallocHandler' does not implement doesNotRecognizeSelector: -- abort I don't know how to do any less with it than just fetching the value. I'm not trying to print it or anything, and yet it still fails. Is there some magic I'm missing? Why have the API if the results crash your program? If the issue is legit, it would be nice of the docs pointed out a workaround, or at least the proper way to cope with the result. (I do not have hardened runtime turned on, XCode 13.2.1)
Posted Last updated
.
Post not yet marked as solved
1 Replies
194 Views
I'm trying to create a macos app and wanted to play with SwiftUI. My goal is a window with 4 lists arranged horizontally across the top, and the lower half as TextEditor. My attempt at this was: struct ContentView: View { @State private var fullText: String = "Bazinga" var body: some View { VSplitView() { HSplitView() { List() { Text("Alpha") Text("Bravo") Text("Charlie") } List() { Text("Protons") Text("Electrons") Text("Neutrons") } List() { Text("Blueberries") Text("Strawberries") Text("Cherries") } List() { Text("Ford") Text("Chevy") Text("Dodge") } } TextEditor(text: $fullText) .lineSpacing(2) } } } What I see when I open the window initially though is: What do I change to get the 4 lists to be evenly distributed across the top? It manages to show both the TextEditor and the upper half, but only one of the 4 lists. I note that the drag bars are there on the edge, and I can drag them to get the layout desired: So my real question is how do I get to look like this initially?
Posted Last updated
.
Post marked as solved
2 Replies
1.7k Views
I'm attempting to port LightMQTT to Apple's new Network stuff. But I'm finding it really tough to figure things out, because documentation seems really sparse. In particular, I'm trying to figure out what I can do with NWConnection.func send(content: Data?, contentContext: NWConnection.ContentContext = .defaultMessage, isComplete: Bool = true, completion: NWConnection.SendCompletion).Is content my bytes to send? Why is it optional?What is isComplete supposed to be set as?Are there even any examples/sample code for this stuff?Or is it just too early to be delving into this?
Posted Last updated
.
Post marked as solved
8 Replies
3k Views
I'm trying to set up a client connection to communicate with an MQTT broker using client side certificates. I've been able to proof-of-concept this all on the Linux side using command line. The MQTT broker is set to require client cert, and a command like: mosquitto_pub -h servername -p 8899 -t 1234/2/Q/8 -m myMessage --cafile myChain.crt --cert client.crt --key client.pemdoes the job nicely. Now I'm trying to set up an NWConnection: self.connection = NWConnection( host: NWEndpoint.Host("servername"), port: NWEndpoint.Port(integerLiteral: 8899), using: .tls)But I think that simple .tls class var needs to be a much more involved NWParameters object, but I'm at a complete loss (documentation is pretty sparse) as to what I create there to attach the client certs to the parameters. Nor do I know how I even move from .crt/.pem file to something the app manages programatically.What is an example of how one would configure the NWParameters to support the client certs?
Posted Last updated
.