Extelligent Cocoa
Because one brain is not enough
RSS
  • Home
  • About…
Learn Core Data in 50 Easy Steps!

Mar 10 2017

Learn Core Data in 50 Easy Steps!

Find out how at #iOSCon on 31/3 in London… As the title ever-so-gently suggests, CoreData is a complex framework, offering many pitfalls for the wary and unwary alike, and which cannot be learnt in an afternoon. I’ll explore a strategy to break the task of ‘learning CoreData’ into managable chunks, based on the principle that […]

By Extelligent Cocoa • Frameworks, Teaching Programming • • Tags: #iOSCon, conferences

Feb 21 2017

From the ‘don’t try this at home’ files

Source hidden to protect the guilty (who otherwise write very good code, but this jumped out) let urls = FileManager.default.urls(for: .libraryDirectory, in: .userDomainMask) print(urls[urls.count-1] as NSURL) For the searchMask .libraryDirectory, this function always returns an array containing a single URL, [file:///Users/username/Library/] so urls[urls.count-1] will give you urls[0], but it’s not clear from the code that […]

By Extelligent Cocoa • Design Patterns, Teaching Programming •

Feb 16 2017

TDD Basics

This link points to a series of blogposts on TDD (test-driven design) which explains the process very clearly, with a follow-along example. I have reservations about the process, but this is a good place to start if you’re interested.

By Extelligent Cocoa • Application Design, Resources •

selectionDidChange

Jan 31 2017

selectionDidChange

I’ve just discovered an unwelcome difference between func tableViewSelectionDidChange(_ notification: Notification) and func outlineViewSelectionDidChange(_ notification: Notification) (NSOutlineView inherits from NSTableView, and the protocols share a lot of similarities). When there is no valid selection in an NSOutlineView, outlineviewSelectionDidChange fires, and outlineView.selectedRow is -1. When there is no valid selection in an NSTableView, tableViewSelectionDidChange does not […]

By Extelligent Cocoa • Bug Reports • • Tags: NSOutlineView, NSTableView

NSOutlineView Part 2: Making the outlineView useful

Jan 15 2017

NSOutlineView Part 2: Making the outlineView useful

Xcode 8, macOS 10.12, Swift 3.0 In Part 1 of this tutorial, we created an outlineView that, thanks to a SourceListItem protocol, was indefinitely flexible: you can have different classes on several levels, or indefinite levels (though it is probably wise to limit this programatically so you don’t nest too deep. It all depends on […]

By Extelligent Cocoa • Application Design, Bug Reports, Interface, Tutorials, Wiki • • Tags: NSOutlineView, SourceList

Finding the index/indices of an element in an array

Jan 15 2017

Finding the index/indices of an element in an array

Swift 3, macOS 10.12 class Food { var name: String = “” init(name: String){ self.name = name } } let chocolate = Food(name: “Chocolate”) let spinach = Food(name: “Spinach”) let greenTea = Food(name: “Green Tea”) let favouriteThings = [greenTea, chocolate, greenTea, spinach, greenTea] If your element conforms to the equatable protocol or inherits from NSObject, […]

By Extelligent Cocoa • Operators, Wiki • • Tags: array, index

NSPopover and storyboards

Jan 12 2017

NSPopover and storyboards

macOS 10.12, Xcode 8.0, Swift 3 Storyboard segues make it exceedingly easy to create popovers, but sometimes you want to customise your popovers a bit more, for instance make windows detachable. When building interfaces the old-fashioned way with xib files or in code, you would use the NSPopoverDelegate protocol and wire things up appropriately. Storyboards […]

By Extelligent Cocoa • Interface, Wiki • • Tags: NSPopover, NSPopoverDelegate, storyboards

Blog Update: macOS Sierra

Jan 10 2017

Blog Update: macOS Sierra

I have finally made the switch to using Sierra as my main OS, so from this point onwards, all code will be linked to the macOS 10.12 SDK. Of the three options – supporting legacy software, and risking that advice does not work on the current system, keeping two (or more) versions of code updated […]

By Extelligent Cocoa • EC Meta •

The incredible invisible window

Jan 10 2017

The incredible invisible window

OSX 10.12, Xcode 8.0 I’m not entirely certain under which circumstances this is useful, but [code language=”plain”]class invisibleWindowController: NSWindowController { override func windowDidLoad() { super.windowDidLoad() self.window?.isOpaque = false self.window?.backgroundColor = NSColor.clear } }[/code]   is a thing of beauty. If the view in the window’s contentViewController overrides override func draw(_ dirtyRect: NSRect), the effect is […]

By Extelligent Cocoa • Interface, Wiki • • Tags: NSWindowController

Awesome Extensions: Selector

Jan 8 2017

Awesome Extensions: Selector

Credit for extending Selector goes entirely to Andyy Hope (@AndyyHope) who posted this article on Medium: He looks at the problem of Swift selector syntax being somewhat unwieldy, and turns it into [code language=”plain”]fileprivate extension Selector { static let buttonTapped = #selector(ViewController.buttonTapped(_:)) }[/code]   Thanks to fileprivate, you don’t get namespacing conflicts. Awesome. So I […]

By Extelligent Cocoa • Extensions, Wiki • • Tags: NotificationCentre, NSNotification.Name, Selector

«< 2 3 4 5 6 >

Categories

  • Application Design
  • Bug Reports
  • Coding Meta
  • Design Patterns
  • EC Meta
  • Extensions
  • File Handling
  • Frameworks
  • Graphics
  • Interface
  • Operators
  • Real World Swift
  • Resources
  • SpriteKit
  • Teaching Programming
  • Tutorials
  • Wiki

Recent Posts

  • NSOutlineView: Saving expansion status
  • Saving a font to UserDefaults
  • Disclosure Triangle (Autolayout)
  • NSColorWell/NSTextField Bug
  • Get the modification (or creation) date of a file

Archives

  • August 2020
  • March 2020
  • September 2019
  • January 2019
  • August 2018
  • May 2018
  • March 2018
  • February 2018
  • January 2018
  • December 2017
  • November 2017
  • October 2017
  • July 2017
  • June 2017
  • March 2017
  • February 2017
  • January 2017
  • December 2016
  • November 2016

Recent Wiki

  • Saving a font to UserDefaultsSaving a font to UserDefaults
    (Here using macOS 13, Xcode 10, Swift 4.2, but
  • Get the modification (or creation) date of a fileGet the modification (or creation) date of a file
    Xcode 10, Swift 4.2, macOS 10.13 func
  • NSDocumentController basicsNSDocumentController basics
    Xcode 10, macOS 13.5, Swift 4.2 Without wanting to
  • NSStackView TutorialNSStackView Tutorial
    (Xcode 9, macOS 10.12, Swift 4) Stackviews exist
  • Filetypes and UTIsFiletypes and UTIs
    macOS 10.12 (I will update this post once I’ve

Tags

AppDelegate Autolayout closures Codable containerView Core Data disclosure embed view enums FileAttributeKey FileManager generics initialFirstResponder NSAlert NSApplication.ModalResponse NSApplicationDelegate NSButton NSCoding NSColorWell NSDocumentController NSFont NSFontDescriptor NSImageView NSKeyedArchiver NSKeyedUnarchiver NSOpenPanel NSOutlineView NSPopover NSSavePanel NSScrollView NSStackView NSStoryboardSegue NSTextField NSTextFieldDelegate NSTitlebarAccessoryViewController NSToolbar NSToolbarItem NSView NSWindowController sheets singletons SKView storyboards UserDefaults zoom

↑

© Extelligent Cocoa 2023
Powered by WordPress • Themify WordPress Themes