I converted my Swift 2.3 project to swift 3. Now the compiler no longer throws any errors, but it continues to compile. The CPU is similar to 100%, and it continues to compile for 50 minutes or more, unless you stop it.
Xcode continues to say Building .. | Compiling Swift Source Files
In the build log, it always dwells on the same fast files. Fast files are just model classes, so I don't know what the problem is.
I had the same problem in swift 2, but it was caused by a statement ?? . I reorganized the code to remove the operator ?? so that he could no longer be.
How can I find out what slows compilation time to infinity?
My models look the same:
class Test: InputContract { var appointmentDate: Date! var startTime: String! var endTime: String! var registerDescription: String! var subjectKey: String! var channelCode: String! var relationManagerHrId: String = "" var employeeUserCode: String = "" var smsReminderMobileNumber: String = "" var smsReminderMobileNumberSequence: String! var contactPhoneNumber: String = "" var contactPhoneNumberSequence: String! var smsReminder: Bool = false override func retrieveInputDictionary() -> NSDictionary { return ["description" : self.registerDescription, "appointmentDate" : Utils.formattedDate(self.appointmentDate), "startTime" : self.startTime, "endTime" : self.endTime, "subjectKey" : self.subjectKey, "channelCode" : self.channelCode, "smsReminder" : self.smsReminder ? "true" : "false", "relationManagerHrId" : self.relationManagerHrId, "employeeUserCode" : self.employeeUserCode, "smsReminderMobileNumber" : self.smsReminderMobileNumber, "contactPhoneNumber" : self.contactPhoneNumber, "smsReminderMobileNumberSequence" : self.smsReminderMobileNumberSequence, "contactPhoneNumberSequence" : self.contactPhoneNumberSequence ] } }
InputContract:
protocol InputDictionaryMapper { func retrieveInputDictionary() -> NSDictionary func retrievePublicInputDictionary() -> NSDictionary } class InputContract: Model, InputDictionaryMapper { func retrieveInputDictionary() -> NSDictionary { fatalError("Each inputContract implementation must implement it own method: \(NSStringFromClass(type(of: self)))") } func retrievePublicInputDictionary() -> NSDictionary { fatalError("Each inputContract implementation must implement it own method: \(NSStringFromClass(type(of: self)))") } required init(json: JSON) { fatalError("init(json:) has not been implemented") } override init() { super.init() } }
And the model is just a base class that has another init for json.
When I run the analyzer in the build log, all my models take a long time to create an NSDictionary. But why?