Don of the Day

Don of the Day


Adventures in software development with Xamarin and the Web

Software developer, building things with code in sunny Scottsdale, AZ.

Share


Twitter


Swift Style Guide

Don FitzsimmonsDon Fitzsimmons

I decided, what the hell, I'm going to write an app with Swift despite truly believing that it's wiser to use Xamarin (cross platform and all). I'm building a countdown timer. It's an app that I already built once before for Windows Phone. I figured it would be a great way to build something I'm already familiar with and just focus on learning this new language and the iOS APIs.

Things are going well and I'm enjoying Swift. But, there's something wrong. Although I'm grasping the language and finding answers to questions quite easily on Stack Overflow and other sources, I don't know what the Swift way to do thing is. Like, should an opening curly brace go on the same line as a function declaration. Simple stuff like that. In C#, we have a pretty well established set of style conventions, but with Swift, I don't know what they are.

And then I came across this nice style guide for Swift. It's well put together. I don't agree with everything in the guide, especially using type alias to name a variable by type, but for the most part, it's great advice and seems to be consistent with other code bases I've seen. If you're looking for a style guide for Swift, check it out.

Software developer, building things with code in sunny Scottsdale, AZ.

Comments