'self' captured by a closure before all members were initialized

前端 未结 3 2092
囚心锁ツ
囚心锁ツ 2020-12-11 01:02

Alright, so just to start off, heres my code:

import UIKit
import ForecastIO

class Weather {
    var temp: Float
    var condition: String
    var wind: Fl         


        
3条回答
  •  温柔的废话
    2020-12-11 01:34

    For me, it's because I didn't call super.init() in the initializer.

    class AnObject: NSObject {
        override init() {
    //        super.init()
    
            let _: ()-> (Void) = {
                print(String(describing: self))
            }
        }
    }
    

提交回复
热议问题