How did Apple bridge this struct to Objective-C

I checked UICellConfigurationState and it indeed conforms to _ObjectiveCBridgeable:

func check1(_ v: any _ObjectiveCBridgeable) {}
func check2<T: _ObjectiveCBridgeable>(_ v: T) {}

let cell = UICellConfigurationState(traitCollection: .current)
check1(cell) // ✅ compiles
check2(cell) // ✅ compiles

Found this on the forum:

@Joe_Groff please clarify. Do you mean "it shouldn't" (e.g. because it is private) or that "it mustn't" (e.g. because something will definitely break, or is that recommendation no longer applies or what. The symbol is underscored to tell us something, but what? And it is already used outside of the standard library e.g. in the UICellConfigurationState above.


Digging further, looks like this feature was "deferred" in 2016 (SE-0058). Interestingly it is exposed now and seems to be working fine for clients outside of the standard library, so it is in a kind of a limbo state but it feels more alive than dead.

4 Likes