Thanks for being a part of WWDC25!

How did we do? We’d love to know your thoughts on this year’s conference. Take the survey here

Compiler - method linking issue.

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:

  1. Comment out the Swift-6 flag.
  2. 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..

Are you able to reproduce this in a small test project?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Thank you for your response on this @DTS Engineer

We tried making a separate test project with similar setup of packages and code structure but unable to reproduce it.

I just wanted to check if anyone has came across such or similar issue(s) or has any suggestions.

Compiler - method linking issue.
 
 
Q