3

Environment:
Xcode Version 8.1 beta (8T47)
Apple Swift version 3.0.1 (swiftlang-800.0.56 clang-800.0.42)

The Swift 3.0.1 compiler flagged 'UIScreen' as '...no member'. enter image description here

...but the UIScreen file does have 'main':

@available(iOS 2.0, *) open class UIScreen : NSObject, UITraitEnvironment {

@available(iOS 3.2, *)
open class var screens: [UIScreen] { get } // all screens currently attached to the device

open class var main: UIScreen { get } // the device's internal screen

I found numerous instances of a particular class not having a certain member.
And this was after converting the code to Swift 3.0.1 thru Xcode helper conversion function.
What gives?


Note: I was able to access UIScreen.main.scale via playground.
It appears that I'm working with a corrupt swift file.
Rob
  • 14,746
  • 28
  • 47
  • 65
Frederick C. Lee
  • 9,019
  • 17
  • 64
  • 105

1 Answers1

3

Swift3.0.1 Since UIScreen is UIKit framework's class.So make sure you have imported.

import UIKit
Sakshi
  • 1,060
  • 11
  • 25