Skip to main content
Commonmark migration
ソース リンク

こんな感じでいかがでしょうか?

if let touch = touches.first as? UITouch

参照元から抜粋

Error: Set doesn't have the method anyObject()

 

if let touch = touches.anyObject() as UITouch? {

 

Now that you have a Swift Set that has typed objects you need to update your cast if you use one with the touches parameter.

 

Fix: Use one of the new methods of Set like first or last, which return optional NSObject values

 

There's a couple gotchas with this conversion. anyObject() was a method, but first is a property. Firstly, you'll call them differently (i.e: no parenthesis).

 

Secondly You can't use as? UITouch and as UITouch? interchangeably anymore with Swift 1.2 (not sure if this is a bug or intended feature).

 

if let touch = touches.first as? UITouch {

参照元
http://iphonedev.tv/blog/2015/2/9/swift-12-fixes-and-breaks-a-few-things-you-should-be-excited

こんな感じでいかがでしょうか?

if let touch = touches.first as? UITouch

参照元から抜粋

Error: Set doesn't have the method anyObject()

 

if let touch = touches.anyObject() as UITouch? {

 

Now that you have a Swift Set that has typed objects you need to update your cast if you use one with the touches parameter.

 

Fix: Use one of the new methods of Set like first or last, which return optional NSObject values

 

There's a couple gotchas with this conversion. anyObject() was a method, but first is a property. Firstly, you'll call them differently (i.e: no parenthesis).

 

Secondly You can't use as? UITouch and as UITouch? interchangeably anymore with Swift 1.2 (not sure if this is a bug or intended feature).

 

if let touch = touches.first as? UITouch {

参照元
http://iphonedev.tv/blog/2015/2/9/swift-12-fixes-and-breaks-a-few-things-you-should-be-excited

こんな感じでいかがでしょうか?

if let touch = touches.first as? UITouch

参照元から抜粋

Error: Set doesn't have the method anyObject()

if let touch = touches.anyObject() as UITouch? {

Now that you have a Swift Set that has typed objects you need to update your cast if you use one with the touches parameter.

Fix: Use one of the new methods of Set like first or last, which return optional NSObject values

There's a couple gotchas with this conversion. anyObject() was a method, but first is a property. Firstly, you'll call them differently (i.e: no parenthesis).

Secondly You can't use as? UITouch and as UITouch? interchangeably anymore with Swift 1.2 (not sure if this is a bug or intended feature).

if let touch = touches.first as? UITouch {

参照元
http://iphonedev.tv/blog/2015/2/9/swift-12-fixes-and-breaks-a-few-things-you-should-be-excited

ソース リンク
ita_3y
  • 2,797
  • 2
  • 11
  • 15

こんな感じでいかがでしょうか?

if let touch = touches.first as? UITouch

参照元から抜粋

Error: Set doesn't have the method anyObject()

if let touch = touches.anyObject() as UITouch? {

Now that you have a Swift Set that has typed objects you need to update your cast if you use one with the touches parameter.

Fix: Use one of the new methods of Set like first or last, which return optional NSObject values

There's a couple gotchas with this conversion. anyObject() was a method, but first is a property. Firstly, you'll call them differently (i.e: no parenthesis).

Secondly You can't use as? UITouch and as UITouch? interchangeably anymore with Swift 1.2 (not sure if this is a bug or intended feature).

if let touch = touches.first as? UITouch {

参照元
http://iphonedev.tv/blog/2015/2/9/swift-12-fixes-and-breaks-a-few-things-you-should-be-excited