This is a dynamic issue with Xcode, but it can be solved by changing your own code. This happened to me when I migrated code from Swift2.3 to Swift3.1
In my case, an error was detected when defining a method, and the method is bound as @IBAction for UIButton.
@IBAction func changeButtonTapped(_ sender: AnyObject) {
Changing the above code to the following, I decided to solve the seg-fault problem.
@IBAction func changeButtonTapped(_ sender: Any) {
EDIT1: Another case of this segmentation error has appeared.
This time, this was due to overriding the variable in a higher scope and using the if statement in the same code example code:
// 'var1' is defined in higher scope func someFunction() { if let var2 = var1, let var1 = someValue { // some code } }
Xcode is confused as to which variable named "var1" to use to define var2. Changing names to something else will solve seg-fault.
Gursimran singh
source share