Old Apps

A cute little monkey.I got an email from Apple a week or so back letting me know I needed to upgrade one of my apps to 64-bit. I knew right away it was Arrgly but wasn’t really sure if I wanted to update it.

On Sunday morning I received an email from an Arrgly user asking if I was going to update it because he likes the app. It felt good to know someone else found my goofy app useful. I decided at a minimum I’d publish a little framework someone else could use to write their own version of the app if I couldn’t get to it, or couldn’t finish it on time.

It took less than an hour to create the project and get it published. If you’re doing Mac or iOS development and you need to shorten or expand URL’s for a YOURLS based service you’re welcome to use YOURLSKit. It’s all Swift 3 but should be fine with Swift 4 projects and iOS 11 or macOS High Sierra. It’s a tiny bit of code, but it does the job.

MacBook Reviews

Joe Cieplinski: “Here’s the thing about this MacBook: I’m drawn to it. I don’t know if it’s the small size of the thing that just makes it more lovable, but I’m already finding more excuses to use this machine than I ever did with my 13-inch MacBook Pro.”

Casey Liss: “I haven’t regularly handled a full-size iPad since the iPad 3, but the MacBook feels to be roughly the same size in-hand. In actuality, the MacBook is 150% the weight of the iPad 3, but the fact that I’m even making that comparison should indicate how light it feels.”

For these two it pretty much boils down to size. It’s the laptop version of the iPad. Compact, light, easy to carry anywhere. That convenience comes at a small price — it’s not a powerhouse.

If you code for a living and can only afford to purchase one computer make sure you consider a MacBook Pro before pulling the trigger on the MacBook. Read Casey’s piece. He uses this device as a kind of iPad replacement. It’s not meant for serious development work, at least for him.

I’ve heard the MacBook called the ManagerBook. That seems, based on these reviews, to be fairly accurate. It’s a super usable, fun, portable computer that could be a great choice if you have the luxury of owning more than one device.

I could see purchasing one of these for my wife. She’s a full-time iPad Pro 9.7 user and on rare occasion she pulls out her ancient MacBook to do something like rip music to her collection. She doesn’t need a full computer often but the need does arise.

On the flip side of all this praise for the MacBook I have a good friend recently return his MacBook and pick up an older MacBook Air because he couldn’t get past the key travel on the new MacBook keyboard.

You win some, you lose some.

MacBook Monster

I listen to a podcast called Accidental Tech Podcast. If you’re a Mac or iOS Developer you’ve probably heard of it or you’ve heard of one or more of its hosts. One of their ongoing topics of conversation is Apple’s apparent lack of focus on the Pro market. It’s true Apple has become very focused on more consumer oriented products, like the iPhone. I mean, who wouldn’t? When you look at the numbers it makes total sense.

When Apple announces results sites like Six Colors do a great job breaking down all the numbers and, in Six Colors case, they make really awesome charts! Just look at this one from January of 2015.

Awesome Six Colors Revenue Chart
Awesome Six Colors Revenue Chart

Who can blame Apple for spending most of their time on the iPhone? Look at those numbers. They’re stunning. It’s not to say the Mac or iPad are losers, they’re not. Most companies would give anything to have one product doing so well, Apple has at least four; iPhone, iPad, Mac, and Watch. Most likely someone will write in to let me know I’ve missed one, or I’m wrong about something, but you get the point. Apple is killing it, on multiple fronts.

What about Pros?

Much of the consternation from the ATP guys revolves around the Mac Pro. Who can blame them? Apple hasn’t shipped a new model since 2013. The hardware is now embarrassingly outdated and is due for a much needed refresh.

As a developer I can understand their need for Phenominal Cosmic Power! But they’re stuck with an Ity Bity Living Space. Not fun.

I’d love to see Apple pull together a great new piece of hardware that includes all the latest, greatest, internals and really appease the Professional Apple Workstation crowd. This would include filmmakers, photographers, designers of all kinds, the CAD folks, and, of course, Software Engineers of all kinds. On my list of nice to haves would be a box large enough to hold multiple multiple core processors (say 256 cores, why not? Windows can do it), tons of RAM, and a killer external bus system to allow folks to chain together external GPU’s. That would be a really great computer, don’t you think? Maybe the base configuration is the most popular, but it sure would be nice to be able to take a Mac and macOS to an extreme level.

Having said all of that, as a Professional Developer I’d prefer a really great Portable Workstation.  What is that? Well, it’s a desktop replacement in a laptop form. Apple is obsessed with making everything thinner and lighter. I do appreciate that, I really do. My first MacBook Pro was a lovely 17-inch beauty, but it was big. Not only heavy, but it was long enough that it was difficult to find a decent backpack to carry it in. Let’s just look at the weight alone, it was 6.6 pounds.

I remember carrying that thing around my first WWDC in 2011. Early morning to late afternoon. Yes, I got tired of carrying it, but it wasn’t a hardship. I would happily trade a bit of weight for a super powerful MacBook Pro.

I read an article recently on the new Dell Precision 5520 on Windows Central. This thing is a beast.

“Besides the big Core processors, all of which are the last generation “Skylake” variants, there is the big kahuna with the Xeon E3-1505M v6. Introduced this year, this Intel Xeon is a quad-core processor with support for ECC memory, 8MB of cache (up from the usual 6MB in a consumer Core i7), and a slightly higher base clock rate of 3.00 GHz with Turbo up to 4.00 GHz. These specs make it one of the fastest mobile processors around, besting the Core i7-7700HQ found in the XPS 15 (9560) by 200MHz.”

Yes, you read that right. This laptop can be configured with a Xeon processor, not to mention 32GB of RAM. That is professional sized horsepower in a small package. This is what I’d like to see from Apple. A true high-end Portable Workstation. Oh, and do you remember the weight of that old 17-inch MacBook Pro I mentioned above? Yes, 6.6 pounds. This Dell weighs 4.56 pounds. Compare that to the new 15-inch MacBook Pro which weighs 4.02 pounds. It’s not that big a difference.

I’d love to have this kind of power wrapped in Apple’s design ascetic. Oh, it should only come in one color. Black.

Passion Project: Mixing C++, Objective-C++, and Swift

I know a lot of folks have had to go through the process of bridging to C++ so you can use it from Objective-C or Swift. In my case I’m using it from Swift, so I thought I’d share what the middle Objective-C++ layer looks like. If you’ve done any Objective-C it will look like straight Objective-C, until you look a little closer. That’s when you’ll notice a C++ namespace, new, and delete statement. This code is a straight passthrough to the underlying C++ code — it’s here so Swift code can communicate with the C++ code.

Here’s the code that bridges to our Creatinine Clearance calculation.

You’ll notice a class called PKMConvert that has a class method called genderFromPKMGender. I created a set of mirror enums. One on the iOS side the enums use NS_ENUM syntax, on the C++ side they’re straight C style enums, so this code converts between the two. It’s just a simple mapping.

Another thing you’ll notice is I’m still using “old” C++ syntax to create and destroy objects. I’ve been thinking about updating the syntax to C++11 so I’d use unique_ptr instead. We’ll see if that happens. It’s not a big deal.

Something I’ve been mulling over is releasing the entire PKMath C++ Library as an open source project once I have it working for iOS/Mac, Android, and Windows. I don’t know that it would be overly useful for anyone, but there you go.

Since I haven’t actually written any Swift code in the new RxCalc to use the Objective-C++ code I thought I’d share one of my unit tests for the Creatinine Clearance example above.

Here’s how the different layers look from 30,000 feet. I like pictures, don’t you?rxcalc2layers

Hey Mac

Bringing in the HarvestJust some quick takes from around the web on Apple’s new MacBook Pro lineup.

iMore: “So, is this new 13-inch really a lean and mean upgrade for MacBook Air owners, or is it just an artificially crippled MacBook Pro meant to lower the cost of entry?

A bit of both, depending on your point of view.”

Charged: “Touch Bar is a great example of this. First, it feels like an excuse to not just add touch to the Mac in the first place. While Microsoft is busy letting you touch the entire display, Apple’s making you look down at your keyboard to interact instead — bizarre.”

JavaScript Scene: “People are losing their minds. Like many MacBook fans, I’m feeling seriously let down. I’ve been waiting a long time for a great MacBook Pro with touch screen.”

512 Pixels: “Desktop Macs didn’t get a single mention, or a silent hardware update after the announcements were done. While last-minute rumors claimed that the iMac wouldn’t be ready in time, it — and the Mac mini — would have been well-served with CPU bumps and Thunderbolt 3. The 27-inch iMac has become a workhorse for professionals like me, and in a world where the Mac Pro is in the shape its in, annual updates should be a must on Apple’s part.”

Ars Technica: “Phil Schiller quickly breezed by the Apple T1 during the presentation yesterday, but the company later confirmed to us that it was its first custom-designed SoC built for the Mac. And developers who have dug into the software and documentation (particularly the tireless Steve Troughton-Smith, whose recent Twitter sabbatical made my feed much more boring) have confirmed that it has an ARMv7 CPU core and is actually running an offshoot of watchOS, all of which helps it interact with the rest of the Mac.”

I was a bit hard on the announcement yesterday, of course I’d like to have a new MacBook Pro 15in even if one of its main features is thinner and lighter. The Touch Bar is going to be fun for developers to play with and I have a feeling some apps will do some amazing and creative implementations. I mainly develop stuff all day and touch type so I don’t see how this helps me in any way, but that’s ok. It’s not for me to use, it’s there so I can create for it. That’s a good thing.

Also, what is James Thomson up to?

Future macOS Frameworks

Duct Tape, fixer of all things!I stumbled upon an interesting conversation between some well know Apple Ecosystem Developers this morning discussing, maybe lamenting, the lack of UIKit on macOS. I’m afraid I may have pushed these fellas to take their conversation private, I am sorry if that was the case.

Here’s the tweet that started the conversation:

https://twitter.com/stroughtonsmith/status/779726806727491584

I’m not known in any development communities. I’m what you’d call a nobody. But I’m a nobody with years of experience that has seen changes to my development ecosystem.

Having experienced a dramatic shift in Windows Development technologies I have opinions about what I would expect to see from Apple. These opinions and $10.00 should be enough to buy you any item on a Starbucks drink menu. Take if for what it is. An opinion of a nobody.

What I Expect

Given Apple’s love and focus on Swift I fully expect Apple to put their effort into moving their frameworks to focus on Swift while continuing to allow App developers to use Objective-C with anything new. I’ve written about the idea of Swift only Frameworks. I believe we will eventually arrive there. For now we have excellent UIKit support for three different devices; iOS, watchOS, and tvOS. Odd man out would be macOS. It doesn’t make sense, at least to me, for Apple to spend time back porting or adapting UIKit to the Mac. Their bread and butter is their  iOS based trio of the phone, watch, and cable like device. Since iPhone accounts for around 60% of revenue it makes sense for the iOS Platform to be their primary focus. That begs the question, will the Mac ever receive the attention we’d like it to receive? Probably not.

In the end I’d expect Apple to push iOS forward while keeping the Mac as a primary development system for iOS, watchOS, tvOS, and macOS developers with the latter receiving very little attention from a new Frameworks perspective.

A Brief History of Windows Development

Like I said above, I’m opinionated and I’ve been around the block a few times. I know Apple isn’t Microsoft and people tend to hate those comparisons. But I do see similarities between the Microsoft of the 90’s and the Apple of today. That’s a discussion for another time.

The discussions around Frameworks reminds me of Microsoft’s transition to .Net and C# as an easier way for developers to create Windows Apps. Apple is making such a big push with Swift a new framework targeting Swift developers feels like a natural progression.

It’s taken over 15-years to really push app development into a .Net world. I suppose some could argue it took less than 10 and I wouldn’t fight that. The point is Microsoft managed to push an entire development community to a new technology while allow old technologies to continue to not only function but grow. Look at the Microsoft Office Apps and Adobe Photoshop among others. They continue to be very relevant today and continue to add new features while the Windows API receives much less attention than does .Net and C#.

Ultimately the point is I know Apple could choose to push toward a Swift only framework and allow legacy Objective-C/Cocoa apps to continue to grow and thrive. Microsoft is a prime example of how a company could pull it off.

I think it’s kind of nice being a new developer to Apple’s platforms. I don’t have 20+ years of baggage like I do with Windows. It’s been so much easier to move from Objective-C to Swift because of it. Well, that and being most familiar with C++ made the transition to Swift feel more natural to me.

Whatever Apple has in store for us, be it the growth of Cocoa, a new Swift centered framework, or a Swift only framework, I’m ready for it and welcome it.

Post Mac Apple

Recently Vivek Wadhwa of The Washington Post wrote:

Apple should release a version of iOS for non-Apple devices. This suggestion will seem like heresy to the brand’s loyalists, but it may be necessary for the success of the company.

Imagine those Samsung, LG, and Xiaomi smartphones having an original Apple operating system on them rather than the imitations they are presently running. Offered the choice, users would upgrade in droves. And those users would download new applications and sign up for Apple’s subscription services, giving the company a cut of everything they purchased, as well as valuable data and marketing opportunities. Google’s Android business would finally have a formidable rival.

First off, I don’t think Apple is in bad shape because they own less of the mobile market than Android. In fact, they make more money than all Android devices combined. So the thought of being a formidable rival is kind of moot, but that’s not what I wanted to write about, just an observation.

I think macOS would be a much better OS to OEM. Why? Well, Apple is paying so much attention to iOS based devices, the iPhone in particular, they’ve ignored their laptop and desktop computers for a very long time. In fact most of their computers are rated Don’t Buy by Mac Rumors.

Mac Rumors
Mac Rumors

Of course they’ve tried this before. Before Steve Jobs returned in 1997 Apple had OEM’d Mac OS to a few partners. Those partners were doing fine at the expense of Apple. When Jobs returned it was one of the first things he killed so Apple could focus on their core business, the Mac. Fast forward 20 years and Apple is as unfocused as ever. They’re building all kinds of stuff looking for the next iPhone. Here’s a hint Wall Street, I don’t think you’ll get another iPhone-like success for many, many, years.

Anywho, back to macOS on other hardware. Since Apple hasn’t shipped new Mac hardware for professionals in a long time professionals have either created their own solutions or switched to Windows or Linux. Yes, people are switching to Windows because their Macs are not up to the task. Those of us that live on the platform feel strongly about it. I love using the Mac and macOS to do my work but most people just see it as a hammer. They don’t have an attachment to the OS or the hardware. If you can get a PC with Windows that blows the doors off a Mac Pro and your production software runs fine on Windows, why not switch?

What if there were another solution to the problem? What if Apple selected a single OEM and allowed them to create high end hardware that runs macOS? That’s what I’d prefer to OEM’ing iOS to other mobile phone makers. The professional market may appreciate it too.

I know the iPhone and iOS are killing it revenue wise. That idea seems to be the driving force behind Mr. Wadhwa’s piece, but it would be really nice to have alternative hardware designs that don’t focus purely on thinness and lightness. I still love my SUPER FAT 15in 2011 MacBook Pro. It’s perfectly suitable for people creating iOS Apps or small Mac Apps. Folks editing Audio and Video or making movie magic the likes of Pixar and ILM need powerful computers. I’m sure they’d appreciate faster Macs every year or an OEM that could deliver faster, specialized, expandable, repairable, Mac alternatives running macOS.

Mac Apps I Use

If I had to choose one device to keep it would have to be my Mac. Not because I use it more than my trusty iPhone. I would pick it because it is how I make my living.

A wonderful bouquet of flowers.To that end we all have our very personal daily workflows. Some are way more complicated than others. Mine is fairly simple. 

There was a time in my life when I had to customize everything I possibly could on my desktop rig. These days I don’t bother.

Here is a list of software I use day to day.

Safari

Safari is a great browser that supports OS X extensions and browser plugins which gives me all the power I need to connect the web to my favorite desktop apps. I do not sync my opened sites between desktop and mobile.

Slack

Who doesn’t use Slack these days? We use it at work for most of our communication needs. Nuff said, it’s awesome. 

Evernote

I store quite a bit of information with Evernote. When I run across and interesting development article I clip the Simplified Article to Evernote as a reference. It is a great way to organize reference material. I do it through a combination of Notebooks and Tags. It’s a fantastic service and I love their native Mac and iOS Apps.

Wunderlist

I use Wunderlist to organize my personal project thoughts, so it mostly used on my home Mac and on my iPhone, but it’s a great app and service.

Reeder

I know RSS is dead, right? Not really. If you’re in the market for a beautiful, solid, easy to use RSS reader for the Mac or iOS, Reeder is a good choice.

Alfred

I only use Alfred for one thing, lunching apps. I keep my dock clean and find it easier to launch apps by smacking a shortcut and typing. I know I could do many more awesome things with it, but I don’t.

Dropbox

When I need access to a document or picture from many different places I use Dropbox.

Terminal

I use the built in terminal app. It’s used for git mostly.

SourceTree

I like using a nice application for git and SourceTree covers the bases for me. I split time between this app and the terminal. 

BBEdit

On occasion you have to edit something other than a file for the app you’re working on. BBEdit is more than capable. 

Xcode

This seems an obvious entry given the work I do. I develop iOS Apps. This is the best tool for the job.

I think that’s it, I’m composing this on my iPhone using the WordPress for iOS App, so I’m doing this from memory.

That brings me to this list.

Stuff I no longer use on my Mac

MarsEdit

At one point I used MarsEdit for all my blogging needs. The app is fine but I use iOS more and more for blogging. Like I said above, I’m using my iPhone to compose this post. Most of the time I use my iPad Mini on the weekends to catchup on all the stuff I pushed to Pocket. That usually results in a blog post right from the Mini. 

Fine software, great developer, no iOS App. For iOS I use the WordPress for iOS App.

Twitterrific

Unfortunately Twitter’s developer hostile token limits have all but killed off development of my favorite Twitter client. I have resorted to using the web site for my desktop browsing. If Twitterrific saw a renaissance on the Mac I would switch back in a heartbeat.  Thankfully Twitterrific for iOS is going strong. Here’s hoping Jack opens up Twitter to developers. 

Swift, REST, and JSON

I’m fond of a site called The Pastry Box Project. It’s a collection of thoughts and stories by a bunch of great writers, but that’s not why I mention it. I mention it because I noticed they had a nice, simple, REST API. Nifty!

PastryKit

Since I really enjoy writing code that communicates with services, and I needed a little project to learn some Swift, I thought I’d write a couple classes, I call PastryKit, that implement the Pastry Box REST API in Swift.

PastryKit is just two classes:

  1. PastryKit – Allows you to communicate with the Pastry Box REST API.
  2. Pastry – This is an entry returned by a call to PastryKit.

You can read more about The Pastry Box API on their site.

private func showPastryBaker() {
     var pastryKit = PastryKit();
     pastryKit.thoughtsByBaker("mike-monteiro", completionHandler:{(pasteries, error) in
          if (nil != error) { println(error) }
          if (nil != pasteries) { println(pasteries) }
     });
}

The Heavy Lifting

Most of the “heavy lifting” is performed in one place in PastryKit.swift in the private getWithIngredient function. It makes use of NSURLSession, which was introduced in iOS 7. Go find that function if you’d like to see how to do an HTTP GET in Swift. This is a simple case, it doesn’t require any authentication, or messing around with headers, and it only does GET’s. Doing a POST, PATCH or DELETE would, of course, require some changes, but you get the idea.

    /// getWithIngredient - worker method that does all gets
    private func getWithIngredient(ingredient: String?, completionHandler: (([Pastry]!, NSError!) -> Void)?) {
        let url = ((ingredient) != nil) ? NSURL(string: PastryBoxUrl + ingredient!) : NSURL(string: PastryBoxUrl)
        let request = NSURLRequest(URL: url!)
        let configuration = NSURLSessionConfiguration.defaultSessionConfiguration()
        let session = NSURLSession(configuration: configuration, delegate: self, delegateQueue: nil)
        let task : NSURLSessionDataTask = session.dataTaskWithRequest(request, completionHandler:{(data, response, error) in
            if (error == nil) {
                var conversionError: NSError?
                var ingredientsArray: NSArray = NSJSONSerialization.JSONObjectWithData(data, options:NSJSONReadingOptions.AllowFragments, error:&conversionError) as NSArray
                if (conversionError == nil) {
                    var pasteries = Pastry.pastryArrayFromNSArray(ingredientsArray)
                    if (completionHandler != nil) {
                        completionHandler!(pasteries, nil)
                    }
                }
                else {
                    println(conversionError)
                    if (completionHandler != nil) {
                        completionHandler!(nil, conversionError)
                    }
                }
            }
            else {
                println(error)
                if (completionHandler != nil) {
                    completionHandler!(nil, error)
                }
            }
        });
        
        task.resume()
    }

Go Get It!

The code is available on GitHub if you have need to get stuff from The Pastry Box Project in your Swift or Objective-C app.

Enjoy!

What happened to Twitterrific 5 for Mac?

Ollie! The Twitterrific Bird9TO5Mac: “By limiting the ability of third-party developers to create unique and useful clients for its service, Twitter is ensuring that new users will be forced to use one of its first-party solutions, whether that’s Twitter for Mac, TweetDeck, or the web. Unfortunately, none of these products are really worth using, and Twitter is shooting itself in the foot by attempting to drive users to these subpar experiences.”

There’s the problem in a nutshell. Twitter has been less than friendly to developers who can help them make a better experience for their users. Let’s say Twitter changed their rules to allow folks to develop clients that they don’t consider their bread and butter. What if you could create a client, free of limits, that wasn’t for web or mobile? This would open the door to a great update from The Iconfactory and allow other indie developers to create great native experiences for Windows or Linux. Seems like good business to me.