Posts

Post marked as solved
3 Replies
1.1k Views
Thanks in advance to all. I am sure I am doing something stupid here. This is a macOS project and I am trying to update an image view using a variable, not the quoted name of the image as done here: self.myAppIcon.image = NSImage(named:"microsoft.png")That works fine and the app will show the default image on load and then change to the named image ("microsoft.png") when requested. However, when I try to get it to use a variable in the place of the quoted string, I am not getting the app to update to image.I assumed I could just use something like: self.myAppIcon.image = NSImage(named: self.theIcon)where theIcon is set by loading a string from a file read from disk. All the images are in the project and all load is called explicitly. Here I am reading from a file to get the image name: let myIcon = try String(contentsOf: iconURL, encoding: .utf8) self.theIcon = myIconWhen I print myIcon I see the value being read properly from the text file. Changing the text file will show the new value on next call. However, the image view does not update. I've tried quite a few variations but either I get a class mismatch (image not string, data not string, etc), or I thow execution errors.How do I reference a variable to allow the NSImage to update based on a dynamic value? Isn't NSImage(named: String) a string value? Shouldn't I be able to replace that quoted String with a variable that is a string?Appreciate any help. I suspect this is a remarkably simple solution but I am too deep into the forest to see the trees at this point and likely need to step away.
Posted Last updated
.
Post not yet marked as solved
2 Replies
2.5k Views
I've read the support article reported by Terminal (HT208050) but the article does not provide an explanation for why the change is being implemented. I recall the tcsh to bash transition back in 10.3 and if I recall, the reasoning appeared to be the greater acceptance of bash in the community beyond OS X (those were some bygone days). But in those days, there was no a lot of prior work, solutions, and documentation built on OS X as it was still gaining acceptance. But 12 operating systems have passed and significant tools and solutions exist in bash, especially in the Jamf community, I am curious to understand why the change is being implemented. Obviously bash scripts will still run, and switching back is trivial. Just wondering if someone could share the reasoning for the switch. Is there a bash security or function concern that I've missed? Does zsh have some innate superiority over bash?Again, this is really to satisfy my curiosity. Appreciate any feedback.
Posted Last updated
.
Post not yet marked as solved
3 Replies
2.7k Views
I've just tried moving from Xcode 10.1 to Xcode 10.2.1. Now projects that include a WebView Kit UI element are behaving oddly. So I decided to start simple:1: Create new Xcode Project > macOS > Cocoa App2: Choose Language Swift and Use Storyboards is checked3: On the Main.storyboard, drag and drop a WebKit View to the main view controller - nothing else added to the controller - no code written4: Add:import WebKitto ViewController.swift5: Run the app via Build and RunThe app will compile and launch. However, it appears to never finish initialization. Attempts to use Command Q will not quit the app, however, going to the app menu and choose quit will quit the app. Nothing appears in the debug area.Ah, but, now right click on the .app in the Products folder and choose Show in Finder. Opening the app from there will immediate crash the app.If I repeat the steps above, but connect the WebKit View to my ViewController.swift, then I get a blank window when run from the Finder (the WebKit UI does not appear). For example:1: Create new Xcode Project > macOS > Cocoa App2: Choose Language Swift and Use Storyboards is checked3: On the Main.storyboard, drag and drop a WebKit View to the main view controller - nothing else added to the controller - no code written4: Add:import WebKitto ViewController.swift5: Connect WebKit View to my ViewController.swift creating@IBOutlet waek var myWebView: WKWebView!6: Run the app via Build and RunIn this case, doing a Build and Run will show the expected interface but Command Q still will not quit the app. But then it gets odder. If I run the app from the Finder, I get a blank Window with NO UI elements. So creating the outlet prevents the crash on launch, but then my UI is no longer visible. Meanwhile, Command Q will quit the app when run from the Finder!?!I am confused by this change.So I am rolling back to 10.1 as the same project will run as expected in both the debugger and when launched from the Finder. Likewise, if I perform the procedures above on a machine with Xcode 10.1, I get the expected results. The app will run in the debugger, accept the Command Q to quit, and run when launching from the Finder. My custom UI appears in all cases.Have I missed something in 10.2.1 regarding how to place and use a WebKit View? Any help would be appreciated. I've never experienced an issue like this as I tend to create the interface first before hooking up code. Now UI prototyping appears to be impossible when a WebKit View is involved.Thanks for looking.
Posted Last updated
.