Xcode 14.0 circular reference issues

Hello,

I have recently downloaded xcode 14.0 and have attempted to compile applications which were previously compiling in xcode 13.

I am encountering a large number of 'circular reference' errors during compilation, but am not being given any further information from xcode than the file they supposedly are occuring in. The 'through reference here' log is attached to line 0, and build logs are offering nothing extra.

Many of the files reporting a circular reference are simple structs or files where there is almost definitely no actual circular reference.

I have tried restarted my laptop, redownloaded xcode, deleted derived data and cleaned the build, but the errors persist. I have also tried switching the SWFT_COMPILATION_MODE to whole module. The issues are also occuring on another laptop.

I am interested in hearing if anyone else is encountering this issue, or if there is anything else worth trying.

Answered by vietnam_dev in 732601022

Hello,

This is a crash issue of XC14 compiler. I took hours to search on every forum and Github issues of some well-known project with their releases for XC14&iOS16 and found that almost everything is related in a common fix about: defining typealias inside a protocol

For details, my case is currently due to

public protocol Reusable {
  typealias Cell = UITableViewCell & Reusable
  typealias View = UITableViewHeaderFooterView & Reusable

  static var reuseIdentifier: String { get }
}

I changed them to

public typealias ReusableCell = UITableViewCell & Reusable
public typealias ReusableView = UITableViewHeaderFooterView & Reusable

public protocol Reusable {
  static var reuseIdentifier: String { get }
}

and get the compiler run successfully.

You may have my case to check your source code for similar issue. My code was running well with XC13 but start breaking since XC14

The same issue in Xcode 14 and Xcode 14.1 beta. I've tried the same steps but it doesn't help. Any ideas how to fix it?

Hello, any updates here? We still don't know how to resolve this issue(

Accepted Answer

Hello,

This is a crash issue of XC14 compiler. I took hours to search on every forum and Github issues of some well-known project with their releases for XC14&iOS16 and found that almost everything is related in a common fix about: defining typealias inside a protocol

For details, my case is currently due to

public protocol Reusable {
  typealias Cell = UITableViewCell & Reusable
  typealias View = UITableViewHeaderFooterView & Reusable

  static var reuseIdentifier: String { get }
}

I changed them to

public typealias ReusableCell = UITableViewCell & Reusable
public typealias ReusableView = UITableViewHeaderFooterView & Reusable

public protocol Reusable {
  static var reuseIdentifier: String { get }
}

and get the compiler run successfully.

You may have my case to check your source code for similar issue. My code was running well with XC13 but start breaking since XC14

Hello,

Can confirm that we have come to the same conclusion as vietnam_dev. Our issue was that a typealias was being defined within a protocol. Removing the typealias fixed the issue. We have been in contact with Apple about the issue.

I started having the same issue after updating to Xcode 14. Circular reference errors appearing suddenly in a dozen different files that were no problem before and have no circular references. I only define a typealias in 3 places in my entire codebase and none of those are inside a protocol.. in fact I have only 3 places where a protocol is defined and they are very limited.

At this point, my app can't build no matter what I do.

I have the same problem when archiving my project. The circular references errors point nothing about protocols... it looks like a bug in Xcode. My project is blocked. I can't create an archive. Xcode is a nightmare, really. My project worked well with Xcode 13

Updating my Pods solved the problem for me :)

Xcode 14.0 circular reference issues
 
 
Q