LoginSignup
99
100

More than 5 years have passed since last update.

Swift開発でXcode6 Beta5にアップデートしたらたくさんコンパイルエラーになった

Last updated at Posted at 2014-08-05

Xcode6 Beta4 から Xcode6 Beta5にアップデートしたらいくつかコンパイルエラーになったのでメモしておきます。

init メソッドは override が必要になった

WTDProfileTableViewCell_swift_—_Edited.png

• Overrides of a designated initializer must be marked with the 'override' modifier. (17892845

Does not implement its superclass's required members

WTDProfileTableViewCell_swift.png

以下を追加します。

required init(coder aDecoder: NSCoder!) {
  super.init(coder: aDecoder)
}

WTDBackTableViewCell_swift.png

• The required modifier is written before every subclass implementation of a required
initializer. Required initializers can be satisfied by automatically inherited initializers.
(17892840)

参考

配列にエレメントの追加

+=演算子でエレメントの追加ができなくなりました。appendメソッドを利用します。

WTDCommentsViewController_swift.png

WTDCommentsViewController_swift.png

+=演算子は配列の連結で利用するようになりました。

AppDelegate_swift.png

• The += operator on arrays only concatenates arrays, it does not append an element. This
resolves ambiguity working with Any, AnyObject and related types. (17151420)

nil チェック

AppDelegate_swift.png

AppDelegate_swift.png

Optionals can now be compared to nil with == and !=, even if the underlying element is not
Equatable. (17489239)

Operator infix

operatorinfix,prefix,postfixの記述の順番が逆になりました。

WTDScraping_swift_—_Edited.png

WTDScraping_swift_—_Edited.png

WTDScraping_swift.png

@の記述も不要になりました。

AppDelegate_swift_—_Edited.png

• The @prefix, @infix, and @postfix attributes have been changed to declaration modifiers,
so they are no longer spelled with an @ sign (now, prefix func (…)).

@auto_closure

@auto_closureの記述は@autoclosureに変わりました。

AppDelegate_swift.png

• The @auto_closure attribute has been renamed to @autoclosure. (16859927)

UnsafePointer

UnsafeConstPointerUnsafePointerUnsafePointerUnsafeMutablePointerに変更されました。

KVOのobserveValueForKeyPathの実装において、引数の型がUnsafePointerの場合エラーになるので、safeMutablePointerに変更しました。

WTDWebViewController_swift.png

WTDWebViewController_swift.png

• The UnsafeConstPointer and UnsafePointer types have been renamed to UnsafePointer
and UnsafeMutablePointer for consistency with Cocoa and to encourage immutability. The
Autoreleasing and other pointers have been renamed for consistency as well. (17892766)

その他

リリースノートには上記以外の変更点もたくさん記載されており、コンパイルエラーになる事象は他にもありそうです。

99
100
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
99
100