Avatar
swift-evolution - This maintains proposals for changes and user-visible enhancements to the Swift Programming Language.
7:06 AM
これ関連でよくわからない挙動が有りまして
7:06 AM
import UIKit class ViewController: UIViewController { var provider = Provider() override func viewDidLoad() { super.viewDidLoad() provider.reload { self.provider.layout() // 1) Simultaneous access ! } } struct Provider { let cache = Cache() // 2) comment out mutating func reload(completion: @escaping ()->Void) { // 3) remove mutating keyword completion() } func layout() { } } class Cache { } } (edited)
7:07 AM
このコード自体に特に意味は無いんですが、適当なiOSプロジェクトを作ってiOS Simulatorで実行すると 1) で例外?が発生します
7:08 AM
3) の mutating を外すと正常に動くので、SE-0176 関連の挙動かなとは思うんですが
7:08 AM
謎なのは、2) の行をコメントアウトするだけで、例外が発生しなくなるという点です
7:10 AM
手元の再現環境は、macOS 10.13.1 + Xcode 9.2 + iPhone 8 Plus Simulator + デバッグ実行で再現しました。 (edited)
7:11 AM
何かご存知の方いらっしゃいますか?