WWDC: Scanning the topics

auditorium-2-1380002-m

Plenty of room in the WWDC calendar this year for various Dev Tool topics. The 5 announced Swift sessions (Improving Apps, Protocol Programming, Optimization, Profiling, and Value Types) all sound exciting, but there are also (if I’m counting correctly) 9 other slots, which I hope have details of Xcode 7, Swift 2, and Better-IB-that-finally-works-smart.

There are 4 “Featured” slots in addition to the Platforms SOTU and the keynote, all on Tuesday. Any ideas?

Finally, what’s interesting to me about the “What’s new” talks is the one that seems to be missing: “What’s new in Cocoa Touch” What’s up with that? Last year there were 15 What’s New topics, of which one (What’s new in Xcode 6) used a spoiler-ish version number.

Swift: Five Things about Core Foundation

baby-feet-1-1208788-m

Pardon me, sir, your Ref is showing. Here are five important things you might not know about using Core Foundation in Swift.

1. You don’t need to use “Ref” at the end of the name. 

Screen Shot 2015-05-28 at 8.23.25 AM

Swift remaps type names to ignore the dangling “Ref”. In Swift, all classes are actually reference types and the suffix isn’t needed.

Apple writes: “When Swift imports Core Foundation types, the compiler remaps the names of these types. The compiler removes Ref from the end of each type name because all Swift classes are reference types, therefore the suffix is redundant.

2. CFTypeRef is AnyObject.

Just substitute AnyObject in anywhere you’d use CFType or CFTypeRef.

Apple writes:, “The Core Foundation CFTypeRef type completely remaps to the AnyObject type. Wherever you would use CFTypeRef, you should now use AnyObject in your code.

3. Core Foundation is automatically memory managed.

Yes, there are a few remaining scraps here and there that aren’t properly migrated (you’ll know them because they return Unmanaged instances) but for the most part you don’t  have to CFRetain, CFRelease, or CFAutorelease anything.

Apple writes, “Core Foundation objects returned from annotated APIs are automatically memory managed in Swift—you do not need to invoke the CFRetain, CFRelease, or CFAutorelease functions yourself.”

4. Toll Free Bridging is largely invisible although not perfect.

Wait a few weeks. It will probably get better.

Screen Shot 2015-05-28 at 8.33.36 AM

Apple writes, “In Swift, you can use each pair of toll-free bridged Foundation and Core Foundation types interchangeably. You can also bridge some toll-free bridged Core Foundation types to Swift standard library types if you cast to a bridging Foundation type first.”

5. Annotate your objects

When you build custom CF objects from your own C or Objective-C methods, annotate them with CF_RETURNS_RETAINED or CF_RETURNS_NOT_RETAINED. Swift uses these hints to automatically memory manage your results. Thanks Cocoa Kevin, who taught me this: “The CoreFoundation naming rules is not enough according to the Swift compiler. If you don’t decorate your methods or functions then CoreFoundation objects will be returned as unmanaged.”

Jordan Rose adds that the CF_IMPLICIT_BRIDGING_ENABLED and CF_IMPLICIT_BRIDGING_DISABLED macros enable the compiler to infer usage from naming, aka the “trust the naming convention” macro.

Apple writes, “If you return Core Foundation objects from your own C functions and Objective-C methods, annotate them with either CF_RETURNS_RETAINED or CF_RETURNS_NOT_RETAINED. The compiler automatically inserts memory management calls when it compiles Swift code that invokes these APIs.”

 

Review: Developing for the Apple Watch

Screen Shot 2015-05-28 at 7.03.43 AM

Jeff Kelley’s new book is short. How short? Under a hundred pages short. That’s because it’s part of Pragmatic Programmer’s new Pragmatic exPress series. Developing for the Apple Watch ($11 Ebook $17 Paper, $27 Combo) offers exactly what it says on the label, a quick, focused take on Watch development.

With only 100 pages to worry about, this is a terrific series for getting information to the market quickly and effectively. I love how Pragmatic is pivoting to handle Apple’s quick-change reality.

Read On…

A different kind of ad support

cola-1417698-m

I was recently discussing ads on IRC with some fellow developers. In many ways, ads currently form more a barrier that can be removed with IAP than a revenue stream in and of themselves. They’re commonly a gateway for try-than-buy. Could there be another approach?

Read On…

Bits and bobs: May 27

Upcoming Webcast

Just 2 weeks left until WWDC. Will it be as disruptive this year as last? Probably no new programming languages although all the buzz suggests Swift will update to version 2.0 and include major new features. I’m guessing that 1.x will persist for App Store submission until around September.

Regardless of what’s announced, I’m going to present a webcast that I’ve tentatively titled “So that happened: Cool stuff about new Swift features” on June 18th at 1PM ET. I’ll link up the Pearson landing page when we get closer to the event for anyone who wants to pre-register.

Speculation

At WWDC, it would be nice to finally see a TV API, although I’m not holding my breath. Rumors point to new streaming media services further expanding Apple’s presence in this contested arena but nothing much about developer-facing APIs.

Otherwise I’m ready for iOS 9 and OS X 10.11 to be a thing. There’s a certain satisfaction in there even being a 10.10. I remember  skepticism when I predicted that after 10.9, Apple would move to 10.10 instead of rounding up to 11.

I expect there will continue to be a big focus on the new watch, Research and Health Kit at WWDC. Swift, iCloud storage, Metal development, internationalization, App Store, and power optimization (battery power that is, not the power of awesome) are likely session focuses in addition to whatever new tech gets introduced. Lesson: Avoid pre-writing posts too far in advance. A preliminary schedule for WWDC has been posted.

Anticipating WWDC creates an atmosphere of both fear and excitement. I really wish Apple would consider moving it to late Winter or early Spring to take some of the pressure off the death-march to Christmas Sales.

DevMate

MacPaw, the people who brought you CleanMyMac, have announced DevMate, which includes support for sale and distribution outside the Mac App Store. It seems to offer a combination of product licensing, Sparkle-like app updates, user feedback support and crash reporting in addition to industry standard analytics.

Normally “maker of CleanMyMac” wouldn’t be a big selling point but the feature set looks surprisingly interesting, especially since in-store sales can be quite limiting.

Screen Shot 2015-05-27 at 11.41.59 AM

Pricing starts at a free level, with up to 1000 current users, 500 deliveries, and 50 activations per month. Activations are “the number of activated copies during payment period”, which I assume corresponds to sales. The price then ramps up from $39/month (about 3 sales a day, if I’m doing the math right), with increments to the activation numbers, active users, and updates at each level.

More information at the DevMate website, along with a bunch of testimonials.

Swift: The Good Switch of the East

plug-and-switch-1098753-m

Ding Dong, the switch isn’t dead. It lives in Swift as a practical control structure. If if-then-else statements are Radio Shack, switches are the Container Store. Switches add boutique code organization, coalescing run-on conditionals (if then else if then else if then else….) into well-organized flows.

Here’s more than you wanted to and less than you probably need to know about this terrific Swift feature.

Read On…