Skip to content

Instantly share code, notes, and snippets.

@xremix
Last active November 29, 2016 12:32
Show Gist options
  • Save xremix/2a3033f0513ffa3742348148a18734dd to your computer and use it in GitHub Desktop.
Save xremix/2a3033f0513ffa3742348148a18734dd to your computer and use it in GitHub Desktop.
UIViewController Playground for Swift 3.0
//Big thanks to Pretz
import UIKit
let vc = UIViewController()
vc.view.backgroundColor = .white
vc.navigationItem.title = "This is a view controller"
let searchController = UISearchController(searchResultsController: nil)
searchController.searchBar.barTintColor = UIColor.orange
searchController.searchBar.tintColor = UIColor.green
UITextField.appearance(whenContainedInInstancesOf:[UISearchBar.self]).backgroundColor = UIColor.white.withAlphaComponent(0.8)
vc.navigationItem.titleView = searchController.searchBar
let w = UIWindow(frame: CGRect(x: 0, y: 0, width: 320, height: 480))
let nc = UINavigationController(rootViewController: vc)
w.rootViewController = nc
nc.view.frame
//nc.view.frame = CGRectMake(0, 0, 320, 480)
nc.navigationBar.barStyle = .black
nc.navigationBar.barTintColor = UIColor(red:0.16, green:0.45, blue:0.72, alpha:1)
nc.navigationBar.tintColor = .white
nc.view.setNeedsDisplay()
w.makeKeyAndVisible()
w
nc.navigationBar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment