{"id":3363,"date":"2017-07-16T08:16:28","date_gmt":"2017-07-15T23:16:28","guid":{"rendered":"http:\/\/ukaapple.selfip.com\/support\/?p=3363"},"modified":"2017-09-02T20:35:12","modified_gmt":"2017-09-02T11:35:12","slug":"swift_update_day2","status":"publish","type":"post","link":"https:\/\/minnano.app\/support\/2017\/07\/16\/swift_update_day2\/","title":{"rendered":"\u5b9f\u9332! 2\u5e74\u534a\u3076\u308a\u306eSwift\u30a2\u30d7\u30ea\u30d0\u30fc\u30b8\u30e7\u30f3\u30a2\u30c3\u30d7 2\u65e5\u76ee \u305d\u306e1"},"content":{"rendered":"<p>\u304a\u306f\u3088\u3046\u3054\u3056\u3044\u307e\u3059\u3002\u7d9a\u304d\u3067\u3059\u3002<\/p>\n<p>\u3010\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\u3011<br \/>\nC-style for statement has been removed in Swift 3<br \/>\n\u3010\u4fee\u6b63\u524d\u3011<br \/>\nfor var y = newYStart; y <= newYEnd; y += 1 {<br \/>\n\u3010\u4fee\u6b63\u5f8c\u3011<br \/>\nfor y in newYStart &#8230; newYEnd {                    \/\/ 3.1<br \/>\n\u3010\u89e3\u8aac\u3011<br \/>\nSwift 3.0\u3067 for \u30eb\u30fc\u30d7\u306e\u69cb\u6587\u304c\u5909\u308f\u308a\u307e\u3057\u305f\u3002\u5f71\u97ff\u306f\u3068\u3066\u3082\u5927\u304d\u3044\u3067\u3059\u304c\u3001\u8a18\u8ff0\u304c\u7c21\u6f54\u306b\u306a\u308a\u307e\u3057\u305f\u3002\u82f1\u65ad\u3067\u3057\u305f\u306d\u3002\u500b\u4eba\u7684\u306b\u306f\u305d\u306e\u307e\u307e\u306b\u3057\u3066\u6b32\u3057\u304b\u3063\u305f\u30fb\u30fb\u30fb<\/p>\n<p>\u3010\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\u3011<br \/>\nC-style for statement has been removed in Swift 3<br \/>\n\u3010\u4fee\u6b63\u524d\u3011<br \/>\nfor var xi = 1; xi <= xNum; xi += 1 {<br \/>\n\u3010\u4fee\u6b63\u5f8c\u3011<br \/>\nfor xi in 1 &#8230; xNum {  \/\/ 3.1<br \/>\n\u3010\u89e3\u8aac\u3011<br \/>\n\u540c\u3058<\/p>\n<p>\u3010\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\u3011<br \/>\nC-style for statement has been removed in Swift 3<br \/>\n\u3010\u4fee\u6b63\u524d\u3011<br \/>\nfor var yi = 1; yi <= yNum; yi += 1 {<br \/>\n\u3010\u4fee\u6b63\u5f8c\u3011<br \/>\nfor yi in 1 &#8230; yNum {       \/\/ 3.1<br \/>\n\u3010\u89e3\u8aac\u3011<br \/>\n\u540c\u3058<\/p>\n<p>\u3010\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\u3011<br \/>\nC-style for statement has been removed in Swift 3<br \/>\n\u3010\u4fee\u6b63\u524d\u3011<br \/>\nfor var i = 0; i < gs.m_touches.count; i++ {<br \/>\n\u3010\u4fee\u6b63\u5f8c\u3011<br \/>\nfor i in 0 ..< gs.m_touches.count {<br \/>\n\u3010\u89e3\u8aac\u3011<br \/>\n&#8220;\u4ee5\u4e0b&#8221;\u306e\u5834\u5408\u306f &#8230; \u3067\u3001&#8221;\u672a\u6e80&#8221;\u306e\u5834\u5408\u306f ..< \u3067\u3059\u3002\n\n\u3010\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\u3011<br \/>\nC-style for statement has been removed in Swift 3<br \/>\n\u3010\u4fee\u6b63\u524d\u3011<br \/>\nfor var xi = gs.m_glass.enable() ? 8 &#8211; gs.m_glass.xV % 8 : 0; xi <= xNum; xi += 8 {<br \/>\n\u3010\u4fee\u6b63\u5f8c\u3011<br \/>\nfor xi in stride(from: (gs.m_glass.enable() ? 8 &#8211; gs.m_glass.xV % 8 : 0), through: xNum, by: 8) {     \/\/ 3.1<br \/>\n\u3010\u89e3\u8aac\u3011<br \/>\n\u98db\u3073\u77f3\u30d1\u30bf\u30fc\u30f3\u3067\u3059\u3002through\u304c&#8221;\u4ee5\u4e0b&#8221;\u3001to\u304c&#8221;\u672a\u6e80&#8221;\u3067\u3059\u3002\u3053\u306e\u30d1\u30bf\u30fc\u30f3\u306f\u3082\u30461\u7b87\u6240\u3042\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>\u3010\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\u3011<br \/>\nC-style for statement has been removed in Swift 3<br \/>\n\u3010\u4fee\u6b63\u524d\u3011<br \/>\nfor var x:CGFloat = (bPlusX ? start.x + unitX : start.x &#8211; unitX);<br \/>\n                            (bPlusX ? x < end.x : end.x < x);<br \/>\n                            x += (bPlusX ? unitX : -unitX) {<br \/>\n    \/\/ \u51e6\u7406<br \/>\n}<br \/>\n\u3010\u4fee\u6b63\u5f8c\u3011<br \/>\nif (bPlusX) {<br \/>\n    for x : CGFloat in stride(from: start.x + unitX, to: end.x, by: unitX) {<br \/>\n        \/\/ \u51e6\u7406<br \/>\n    }<br \/>\n} else {<br \/>\n    for x : CGFloat in stride(from: end.x, to: start.x &#8211; unitX, by: unitX).reversed() {<br \/>\n        \/\/ \u51e6\u7406<br \/>\n    }<br \/>\n}<br \/>\n\u3010\u89e3\u8aac\u3011<br \/>\n\u6642\u9593\u304b\u304b\u308a\u307e\u3057\u305f\u30fb\u30fb\u30fb<br \/>\n\u4e8b\u524d\u306b\u6761\u4ef6\u5206\u5c90\u3057\u3066\uff12\u3064\u306efor\u30eb\u30fc\u30d7\u306b\u5206\u3051\u308b\u3057\u304b\u306a\u3044\u30fb\u30fb\u30fb\u3088\u306d\uff1f\u5168\u4f53\u3068\u3057\u3066\u8a18\u8ff0\u304c\u9577\u304f\u306a\u3063\u3066\u3057\u307e\u3063\u305f\u30d1\u30bf\u30fc\u30f3\u3067\u3059\u3002\u8907\u96d1\u306afor\u30eb\u30fc\u30d7\u306f\u66f8\u304f\u3079\u304d\u3058\u3083\u306a\u3044\u3068\u3044\u3046\u3053\u3068\u304b\u30fb\u30fb\u30fb\u3053\u306e\u30d1\u30bf\u30fc\u30f3\u306f\u3082\u30461\u7b87\u6240\u3042\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>\u3010\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\u3011<br \/>\nUse of unresolved identifier &#8216;countElements&#8217;<br \/>\n\u3010\u4fee\u6b63\u524d\u3011<br \/>\ncountElements(target)<br \/>\n\u3010\u4fee\u6b63\u5f8c\u3011<br \/>\ntarget.characters.count<br \/>\n\u3010\u89e3\u8aac\u3011<br \/>\n\u5909\u6570target\u306fString\u578b\u3067\u3059\u3002\u6587\u5b57\u306e\u9577\u3055\u53d6\u5f97\u3060\u3051\u3067\u3001\u7d50\u69cb\u624b\u9593\u304c\u304c\u304b\u308a\u307e\u3059\u3002characters\u306f\u3001\u898b\u305f\u76ee\u306e\u6587\u5b57\u6570\u3092\u53d6\u5f97\u3057\u307e\u3059\u3002<\/p>\n<p>\u3010\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\u3011<br \/>\n&#8216;Default&#8217; has been renamed to &#8216;default&#8217;<br \/>\n\u3010\u4fee\u6b63\u524d\u3011<br \/>\nUIAlertActionStyle.Default<br \/>\n\u3010\u4fee\u6b63\u5f8c\u3011<br \/>\nUIAlertActionStyle.default<br \/>\n\u3010\u89e3\u8aac\u3011<br \/>\nDefault\u306e\u5148\u982d\u5927\u6587\u5b57\u304c\u5c0f\u6587\u5b57\u306b\u5909\u308f\u3063\u305f\u3060\u3051\u3002\u5408\u8a083\u7b87\u6240\u3042\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>\u3010\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\u3011<br \/>\nCannot convert value of type &#8216;String&#8217; to expected argument type &#8216;UnsafeMutableRawPointer&#8217;<br \/>\n\u3010\u4fee\u6b63\u524d\u3011<br \/>\nif let path = Bundle.main.path(forResource: file as String, ofType: &#8220;sks&#8221;) {<br \/>\n    var sceneData = Data(bytesNoCopy: path, count: .DataReadingMappedIfSafe, deallocator: nil)!<br \/>\n\u3010\u4fee\u6b63\u5f8c\u3011<br \/>\nif let path = Bundle.main.path(forResource: file as String, ofType: &#8220;sks&#8221;) {<br \/>\n    let pathURL : URL = URL(fileURLWithPath: path)<br \/>\n    var sceneData : Data<br \/>\n    do {<br \/>\n        sceneData = try Data(contentsOf: pathURL, options: .mappedIfSafe)<br \/>\n    } catch {<br \/>\n        print(&#8220;unarchiveFromFile error.&#8221;)<br \/>\n    }<br \/>\n\u3010\u89e3\u8aac\u3011<br \/>\n\u7d50\u69cb\u5909\u308f\u308b\u306a\u3042\u30fb\u30fb\u30fb<\/p>\n<p>\u3010\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\u3011<br \/>\n&#8216;init(forReadingWithData:)&#8217; has been renamed to &#8216;init(forReadingWith:)&#8217;<br \/>\n\u3010\u4fee\u6b63\u524d\u3011<br \/>\nvar archiver = NSKeyedUnarchiver(forReadingWithData: sceneData)<br \/>\n\u3010\u4fee\u6b63\u5f8c\u3011<br \/>\nvar archiver = NSKeyedUnarchiver(forReadingWith: sceneData)<br \/>\n\u3010\u89e3\u8aac\u3011<br \/>\n\u30e9\u30d9\u30eb\u540d\u304c\u5909\u308f\u3063\u305f\u3060\u3051\u3002<\/p>\n<p>\u3010\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\u3011<br \/>\n&#8216;Any?&#8217; is not convertible to &#8216;GameScene&#8217;; did you mean to use &#8216;as!&#8217; to force downcast?<br \/>\n\u3010\u4fee\u6b63\u524d\u3011<br \/>\nlet scene = archiver.decodeObjectForKey(NSKeyedArchiveRootObjectKey) as GameScene<br \/>\n\u3010\u4fee\u6b63\u5f8c\u3011<br \/>\nlet scene = archiver.decodeObject(forKey: NSKeyedArchiveRootObjectKey) as! GameScene<br \/>\n\u3010\u89e3\u8aac\u3011<br \/>\n\u30c0\u30a6\u30f3\u30ad\u30e3\u30b9\u30c8\u306f\u5fc5\u305a\u6210\u529f\u3059\u308b\u60f3\u5b9a\u306a\u306e\u3067\u3001as! \u3067\u5f37\u5236\u7684\u306b\u30ad\u30e3\u30b9\u30c8\u3057\u3066\u5bfe\u51e6\u3057\u307e\u3059\u3001\u304c\u3001\u3044\u3064\u304b\u3089\u3053\u306e\u30a8\u30e9\u30fc\u51fa\u308b\u3088\u3046\u306b\u306a\u3063\u305f\u3093\u3067\u3059\u304b\u306d\uff1f<\/p>\n<p>\u3010\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\u3011<br \/>\nArgument labels &#8216;(data:)&#8217; do not match any available overloads<br \/>\n\u3010\u4fee\u6b63\u524d\u3011<br \/>\nvar data: Data = Data(data:UIImagePNGRepresentation(image)) <br \/>\n\u3010\u4fee\u6b63\u5f8c\u3011<br \/>\nvar data: Data = UIImagePNGRepresentation(image)!<br \/>\n\u3010\u89e3\u8aac\u3011<br \/>\nUIImagePNGRepresentation\u304b\u3089\u76f4\u63a5Data\u3092\u53d6\u5f97\u53ef\u80fd\u306b\u306a\u3063\u305f\u3088\u3046\u3067\u3059\u3002\u3044\u3064\u9803\u5909\u308f\u3063\u305f\u3093\u3060\u308d\u3046\u30fb\u30fb\u30fb<\/p>\n<p>\u30fb\u30fb\u30fb<a href=\"\/support\/index.php\/2017\/07\/16\/swift_update_day2_2\/\">\u7d9a\u304f<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u304a\u306f\u3088\u3046\u3054\u3056\u3044\u307e\u3059\u3002\u7d9a\u304d\u3067\u3059\u3002 \u3010\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\u3011 C-style for statement has been removed in Swift 3 \u3010\u4fee\u6b63\u524d\u3011 for var y = newYStart; y<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-3363","post","type-post","status-publish","format-standard","hentry","category-dotter"],"_links":{"self":[{"href":"https:\/\/minnano.app\/support\/wp-json\/wp\/v2\/posts\/3363","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/minnano.app\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/minnano.app\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/minnano.app\/support\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/minnano.app\/support\/wp-json\/wp\/v2\/comments?post=3363"}],"version-history":[{"count":2,"href":"https:\/\/minnano.app\/support\/wp-json\/wp\/v2\/posts\/3363\/revisions"}],"predecessor-version":[{"id":4006,"href":"https:\/\/minnano.app\/support\/wp-json\/wp\/v2\/posts\/3363\/revisions\/4006"}],"wp:attachment":[{"href":"https:\/\/minnano.app\/support\/wp-json\/wp\/v2\/media?parent=3363"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/minnano.app\/support\/wp-json\/wp\/v2\/categories?post=3363"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/minnano.app\/support\/wp-json\/wp\/v2\/tags?post=3363"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}