Type does not have a member

You cannot initialize an instance class property referencing another instance property of the same class, because it’s not guaranteed in which order they will be initialized – and swift prohibits that, hence the (misleading) compiler error. You have to move the initialization in a constructor as follows: let components: NSDateComponents init() { self.components = myCalendar.components(.CalendarUnitYear … Read more

How do I run Asynchronous callbacks in Playground

While you can run a run loop manually (or, for asynchronous code that doesn’t require a run loop, use other waiting methods like dispatch semaphores), the “built-in” way we provide in playgrounds to wait for asynchronous work is to import the XCPlayground framework and set XCPlaygroundPage.currentPage.needsIndefiniteExecution = true. If this property has been set, when … Read more