What is `Swifty`?

Swifty ってなに?

以前このコラムで書いたとおり、try! Swift India で話すことになり、その後トークのタイトルを「What is `Swifty`?」に決めました💁‍♂️



WWDC ではどのように使われた?

WWDC の動画は https://developer.apple.com で検索できます。

結果、WWDC 2016 の3つのセッションがヒットしました💡

Platforms State of the Union

Swift loves clarity and it aims to define away boilerplate. On Swift 3, Cocoa APIs have an elegant feel. You could say they’re totally Swifty.

What’s New in Cocoa

For one thing, we’re eliminating repeated and needless words, which of course makes our APIs more swifty, as you might have heard yesterday.

You’ll see that’s not very swifty because .NSCrayonModeColorPanel is fairly wordy.

Swift API Design Guidelines

They feel a bit not-Swifty. What’s that even mean? Not Swifty? You hear it a lot. But in essence, this is why two years in to having Swift as a platform that many thousands of developers are using, is the right time to reevaluate. Because we have experience from a much larger community to understand what works well in Swift code. And so we set off to design the API Design Guidelines to try to codify what it is to build a Swifty API and help everyone build more consistent, more clear APIs within this language that we love.

They’re used all the time to give them these Swifty makeovers to be beautiful in Swift. I talked a little bit about the scale of the Grand Renaming.

Now, method names will get you a long way towards a Swifty API, but this doesn’t quite go far enough.Here I have some simple code that’s creating a standard Gregorian calendar. But if you look at this, this doesn’t really feel very Swifty, especially NSCalendarIdentifierGregorian, which is a plain string global variable. Plain string global variables, that’s not really how we do Swift.

Swift.org ではどのように使われた?


It’s Coming: the Great Swift API Transformation

Fortunately Swift developers created tons of great code in spite of that gap, and along the way, there evolved a sense of what “Swifty” code looks and feels like.



さて、現段階で Swifty をまとめるとこのようなイメージでしょうか。

  • Clarity / Clear(わかりやすい)
  • Consistent / Regularity / Coherence(一貫性がある)
  • Eliminating repeated and needless words / Not wordy(冗長でない)


このコラムの EDITOR(mono )による関連スライド

(38ページ目以降で Swifty について言及)

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.