Skip to content

Instantly share code, notes, and snippets.

View vprtwn's full-sized avatar
🌀
𓊍

Ben Guo vprtwn

🌀
𓊍
View GitHub Profile

Working with Cocoa

Implicitly Unwrapped Optionals

  • A value of class type in Swift is never nil
    • var fileModificationDate: NSDate!
  • Objective-C does not have a notion of a "never-nil" pointer
  • ! is an implicitly unwrapped optional
    • can be tested explicitly for nil
    • can directly access properties/methods of the underlying value
    • can be implicitly converted to its underlying value

WWDC 2014 Brain Lanier

Optionals

  • Cleaner alternative to using sentinels (NULL, NSNotFound, etc.) to represent invalid values
  • optionals are initialized to nil by default
    • var optionalNumber: Int?
  • nil is a sentinel value that works with any type
  • value is wrapped in optional by setter
    • optionalNumber = 6

New iTunes Connect

Analytics

Metrics

  • app store views
  • installs
  • sessions
  • active devices
  • retention
  • stickiness
@vprtwn
vprtwn / README.md
Last active July 3, 2023 14:07
Force Editor + Pan/Zoom

Drag from an existing node to add a new node or link. Click to select/deselect nodes/links. Hit the DELETE key to remove the selected node or link. Drag to pan. Scroll to zoom.

Built with D3.js.

@vprtwn
vprtwn / README.md
Last active June 30, 2022 14:33
Force Directed Graph Editor

Drag from an existing node to add a new node or link. Hit the DELETE key to remove the selected node or link.

Built with D3.js.