Posts

Post not yet marked as solved
6 Replies
the ContentView.swift alone is over three hundred lines, so that seemed a bit much to paste in, which is why I provided the link to the full project on github. When I said "underneath body" I meant how, in ContentView.swift, you have the basic structure of the file: import SwiftUI struct ContentView: View { var body: some View { <most code goes here> } } #Preview { ContentView() } the current issue i'm seeing happens when I have @State var buttonBlank: Bool = true after the ContentView: View line but before the var body: some View line. If I put it after var body: some View, then I don't get the weird 4 cycle-blank other buttons weirdness, but buttonBlank never updates. sorry if that bit was less than clear.
Post not yet marked as solved
6 Replies
okay, so the idea here is an "SOS" game (current project at https://github.com/johncwelch/SOS-Swift) basically, it's an over complicated version of tic-tac-toe, where each player attempts to spell SOS by clicking on the buttons. the buttons have three options: Blank (starting default) "S" "O" The buttons can also be enabled or disabled depending on a few things: if they've already been used, then they're not clickable if they're blank, but another button is being used by a player, they have to be enabled when that other button is blank, but disabled when the other button is "S" or "O" so that only one button can be used in a move. So on completion of a move, the following has to happen: If "S", are any of the buttons next to me "O"? If so, is the button in a line with that "O" an "S". If so, SOS, set the button color of all three to match the player color, (red or blue), disable myself, add a point to the player who made SOS, and change the current player to the other player. If not, just disable the button and change the current player to the other player. if "O", are the buttons on opposite sides of me both "S"? If so, SOS, set the button color of all three to match the player color, (red or blue), disable myself, add a point to the player who made SOS, and change the current player to the other player. If not, just disable the button and change the current player to the other player. So i need to be able to both read state of other buttons on the playing field and modify the state of other buttons based on what happens in a click on a current button. There's also a "new game" option, which blows up any current game (if in the middle), sets scores to 0 and sets all buttons to blank + enabled. Tracking button state is kind of critical here, both for the current title of the button and its enabled/disabled state.
Post not yet marked as solved
3 Replies
that indeed do the trick, thanks! Now to let the person who created the thing I was using as a tutorial that they need to fix their stuff. Le joy.
Post not yet marked as solved
3 Replies
Bug filed: FB10616393
Post marked as solved
6 Replies
documentation radar: FB10364979 On how to do this, I meant with location services. So I managed to muddle through some of it (y'all really need to look at how MS does their dev docs, the sample code for things here is really skimpy) What I have so far: in my "main" file (not the contentview file): class locationDelegate: NSObject, CLLocationManagerDelegate { func theLocationAuthStatus(_manager: CLLocationManager, didChangeAuthorization status: CLAuthorizationStatus) { print("changed auth status: \(status.rawValue)") switch status.rawValue { case 0: print("Not Determined") case 1: print("Restricted") case 2: print("Denied") case 3: print("Authorized Always") case 4: print("Authorized when in use") default: print("None of the above") } } } In my ContentView file: @State var myLocationManager = CLLocationManager() <lots of swiftui UI stuff> .onAppear {     let myDelegate = locationDelegate()     myLocationManager.requestWhenInUseAuthorization()     myLocationManager.startUpdatingLocation()     myLocationManager.delegate = myDelegate     myLocationManager.delegate     print(myLocationManager.authorizationStatus.rawValue)     let myLocationManagerAuthStatus = myLocationManager.authorizationStatus.rawValue     if myLocationManagerAuthStatus == 3 || myLocationManagerAuthStatus == 4 { //get BSSID     print("we're authorized")     currentWAPMAC = getBSSID()     }     //set up the SSID value     currentSSID = getSSID()     //get the Wifi Channel. if it's a zero,     //channel is actually nil     currentChannel = getCWChannelNumber()     //set up the RSSI     signalStrength = getRSSI()     //BRING THA NOIZE     signalNoise = getNoise()     //get the SNR as a formatted string via NumberFormatter     signalToNoise = getSNR(theSig: signalStrength, theNoise: signalNoise)     //get transmit rate     dataRate = getTransmitRate()     //get current time     self.theCurrentTime = getCurrentTime()     //stop the timer     self.stopTimer()     } create the interface object: func getWifiInterface() -> CWInterface { let theWirelessClient = CWWiFiClient.shared() let theWirelessInterface = theWirelessClient.interface() return theWirelessInterface! } //moved this from contentview to here. Probably a better place for all this var theWifiInterface: CWInterface = getWifiInterface() the getBSSID() function: func getBSSID() -> String { if let theBSSID = theWifiInterface.bssid() { return theBSSID } else { let theBSSID = "no BSSID" return theBSSID } } So on run, print(myLocationManager.authorizationStatus.rawValue) prints a 3, so cool, we're auth'd and the dialog has been appearing nice and consistent-like and the  if myLocationManagerAuthStatus == 3 || myLocationManagerAuthStatus == 4 { //get BSSID     print("we're authorized")     currentWAPMAC = getBSSID() } prints "we're authorized" as expected, but no BSSID returned. Everything else, the SSID, the channel, the Signal/Noise strengths, the Data Rate, that I get fine, but I can't get the BSSID. I know I'm missing something simple, but i'm completely puzzled as to what. Thanks!
Post not yet marked as solved
2 Replies
Thanks! Took me a hot sec to figure out this wasn't in the contentview file, but once I stopped being dumb, I got this: struct WiFi_AnalyzerApp: App { //implement AppDelegate custom class so we quit on closing window @NSApplicationDelegateAdaptor(AppDelegate.self) var appDelegate     var body: some Scene {   WindowGroup {   ContentView() //set up the min/max size   .frame(minWidth: 785, maxWidth: 785, minHeight: 212, maxHeight: 212)   }     //lock it down so you can't change it   .windowResizability(.contentSize)     } } and it's working exactly as I wanted. Thanks!
Post marked as solved
6 Replies
is there any sample swift code showing how to do this? Also, is anyone going to update bssid() in CoreWLAN to reflect this requirement? I mean, it might be nice so you don't beat your head against a wall trying to work around a bug that isn't.
Post not yet marked as solved
2 Replies
I haven't seen that myself, even using the finder, so it may just be that user. However, you don't need the finder for that anyway. Display Dialog is part of the standard additions so: osascript -e 'display dialog "Hello, World!"' works without involving the Finder. you may also want to check various Library/ScriptingAdditions/ folders to see if there's maybe not some older third party thing causing you issues. (Adobe has caused this issue a lot for people over the years)
Post marked as Apple Recommended
I hit this too, but blowing out the script debugger component fixed it. And the recreated component didn't cause any problems. So looks like that's a good fix for the osacompile issue. One thing I noticed is that when I ran osalang -l, the system was VERY confused about what languages it actually had. doing the remove and renew with the SD component fixed that as well.
Post marked as solved
3 Replies
Yes, fairly easily. If you look at outlook’s dictionary, the code for a selected item is not radically different than in Mail.
Post marked as solved
6 Replies
In general, the Pro Apps team has never seen any use in the kind of automation you're talking about. I've been trying for decades with no luck. Even told them I'd eat a deep-fried sock if they fixed that.Adobe's not any better in the AV space. You may want to look at some of the stuff written by indie devs.