How to create NSCollectionView programmatically from scratch?

I’m not sure there’s much insight in creating a collection view programmatically and without bindings, but here it goes. Introduction There are essentially four components when using a collection view: View: a subclass of NSView, responsible for displaying information; The collection view itself; View controller: a subclass of NSCollectionViewItem that serves as the collection view … Read more

When using Swift Package Manager how can I generate an Xcode project file for development

Update: as mentioned in other answers, you can now generate Xcode project files with this command: swift package generate-xcodeproj Original answer: The Swift Package Manger (SPM) is cross platform, It works on Mac and Linux. The Xcode is Mac OS only, so I don’t think SPM will be hard integrate to work with Xcode. SPM … Read more

How can I force Xcode to retain my indentation when I copy and paste?

Works as intended. …Objects: and forKeys: should be aligned as they form part of the same method signature. It might be easier to format your code if you use the new object literal syntax: – (int)minBrokenPieces { NSDictionary *mapping = [NSDictionary dictionaryWithObjects:@[@”3″, @”4″, @”4″, @”5″, @”6″, @”7″, @”8″] forKeys:[Note types]]; [(NSString *)mapping[self.note.type] integerValue]; } As … Read more