LoginSignup
5
5

More than 5 years have passed since last update.

Xcode6 GMへ移行する時に変更した箇所

Posted at

現在開発しているプロジェクトを、Xcode6 beta5 から Xcode6 GM seed に置き換えた際にコンパイルエラーになった箇所です。
主にOptionalに関する箇所でエラーになりました。

  • NSNotification.userInfo
notification.userInfo[UIKeyboardFrameEndUserInfoKey]

notification.userInfo![UIKeyboardFrameEndUserInfoKey]
  • UITableView(UICollectionViewもほぼ同様)
func tableView(tableView: UITableView!, numberOfRowsInSection section: Int) -> Int

func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int
func tableView(tableView: UITableView!, didSelectRowAtIndexPath indexPath: NSIndexPath!)

func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath)
func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!) -> UITableViewCell!

func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell
  • NavigationController
self.navigationController.viewControllers

self.navigationController!.viewControllers
  • TabBarController
self.tabBarController.selectedIndex 

self.tabBarController!.selectedIndex 
  • prepareForSegue
override func prepareForSegue(segue: UIStoryboardSegue!, sender: AnyObject!)

override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject!)
  • UIStoryboard
let controller = self.storyboard.instantiateViewControllerWithIdentifier("Hoge") as HogeViewController

let controller = self.storyboard!.instantiateViewControllerWithIdentifier("Hoge") as HogeViewController
  • init
required init(coder aDecoder: NSCoder!) {・・・}

required init(coder aDecoder: NSCoder) {・・・}
  • objectForKey
let jsonObject:AnyObject

let number1 = jsonObject.objectForKey("data").objectForKey("num") as Int

let number1 = jsonObject.objectForKey("data")!.objectForKey("num") as Int
let jsonObject:AnyObject

let array = jsonObject.objectForKey("data") ? Hoge.create(jsonObject.objectForKey("tags")) : Array()

let array = jsonObject.objectForKey("data") != nil ? Hoge.create(jsonObject.objectForKey("tags")) : Array()

これら以外は案外すんなり動いてくれました。

5
5
0

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
5
5