user10763731
user10763731

Reputation: 13

How to fix 'Cannot call value of non-function type 'UIColor''

As I just start learning programming, it shows the following errors that my code have.

Use of undeclared type 'NSObect' Cannot call value of non-function type 'UIColor' Cannot call value of non-function type 'UIColor'

Could someone please point my error here and correct back my code? Thankssss if you could help:)

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions:
    [NSObect:AnyObject]?) -> Bool {

    self.window = UIWindow(frame:
        UIScreen.main.bounds)

    self.window!.backgroundColor = UIColor.whiteColor()

    let myTabBar = UITabBarController()

    myTabBar.tabBar.backgroundColor = UIColor.clearColor()

    let mainViewController = ViewController()
    mainViewController.tabBarItem =
        UITabBarItem(tabBarSystemItem: .favorites, tag: 100)

    let articleViewController = ArticleViewController()
    articleViewController.tabBarItem = UITabBarItem(

Upvotes: 0

Views: 2634

Answers (1)

Dharmesh Kheni
Dharmesh Kheni

Reputation: 71854

Looks like you are using old code so replace:

self.window!.backgroundColor = UIColor.whiteColor()

with

self.window!.backgroundColor = .white

And Replace:

myTabBar.tabBar.backgroundColor = UIColor.clearColor()

with

myTabBar.tabBar.backgroundColor = .clear

Upvotes: 1

Related Questions