This is a verification xcode project. I witnessed the strange behavior of the app. (only iOS13)
- Specify the protocol (
protocol HogeProtocol
) inherited by the subclass as the Generic Argument of super class (class Base
)
protocol HogeProtocol {}
enum Hoge: HogeProtocol {}
final class Base<Hoge: HogeProtocol> {}
final class Object1<Hoge: HogeProtocol>: Base<Object1>, HogeProtocol {}
final class Object2<Hoge: HogeProtocol>: Base<Object1> {}
final class Object3<Hoge: HogeProtocol>: Base<Object1> {}
.
.
final class Object1000<Hoge: HogeProtocol>: Base<Object1> {}
- Initialize
Object1
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
_ = Object1()
}
}
- The following error is output from a certain number or more, and app crashes.
type metadata accessor for xxx
- Clone
- Open
VerificationApp.xcodeproj
- Run (maybe clash:bomb:)
The verification results in various environments are as follows.
- Xcode
- Xcode11.1(Swift5.1)
- Xcode11.2.1(Swift5.1.3)
- Xcode11.3(Swift5.1.3)
- Build Configuration
- Debug
- Release
- Simulator
- iOS12.2
- iOS13.3
- Subclass Count
- 100
- 1000
Xcode Version | Debug | Release |
---|---|---|
Xcode11.1 | ✅ | ✅ |
Xcode11.2.1 | ✅ | ✅ |
Xcode11.3 | ✅ | ✅ |
Xcode Version | Debug | Release |
---|---|---|
Xcode11.1 | ✅ | ✅ |
Xcode11.2.1 | ✅ | ✅ |
Xcode11.3 | ✅ | ✅ |
Xcode Version | Debug | Release |
---|---|---|
Xcode11.1 | ✅ | ✅ |
Xcode11.2.1 | ✅ | ✅ |
Xcode11.3 | ✅ | ✅ |
Xcode Version | Debug | Release |
---|---|---|
Xcode11.1 | ❌ | ✅ |
Xcode11.2.1 | ❌ | ✅ |
Xcode11.3 | ❌ | ✅ |
This bug occurs when building iOS 13 and debug.:thinking:
(+ when you create a lot of subclasses like class Object
)