Archive for April, 2015

Swift: A little @autoclosure hacking

lines-1446394-m

Today, I decided that UIView animations really needed autoclosures. I felt that an in-line property assignment like this:

UIView.animate(2.0, view.backgroundColor = .blueColor())

was more aesthetically pleasing than the default syntax in the following examples, which can be written with or without trailing closures:

UIView.animateWithDuration(2.0, animations:{view.backgroundColor = .blueColor()})

UIView.animateWithDuration(2.0){
    view.backgroundColor = .blueColor()
}

Read On…

Swift: Things I wish existed

swift-og

Xcode Clippy for Swift

It looks like you’re attempting to define a string. Do you want me to automatically convert all @” constructs to  ?

Do you want me to auto-strip all extraneous parentheses around if-conditionals?

It looks like you’ve added an enumeration prefix? Would you like me to alert you whenever I see these or automatically remove those not needed for type inference?

Would you like to hear me rant about Swift for your entertainment?

Swift: Odd things you discover when messing around

If you grab this path when you start working with a playground:

Then if and when things start messing up and the console isn’t  updating correctly, you can sometimes see the diagnostics messages there instead.

Also of help, opening the System console. You’ll be shocked by how many errors a standard playground generates per minute.

Like the hacks? Read the book.

Review: Reflector 2 for Air Play and ChromeCast Mirroring

Apple hasn’t been kind to Squirrels the creators of AirParrot and Reflector. Features of their AirPlay utility apps have now been integrated into OS X and QuickTime. You can natively share your desktop to Apple TV (formerly an AirParrot-only feature) or record iOS screens (just as provided by Reflector).

Of course, Squirrel’s versions do both a little bit better. AirParrot lets you choose which window to share and offers far more control. Reflector in turn enables you to record video from any iOS device, not just the lightning generation. So if you’re looking to use these features from older OS’s and older devices, there’s no better solution out there.

Now Reflector 2 adds further support to the mix. The newly updated app introduces ChromeCast mirroring so you can set your Mac as a cast destination. Unfortunately after kicking the wheels the newly released app seems just a tiny bit away from being ready for prime time.

I tested the mirroring from Chrome on Mac.  On the same Mac, Chrome mirrored flawlessly (albeit pointlessly) but I encountered errors when attempting to cast from a second Mac. My browser saw Reflection 2 and the connection was successfully acknowledged at both ends but no video was ever presented even after rebooting and updating Chrome.

On iOS, I tested using both YouTube and Pandora, both on iPad and iPhone. My branded ChromeCast hardware appeared in each app but not the Reflector 2 destination. (And, sadly, my first generation Kindle Fire was completely useless for any practical purpose of testing. I couldn’t get any apps, even “ChromeCast enabled” ones, to even show the option.) In all cases, my hardware shared a common network with both the hardware and the emulated Reflector 2 ChromeCasts.

And, of course, both devices worked fine with Air Play and Reflector 2. The transmission came through clear and trouble-free as expected.

Reflector 2 is $14.99 and offers a 7-day free trial. I’m hoping updates will quickly sort out the ChromeCast issues I experienced but even without that support, Squirrel’s AirPlay suite are terrific for anyone developing for iOS or presenting and recording demos from their devices.