タグ

SWIFTとasに関するslay-tのブックマーク (2)

  • ISO-8601, YYYY, yyyy, and why your year may be wrong

    The end of the year is rolling around and it’s time to remind everyone about that yyyy works the way you think it does and YYYY does not. Here’s a quick example to start: Just because you test a format quickly with the current date and get back the result you expect, does not mean you’ve constructed your date format correctly. Speaking of which, BJ Homer points out that you can just use “y”, as “y

    ISO-8601, YYYY, yyyy, and why your year may be wrong
  • Swiftのコードレビュー勘所 - 文字っぽいの。

    はじめに Swift with iOSなコードをレビューする時に僕が気をつけて見ているところをざっくりまとめました 今年からSwift始めます!って人が読めばクラッシュしやすいコードを書きにくくなるはず ロジック面についてもちゃんと確認しましょう 勘所 AnyObject使ってる 不適切に使われてる(型を消すとか)場合には絶対に直させる。型を消したい場合は protocol + typealias とかgenerics でなんとかできる場合が多い。というか AnyObject を使ってるコードでは、型を消す必要がない場合が多い。 配列にindex指定してアクセスしている let item = items[index] とか。基的にはindexなど使わずにアクセスするのが一番なので、書き直せないか確認する。 書き直せない場合はロジック自体の設計を変えられないか、もしくははみ出ない処理がちゃ

    Swiftのコードレビュー勘所 - 文字っぽいの。
  • 1