In Swift, what's the difference between calling UINavigationController() vs UINavigationController.init()?

后端 未结 3 1926
时光取名叫无心
时光取名叫无心 2020-12-04 00:46

In Swift, what\'s the difference between calling UINavigation() vs UINavigation.init()? They both seem to return valid instance of UINavigati

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-04 01:25

    UINavigationController() and UINavigationController.init() are the exact same thing. You can verify this by typing both into a Playground and then option-clicking on them. Both bring up the documentation for the same initializer.

    The Swift convention is to use just the type name (without .init).

提交回复
热议问题