Under the Bridge

Xcode 6 Custom Interface Builder Previews

Ah, yes. This was the thing that kept us scrabbling on by our fingernails to developing applications in PowerPlant (remember that?) long past when everyone else who could read the writing on the wall had long since jumped ship to Cocoa; not being able to lay out your UI with preview seemed so hopelessly retrograde to us that there was no way we’d work without Constructor unless we had to.

And, well, then Carbon never made it to 64-bit, so we had to for a decade. Funny how these things go.

So although we can’t quite work ourselves up to be quite as celebratory as their effort probably deserves, it does deserve celebration that, FINALLY, our workflow can now include

BUILDING CUSTOM UI ELEMENTS WITH IBDESIGNABLE [AND IBINSPECTABLE]

These two new keywords have been added to Xcode 6 to preview our custom views directly through Interface Builder. That’s right: this is a dramatic improvement in terms of re-usability, sharing, and, in a way, testing.

We prefix our class with the @IBDesignable keyword to inform Interface Builder that the class’ instances will try to design themselves when added to the storyboard…

Then, prefixing any properties of the class with @IBInspectable, we ensure that Interface Builder can read and write the value of these properties directly in the inspector view…

The previous code will end up returning new fields in Interface Builder to setup that property … and in the ViewController in the storyboard we get a preview of the view like for any other UIKit component:

That’s pretty much it really, but read the whole thing for a good walkthrough!

h/t: ManiacDev!

Continue Reading →
0

iPhone 6 Screen Apoplexia

Starting to feel like you’re totally losing the plot now that your iOS app can find itself living in five different point dimensions,

  • 320 x 480
  • 320 x 568
  • 375 x 667
  • 414 x 736
  • 768 x 1024

and three different point scales,

  • @1x: up to iPhone 3GS/iPod 3G/iPad 2/iPad mini 1
  • @2x: everything later except
  • @3x: iPhone 6 Plus

and even a logical to physical downsampling discrepancy on top of that? Here, go check this out to explain it:

iPhone 6 Screens Demystified

To demonstrate different rendering of pixels on various devices, we compare how 1-point wide line is rendered on

Original iPhone – without retina display. Scaling factor is 1.

iPhone 5 – with Retina display, scaling factor is 2.

iPhone 6 Plus – with Retina display HD. Scaling factor is 3 and the image is afterwards downscaled from rendered 2208 × 1242 pixels to 1920 × 1080 pixels.

The downscaling ratio is 1920 / 2208 = 1080 / 1242 = 20 / 23. That means every 23 pixels from the original render have to be mapped to 20 physical pixels. In other words the image is scaled down to approximately 87% of its original size…

TL;DR: If you haven’t yet … it’s time to buy PaintCode!

UPDATES:

Using Vector Images in Xcode 6

Xcode 6: Live Rendering, Visual View Debugging, and Swift

Continue Reading →
2

Tip: Xcode 6 Bundle Signing

Having this problem with your shiny new Xcode 6 GM?

Screen Shot 2014-09-10 at 8.12.00 AM.png

Problem also discussed here.

Solution 1:

Adding the `–deep` flag to “Other Code Signing Flags” (OTHER_CODE_SIGN_FLAGS) got me around this.

Solution 2:

Delete Info.plist inside the bundle if it’s only a resource package.

(And if there’s some reason you need it, at least delete the ‘CFBundleExecutable’ key.)

Good luck with that!

Continue Reading →
0

Layout Best Practices

Read of the day while you’re nervously waiting to see what will need panic rewrites tomorrow:

Screen Shot 2014-09-08 at 8.33.11 AM.png

Don’t think there’s anything in there actually covered by NDA at this point, but we’ll just refer you there for the beta software feature discussion bits. The important parts are not new, but they’ve been widely disregarded to date, at least they sure are in software we get stuck maintaining:

  • Nowhere should you be using screen or window size to do layout. Your view bounds should be the only consideration.
  • At load time, as called out above, you’re not in a hierarchy yet. Therefore you do not know what your view bounds will be. This has always been a thing for any view contained by a view with its own layout, and became more of a thing with iOS 7 when your views developed an inclination to jump under the status bar behind your back, but rumour has it that it will be a big thing very soon.
  • layoutSubviews is the best place to be putting your legacy-type frame setting code.
  • updateViewConstraints is the correct place to figure out your interface for reals; if you’ve so far avoided auto layout, now is a superb time to get on that.

Hopefully none of this is any particular news to you, so getting all those legacy codebases copacetic with whatever novel execution environments actually appear tomorrow from the collection of swirling rumours should be no problem, right?

Continue Reading →
0

Standards Marked Downer

Here’s an interesting case study on how to not make friends:

Standard Flavored Markdown

It took a while, but I’m pleased to announce that Standard Markdown is now finally ready for public review.

standardmarkdown.com

It’s a spec, including embedded examples, and implementations in portable C and JavaScript. We strived mightily to stay true to the spirit of Markdown in writing it. The primary author, John MacFarlane, explains in the introduction to the spec

Well, that all sounds well and good, aside from having a snicker at the obligatory xkcd 927 mention, doesn’t it? Um, no. After not too many yay! great! finally! comments on the above, we start getting

… We all use Markdown, not just you and your pals. It isn’t yours to do with as you please. Create something new, and respect prior art…

… Besides that, the hubris involved in calling your fork standard is a bit much…

… any such effort needs to do so under a new name. Not to do so is confusing to users and needlessly hostile toward John Gruber…

… Ignoring this term means you’ve broken the deal, and opens you up to a copyright infringement lawsuit…

Oops. The comments devolve from that last point into wrangling over the legal definition of ‘derivative’ … but if you’re down to arguing on that level, well, you’ve already lost, haven’t you?

Screen Shot 2014-09-05 at 2.59.35 PM.png

… yeah, that’s a pretty darn good example of exactly the kind of reaction you want your new project to avoid at all costs.

Now, we generally try to actively avoid pointless drama like this — what led us to this donnybrook was actually a handy looking new pod

laptobbe/TSMarkdownParser

TSMarkdownParser is a markdown to NSAttributedString parser for iOS implemented using NSRegularExpressions. It supports many of the standard tags layed out by John Gruber on his site Daring Fireball. It is also very extendable via Regular Expressions making it easy to add your own custom tags or a totally different parsing syntax if you like…

which looked like a particularly nicely lightweight way to manage some easy attribution of strings. ‘Course, there’s lots of other implementations around too, if that particular one isn’t adequate to your needs. Or you could always start your own flavour. “Definitive Markdown”? “Authoritative Markdown”? Those aren’t taken yet!

UPDATES:

And the first attempt was to try “Common Markdown” and that didn’t work either … so now it’s CommonMark!

Continue Reading →
0

Terminally Illin’

Now here’s a veritable novelette on a topic you almost certainly know less about than Craig Hockenberry does:

The Terminal

I’ve been using the Unix command line since 1983 and like most software developers, the Terminal app is a permanent fixture in my Dock. Over the years I’ve learned a lot of things that make working in this environment more productive, but even old dogs like me are constantly learning new tricks.

As much as I love them, these long “trick lists” on Stack Overflow have a problem: they’re poorly organized with little narrative describing why you’d want to use a technique. This long homage to the command line is my attempt to remedy that situation…

As developers, we live and die by our clipboard. Code and data moves between different contexts all day long thanks to Cocoa’s NSPasteboard. It should not be surprising that pbcopy and pbpaste are simple and powerful integration points at the command line…

Most apps have preferences that are managed by NSUserDefaults. You can easily view or modify these settings from the command line using the defaults command…

Speaking of designers, one of the best ways to communicate with them is through pictures. The screencapture tool let’s you do some things you can’t do using the Command-Shift-3 and Command-Shift-4 keys in the Finder…

Spotlight search on the Desktop has become an essential tool for developers. We find code, documentation, messages and all kinds of information that’s related to our projects using Command-space and a simple text field. Would it surprise you to know that you can do more complex searches of the same dataset using the command line?…

It’s incredibly handy to control your desktop apps using the shell. Since AppleScript has always been the best way to control apps, it makes sense that there would be a command line tool. The osascript tool is one the Swiss Army would love…

A lot of the files we deal with are executable. Even if symbols have been stripped from the app, you can still infer a lot of information by looking at the null terminated strings present in the data…

If you’re developing for Mac or iOS, you already know how damn useful Instruments is for tracking application behavior. DTrace is the framework that makes all that possible. Well, take a look at all the stuff in the shell that “uses DTrace”…

Have you ever had a folder full of files that you’ve wanted to access through a web browser? You could setup Apache to do this by editing the httpd.conf file, or just enter the following command in the folder you want to access…

Data is never in the format you need it, is it? The shell’s notion of standard input and output has always made it great for doing data conversion. Here are some tools that you may not know about…

Pretty much guarantee you’ll find a whole bunch of somethings you didn’t know in there!

Continue Reading →
0

Tip: Open Settings URL

Oops, we managed to miss this in the WWDC videos:

Open Settings URL

A quick tip I picked up from WWDC 2014 session 715 on User Privacy. Starting with iOS 8 there is now a settings launch URL to send the user directly to the settings for an App. The code snippet below will do the trick:

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:
UIApplicationOpenSettingsURLString]];

If you’ve got any functionality that the user can say no to, it’s guaranteed they will, and then they’ll send you angry letters and one-star reviews when it doesn’t work, you’ve all been there right? So make sure you put on your iOS 8 upgrade checklist putting in a helpful remediation option wherever deniable things can fail!

Continue Reading →
0

Storyboard Launch Images

So, you been fearing what the likely new @3x sizes are going to do to your seven and counting launch image requirements?

Well, looks like all that fuss may be going away soon:

Replacing Launch Images with Storyboards

An Interface Builder-Based Launch Screen

In Xcode 6, there is another option. You can specify a storyboard whose initial view controller will then be used as the appʼs launch screen. This is how:

  1. Create a blank storyboard file named LaunchScreen.storyboard.
  2. Go to your target settings and, on the General tab, select the storyboard as your Launch Screen File. Xcode will add a corresponding UILaunchStoryboardName key to your appʼs Info.plist. When this key is present, Xcode will prioritize it over any launch images you might have set.
  3. Add a view controller scene to the storyboard. Add some subviews to the scene and position them with constraints. When you launch the app on a device, the OS should use the scene as the launch screen.

One Storyboard for All Screen Sizes

You can use the new adaptive UI features in Interface Builder to fit your layout to different screen sizes. If your scene requires screen-size-specific images, use asset catalogs to define different images per size class. Note that you can not only adjust constraints for different size classes, you can also remove selected views from a specific size class entirely by deselecting the Installed check box. See WWDC session 411 for details.

Also Works with NIBs

Despite the name of the UILaunchStoryboardName key, this also seems to work with NIB/XIB files containing a single view. When you open such a XIB file in Xcode, the File Inspector displays a check box named Use as Launch Screen, which is not there for storyboards…

There’s a number of partially-implemented caveats at the moment, but looks like a solid reason to get up to speed on those new adaptive UI features, because as they say

Screen Shot 2014-08-30 at 9.00.52 PM.png

Speaking of which, here’s a handy UICustomResolutions extension for UIWindow to help testing that!

h/t: iOS Dev Weekly!

UPDATES:

Yup, it’s 667×375@2x(1334×750) and 414×736@3x(2208×1242) just as predicted, and new @3x icon sizes to match!

As for xib/storyboards, they’re required for the new devices:

You use a launch XIB or storyboard file to indicate that your app runs on iPhone 6 Plus or iPhone 6.

Oh, wait no: You can also add raster images to the new LaunchImage.xcassets buckets.

Continue Reading →
0

Project Management: Kanban

So chances are that, should you follow any kind of formalized project management, it’s likely to be a form of Scrum. And if so, we’ll just betcha that you’ll nod along with this piece:

Why SCRUM Sprints slow you down

Basically SCRUM sprints set you up to commit to something you can’t possibly deliver on. The only way to reach predictable performance in SCRUM sprints is if …

  • … your team’s performance doesn’t change ever: No people leaving, no people joining, no knowledge gained over time, no vacations, no motivation highs & lows,
  • … the items you are working on are highly predictable: You’ve done them many times, know which problems to expect & how to solve them, no external dependencies, no collaboration with others, no changes in scope even if they would make sense, …
  • nothing else comes up that’s more important: Server down, bug in the payment system, a security vulnerability that needs to be closed ASAP, incredible marketing opportunity if implemented & shipped in the next few hours, …
  • Considering this it is quite obvious why reaching predictable SCRUM sprint performance is almost impossible in most real world situations no matter how much time and effort you put into sprint planning and estimates.

    But the main problem is that SCRUM sprints force your team to optimize for predictability (“how much of what we’ve committed to can we get done”) instead of optimizing for value & agility (last responsible moment)…

Preach it, brother! Yes, we feel all that pain. Particularly that last point. Last time we had an interview ask about our experience as a scrum master in our last management job we scoffed “As if we ever knew what our priorities were going to be by the end of the day, never mind multiple weeks down the road!” These problems are obvious enough to everybody that sprints are usually one week these days, at least they are the last half-dozen places we’ve scrummed at … at which time you’re spending more time in planning and review than the effort is worth, amirite?

Some software companies are starting to embrace continuous delivery and feature pipeline visualization tools inspired by lean manufacturing concepts and Kanban.

This helps them to release improved versions of their software as soon as they are ready. On top of that it enables them to drop arbitrary sprint time-boxes if they want to.

By using Kanban and feature pipelines you pull new work items into your process once space (focus) frees up on the board.

This enables you to defer decisions & commitment to the last responsible moment, a time when usually more information & context is available allowing your team to be more agile compared to SCRUM time-boxes…

Well, this certainly sounds more like a project process that would actually work in the world we live in. Here’s another good discussion:

When to dump Scrum for Kanban

Kanban is useful when requirements and priorities change quickly and often. This becomes evident in teams who can see that their Sprint Planning doesn’t quite hold up for the entire Sprint duration. Kanban helps you react faster, but…

Contrary to popular belief, in Kanban, it’s not only about reacting faster, it’s about being closer to a state of Zen

But how do you get there? Simply prioritize: focus over speed

Well, that sounds worth a try. Let’s see what tools are out there:

Blossom is from the fellow who wrote that first article up there that got our attention; pricing is $19/month for 5 seats, $59/15, $149/25.

There’s approximately a zillion other Kanban tools, but these two seem widely well regarded for getting your feet wet:

Kanban Toolpricing is $5/user/month or $9 with time tracking, and a basic 2-user free one too.

LeanKitpricing is free to 10 users for basic features, $15/20 user/month for more

Us, we’re going to give Kanban Tool a shot, since the price is right and Adding tasks with Siri on iOS devices sounds pretty cool. But as always, if you have any particular recommendations of tools of this type you’ve tried and can recommend, or recommend against, please share!

Continue Reading →
0

Affilate API: Uber

Got an app with a map? This might be of interest to you:

Introducing The Uber API

As of today, we officially open—to all developers—access to many of the primitives that power Uber’s magical experience. Apps can pass a destination address to the Uber app, display pickup times, provide fare estimates, access trip history and more.

Note that ‘more’ does not currently include ‘actually call for a ride or anything’ though,

What about requesting a ride? Yes, we’ve implemented that endpoint as well, but because calling it immediately dispatches a real driver in the real world, we’re releasing it in a more controlled fashion, starting with a small set of partners. Stay tuned for more on that, and please let us know if you’re interested in being added to the whitelist.

OK then. So what’s in this new Affiliate Program for us exactly?

  • Offer your users credit toward their first Uber ride when they sign up via your app
  • Earn $5 (USD) in Uber credit for every new rider
  • Receive credits that never expire in your Uber account every month
  • Build something amazing and get your app featured on our site

Gotcha. Free rides! That’s awesome! Oh, no, wait … no it’s not. Not if you hang in Most Livable City #3:

Uber Has Expanded to 130 Cities, Vancouver Remains Only One It’s Ever Had to Back Away From

Oh, wait more … no, it’s really not.

This program is currently available to developers in the US only.

Well, that’s not rocketing up our priority list then. But hey, if you are a U.S. developer with a map-using app, something you probably want to consider!

Continue Reading →
0
Page 1 of 116 12345...»