Xcode Crash when trying to drag NSCollectionView to storyboard - swift

I am trying to add a nscollectionview to my OSX project but this will causes Xcode to force-close:
Every time when I am dragging the collectionview into the storyboard Xcode will be force close.
I do not know either I am the only one having this problem or everyone else has work around solution.

This seems to happen when targeting operating system verisons that don't support macOS 10.11+ UIKit-style NSCollectionViews.
I was able to get an "old-style" collection view into a storyboard by dragging one into a xib file, then opening it as XML text and copy-pasting the <collectionView> into the <subviews> of a parent view in the storyboard file.

Related

NSSplitViewController's 'view' outlet should not point to its NSSplitView; use the 'splitView' outlet instead

I've been developing a macOS app using a storyboard that defines a main window with toolbar and splitview. It's written in Swift 3 -- I have not migrated to Swift 4 yet. The splitview has a pane for graphics and another for a text log; both scroll. I have view controllers for all three; the two subsidiary scenes are tied to the split view with relationships. This worked up until today when I installed Xcode 9 beta 4. (Yes, I have beta 3 in the trash at the moment and can revert)
Upon cleaning the build folder and compiling, I get the error
NSSplitViewController's 'view' outlet should not point to its NSSplitView; use the 'splitView' outlet instead
However, the NSSplitViewController subclass has no outlets defined (its two children arrange to tell it of their existence in their viewDidLoad methods). Moreover, I don't seem to be able to create an outlet between that window and its controller that would have created the error in the first place.
I now also note that the split drawn in the split view controller's scene is horizontal instead of vertical as it had been. I don't see a way to change that. (I can't run the app, so I don't know if it matters. I suspect it does.)
The net result is that I can't see what the error is trying to tell me. The error prevents the application from building and running, whereas with beta 3 it worked. I'm hoping someone can explain what Xcode is telling me and how to fix it.
I did fix this in my own Storyboard. In the outlets window, I saw that the view outlet was indeed assigned to the NSSplitView. I deleted it. It was also assigned to the splitView outlet, so the change did not seem to effect anything.
The warning went away and my project then did build.
I have no idea if this was always that way and compiler update changed or if this was somehow inadvertently set differently in some way. It makes sense in any case, the NSSplitview should be assigned as the splitView outlet, not the view outlet.

Integrating xib file to stroyboard under UI scrollView?

As in the screenshot 1, I am trying to design view that is longer then screen size of iPhone.
and in second screenshot I changed the size to freeform which is giving me liberty to create longer view than iPhone's length.
My question is is it a standard way to solve this problem. where as my understanding was that we are not suppose to use xib files anymore after storyboard because every thing was moved to storyboard.
So to solve this this problem Do I have to use view(xib) and make it as subview of UIscroll view.
is that a standard way to solve these kind of problems or do we have something with storyboard equivalent which is more efficient ?
PS: I have been researching this problem from past few days. All related questions over here and web, are adding UIView programmatically to ViewController but not a single example I found where one is designing the UIView in Xcode thru xib file and adding it to UIScroll View. Which is common real world problem. all the app where views are longer or wider than screen size are not done programmatically all together. At least I think they are being designed and them added to the Viewcontroller. Please correct me If I am wrong.
The answer is, as it's always been on iPhone, modal views which come and go as needed. You can temporarily add child view controllers, alert views, 3rd party iphone compatible popover knockoffs....
Of course UIView still exists - so where is the problem? What you probably mean is that you cannot set an UIView in a storyboard, storyboards only contain view controllers. But you can still make a xib file containing an UIView of any size you like, and add that one to your scroll view.

How to load a xib file from a storyboard?

I am new to iOS programming and I am working on a project which will use both XIB files and storyboard.
I have two modules in it basically. First module is made from XIB files which also runs independently. I have made another module using storyboard and I had to integrate these two independently running modules. The screen of my first module which I want to connect to my storyboard is a subclass of UIViewController and I was able to do that with the help of stackoverflow (How to load a storyboard from a XIB file?) by creating an object of UIStoryBoard. Now my application is able to go to the storyboard but I can't come back to my first module which is made up of XIB files.
Please let me know how can I connect to the same instance of the last screen of the first module through which storyboard is called so that I can move back and forth through these views easily. Connecting to the same instance of the XIB file is important because it is a chat screen and when I come back to this screen, I would like to get back to the chat where I had left it and also when I come back to the storyboard (by clicking a button on the chat screen) I have a slider on the screen which should display the value which the user must have chosen when they were on this screen last time. I guess creating a new object should give me a new screen which won't work in this situation. This kind of mechanism works well within storyboard with the use of segue where we can define both source and destination view controller.
Please help me achieve the same in my situation.
Please also check the screen shots of the XIB file and the storyboard which I want connected.
Thanks.
Convert the nib files into storyboard, it will help you easier to manage your application.
Well in your case, what i see is from nibs is that there is a navigation controller in storyboard and also there will be a root view controller navigation controller from xib files.
Well the navigation controller stack has all VCs you pushed into and you can get back it in different ways.

Link IBOutlet to both iPhone and iPad Storyboards

I am writing a universal application. As far as I can tell, it's not possible to use Interface Builder to link an IBOutlet, which is already linked to the iPhone storyboard, to the iPad storyboard?
What are possible workarounds for this? Should I just edit the storyboard via text editor?
It doesn't really seem sensible to have an IBOutlet for each device if it's the exact same element behaving in the exact same fashion.
Cheers-
You should be perfectly capable and able to add IBOutlet's to both an iPhone_Storyboard file and likewise the same IBOutlet's on an iPad_Storyboard file. What does it appear to be doing, simply detaching your previous connection in the other Storyboard file?
I've done this on multiple universal applications without an issue.
I ran into this issue as well. My problem was that I forgot to make sure that the Custom Class of the UIView were the same in both the iPhone and iPad versions of the storyboard. After fixing that, Xcode instantly let me connect the outlets.

Top cell in UITableView hidden behind UINavigationBar

I have a UINavigationController controlling a stack of UIViewControllers. When I push a certain UITableViewController onto the stack, I find that the top row of its UITableView is hidden behind the UINavigationBar.
This problem only happens on the iPad, not the iPhone. I am using the same stack on both.
Also it only happens on one of my controller stacks. I push the same UITableViewController subclass on stacks controlled by two other UINavigationControllers, and there is no problem.
One difference in the problem case is that the UITableViewController is pushed from a UIViewController that is displaying the results table generated by a UISearchDisplayController. I don't see why this should matter (and, as I said, on the iPhone it works fine), but maybe it is significant given that a UISearchDisplayController hides the navigation bar when the UISearchBar becomes first responder.
The problem affects both the iPad device and the iPad simulator. I am using a typical UISplitViewController design, with these stacks in the left hand pane. The problem still occurs in the popover when in portrait.
I had the same problem after migrating an iphone app to a universal app. Here is what solved the problem for me. open your MainWindow.xib and dbl-click the window object. If it opens in iphone size you need to upgrade your nib. Select the document window and choose the menu item File > Create iPad Version. Save this nib with the name MainWindow-iPad.xib. Delete you original MainWindow.xib and add this one instead. After doing these steps problem disappeared and works fine for me on both iPad & iPhone.
Cheers, Harry