Blog

Passing a NSPopUpMenu item to a function as a variable?

So, what I’m trying to do is a call a function that builds a project based on a number of factors. What I’m focused on at the moment is how to declare a parent project in the function based on, for one example, an NSPopUpMenu/NSPopUpMenuItem. The function is declared like so:     func newProject(title: String, author: String, created: Date, reference: String?, mssName: String?, elementsName: String?, researchName: String?, trashName: String?, parent: (something goes here)?){ all the setup code }   Now, I don’t really need to go into all the nitty gritty details about what I’m doing here, but the thing that’s got me stumped is that last value:   parent: (somethin... »

Changing the delegate of an NSWindow, NSTabView, or NSSplitView managed by a NSWindowController, NSTabViewController, or NSSplitViewController respectively is not supported and will assert.

I see in the release notes of 10.13:   Changing the delegate of an NSWindow, NSTabView, or NSSplitView managed by a NSWindowController, NSTabViewController, or NSSplitViewController respectively is not supported and will assert. When building using Xcode 9 or later, Xcode will now automatically set the delegate outlet on these objects to their owning controllers. If the application was previously changing the delegate of these objects programmatically after view/window loading, the application will now assert.   Ignoring NSSplitViewController, and NSTabViewController because I don’t usually use those, what is the justification for not allowing one to set a window’s delegate to an... »

change constraints in code

If I’ve already set contraints using code in iOS, how do I change the constraits? Powered by WPeMatico »

Throw error at compile time on “release”, but not on “debug” on certain conditions

I want to implement in my code “fatalError()” as per this article: https://cocoacasts.com/what-is-fatalerror-in-swift-and-whe…/. I would like to know if there is a way when you run your code on “release” instead of “debug”, XCode gives you an error that you have “fatalError()” function in your code. “fatalError()” is just an example. I may want to give me the same error if I forgot to take out some random UIAlertController or something else that was meant just for development and testing. So, some customizable solution to not let me build in release if I have *blank* in my code. Thank you! Powered by WPeMatico »

PopToRootViewController isn’t working

All that I’m trying to do is go back to the Root View Controller, when the user clicks the back button. I’ve tried to push to the controller, and it works fine, so the problem does not seem to be with the button. It’s the first view controller that is shown when the app is started, so I don’t see how it woulden’t be on the bottom of the stack (as the root view controller). I might just be overlooking a simple detail.   PopToViewController would also work for me, but I did not have any luck with that either.   Here’s the code:       @IBOutlet var toolTable: UITableView!        var data = ["  Data1", "  Data2"]     var identities = ["A", "B"]        override... »

Skip to toolbar