Issue:
During app execution, the intended method is not being called; instead, the method preceding (written above the intended method) is being executed.
For Example:
//In my case the ViewController class is at 3rd level of inheritance.
class ViewController: UIViewController {
func methodA() { print("methodA") }
func methodB() { print("methodB") } }
let vc = ViewController() vc.methodB()
Output: //"methodA"
Expected: //"methodB"
Observations:
Recent code changes have revealed that enabling the below Swift-6 flag leads to this linking issue. When this flag is commented out, the problem disappears.
.enableUpcomingFeature("InternalImportsByDefault")
Additionally, moving the intended method into an extension of the same class resolves the issue when the flag is enabled.
Conclusion:
To resolve the issue:
- Comment out the Swift-6 flag.
- Alternatively, move the method into an extension of the same class, which addresses the issue for this specific case.
I had similar issue in other class where it crashes with message "method not found", but actually the method is there. When moving the method into an extension of same class resolve this issue.
Any help is much appreciated.
Thanking you..