Help us understand the problem. What is going on with this article?

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

More than 5 years have passed since last update.

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)

参考

http://stackoverflow.com/a/25126384

配列にエレメントの追加

+=演算子でエレメントの追加ができなくなりました。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)

その他

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

susieyy
フリーランス - スタートアップエンジニアリングアドバイザー - iOS技術顧問 - プロトタイプ開発
https://susieyy.com
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした