├── images ├── mainwindow.png ├── full_size_content.png ├── transparent_title.png ├── title_hidden_window.png ├── title_visible_window.png ├── title_accessory_view_on_left.png ├── title_accessory_view_at_bottom.png ├── title_accessory_view_on_right.png └── full_size_content_without_title.png ├── TitlebarAndToolbar ├── Assets.xcassets │ ├── Contents.json │ ├── background.imageset │ │ ├── IMG_5519.png │ │ └── Contents.json │ └── AppIcon.appiconset │ │ └── Contents.json ├── AppDelegate.swift ├── SampleViewController.swift ├── Info.plist ├── ViewController.swift └── Base.lproj │ └── Main.storyboard ├── TitlebarAndToolbar.xcodeproj ├── xcuserdata │ └── luyibin.xcuserdatad │ │ ├── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist │ │ └── xcschemes │ │ ├── xcschememanagement.plist │ │ └── TitlebarAndToolbar.xcscheme ├── project.xcworkspace │ └── contents.xcworkspacedata └── project.pbxproj ├── TitlebarAndToolbarTests ├── Info.plist └── TitlebarAndToolbarTests.swift ├── TitlebarAndToolbarUITests ├── Info.plist └── TitlebarAndToolbarUITests.swift └── Readme.md /images/mainwindow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robin/TitlebarAndToolbar/HEAD/images/mainwindow.png -------------------------------------------------------------------------------- /images/full_size_content.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robin/TitlebarAndToolbar/HEAD/images/full_size_content.png -------------------------------------------------------------------------------- /images/transparent_title.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robin/TitlebarAndToolbar/HEAD/images/transparent_title.png -------------------------------------------------------------------------------- /images/title_hidden_window.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robin/TitlebarAndToolbar/HEAD/images/title_hidden_window.png -------------------------------------------------------------------------------- /images/title_visible_window.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robin/TitlebarAndToolbar/HEAD/images/title_visible_window.png -------------------------------------------------------------------------------- /TitlebarAndToolbar/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /images/title_accessory_view_on_left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robin/TitlebarAndToolbar/HEAD/images/title_accessory_view_on_left.png -------------------------------------------------------------------------------- /images/title_accessory_view_at_bottom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robin/TitlebarAndToolbar/HEAD/images/title_accessory_view_at_bottom.png -------------------------------------------------------------------------------- /images/title_accessory_view_on_right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robin/TitlebarAndToolbar/HEAD/images/title_accessory_view_on_right.png -------------------------------------------------------------------------------- /images/full_size_content_without_title.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robin/TitlebarAndToolbar/HEAD/images/full_size_content_without_title.png -------------------------------------------------------------------------------- /TitlebarAndToolbar/Assets.xcassets/background.imageset/IMG_5519.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robin/TitlebarAndToolbar/HEAD/TitlebarAndToolbar/Assets.xcassets/background.imageset/IMG_5519.png -------------------------------------------------------------------------------- /TitlebarAndToolbar.xcodeproj/xcuserdata/luyibin.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /TitlebarAndToolbar.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /TitlebarAndToolbar/Assets.xcassets/background.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "IMG_5519.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /TitlebarAndToolbar/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // TitlebarAndToolbar 4 | // 5 | // Created by Lu Yibin on 16/3/24. 6 | // Copyright © 2016年 Lu Yibin. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | 11 | @NSApplicationMain 12 | class AppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate { 13 | 14 | func applicationDidFinishLaunching(_ aNotification: Notification) { 15 | // Insert code here to initialize your application 16 | } 17 | 18 | func applicationWillTerminate(_ aNotification: Notification) { 19 | // Insert code here to tear down your application 20 | UserDefaults.standard.synchronize() 21 | } 22 | 23 | func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { 24 | return true 25 | } 26 | } 27 | 28 | -------------------------------------------------------------------------------- /TitlebarAndToolbarTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /TitlebarAndToolbarUITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /TitlebarAndToolbar.xcodeproj/xcuserdata/luyibin.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | TitlebarAndToolbar.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | AEE69D7D1CA39F170061467C 16 | 17 | primary 18 | 19 | 20 | AEE69D8E1CA39F170061467C 21 | 22 | primary 23 | 24 | 25 | AEE69D991CA39F170061467C 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /TitlebarAndToolbarTests/TitlebarAndToolbarTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TitlebarAndToolbarTests.swift 3 | // TitlebarAndToolbarTests 4 | // 5 | // Created by Lu Yibin on 16/3/24. 6 | // Copyright © 2016年 Lu Yibin. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | @testable import TitlebarAndToolbar 11 | 12 | class TitlebarAndToolbarTests: XCTestCase { 13 | 14 | override func setUp() { 15 | super.setUp() 16 | // Put setup code here. This method is called before the invocation of each test method in the class. 17 | } 18 | 19 | override func tearDown() { 20 | // Put teardown code here. This method is called after the invocation of each test method in the class. 21 | super.tearDown() 22 | } 23 | 24 | func testExample() { 25 | // This is an example of a functional test case. 26 | // Use XCTAssert and related functions to verify your tests produce the correct results. 27 | } 28 | 29 | func testPerformanceExample() { 30 | // This is an example of a performance test case. 31 | self.measure { 32 | // Put the code you want to measure the time of here. 33 | } 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /TitlebarAndToolbar/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "mac", 5 | "size" : "16x16", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "mac", 10 | "size" : "16x16", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "mac", 15 | "size" : "32x32", 16 | "scale" : "1x" 17 | }, 18 | { 19 | "idiom" : "mac", 20 | "size" : "32x32", 21 | "scale" : "2x" 22 | }, 23 | { 24 | "idiom" : "mac", 25 | "size" : "128x128", 26 | "scale" : "1x" 27 | }, 28 | { 29 | "idiom" : "mac", 30 | "size" : "128x128", 31 | "scale" : "2x" 32 | }, 33 | { 34 | "idiom" : "mac", 35 | "size" : "256x256", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "mac", 40 | "size" : "256x256", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "mac", 45 | "size" : "512x512", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "mac", 50 | "size" : "512x512", 51 | "scale" : "2x" 52 | } 53 | ], 54 | "info" : { 55 | "version" : 1, 56 | "author" : "xcode" 57 | } 58 | } -------------------------------------------------------------------------------- /TitlebarAndToolbar/SampleViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SampleViewController.swift 3 | // TitlebarAndToolbar 4 | // 5 | // Created by Lu Yibin on 16/6/21. 6 | // Copyright © 2016年 Lu Yibin. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | 11 | class SampleViewController: NSViewController { 12 | 13 | @IBOutlet weak var textField: NSTextField! 14 | @IBOutlet weak var textField2: NSTextField! 15 | @IBOutlet weak var scrollView: NSScrollView! 16 | @IBOutlet weak var imageView: NSImageView! 17 | 18 | var topConstraint : NSLayoutConstraint? 19 | 20 | override func viewDidLoad() { 21 | super.viewDidLoad() 22 | 23 | // Do view setup here. 24 | textField.stringValue = "aligned to window.topAnchor" 25 | 26 | } 27 | 28 | override func updateViewConstraints() { 29 | if topConstraint == nil { 30 | if let topAnchor = (self.view.window?.contentLayoutGuide as? NSLayoutGuide)?.topAnchor { 31 | topConstraint = self.textField.topAnchor.constraint(equalTo: topAnchor, constant: 0) 32 | topConstraint?.isActive = true 33 | } 34 | } 35 | super.updateViewConstraints() 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /TitlebarAndToolbar/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSMinimumSystemVersion 26 | $(MACOSX_DEPLOYMENT_TARGET) 27 | NSHumanReadableCopyright 28 | Copyright © 2016年 Lu Yibin. All rights reserved. 29 | NSMainStoryboardFile 30 | Main 31 | NSPrincipalClass 32 | NSApplication 33 | 34 | 35 | -------------------------------------------------------------------------------- /TitlebarAndToolbarUITests/TitlebarAndToolbarUITests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TitlebarAndToolbarUITests.swift 3 | // TitlebarAndToolbarUITests 4 | // 5 | // Created by Lu Yibin on 16/3/24. 6 | // Copyright © 2016年 Lu Yibin. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | 11 | class TitlebarAndToolbarUITests: XCTestCase { 12 | 13 | override func setUp() { 14 | super.setUp() 15 | 16 | // Put setup code here. This method is called before the invocation of each test method in the class. 17 | 18 | // In UI tests it is usually best to stop immediately when a failure occurs. 19 | continueAfterFailure = false 20 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 21 | XCUIApplication().launch() 22 | 23 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 24 | } 25 | 26 | override func tearDown() { 27 | // Put teardown code here. This method is called after the invocation of each test method in the class. 28 | super.tearDown() 29 | } 30 | 31 | func testExample() { 32 | // Use recording to get started writing UI tests. 33 | // Use XCTAssert and related functions to verify your tests produce the correct results. 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- 1 | # Title bar and Toolbar of NSWindow examples 2 | 3 | [![Platform](http://img.shields.io/badge/platform-macOS-red.svg?style=flat)](https://developer.apple.com/macos/) 4 | [![Swift 4](https://img.shields.io/badge/Swift-4.0-orange.svg?style=flat)](https://developer.apple.com/swift/) 5 | [![License](http://img.shields.io/badge/license-MIT-lightgrey.svg?style=flat)](http://mit-license.org) 6 | [![Twitter](https://img.shields.io/badge/twitter-@robinlu-blue.svg?style=flat)](http://twitter.com/robinlu) 7 | 8 | This is a showcase for several combinations of styles of title bar and toolbar of NSWindow. 9 | 10 | 11 | 12 | ## Title visibility 13 | By default, the title of window is visible. 14 | ![window with title visible](./images/title_visible_window.png) 15 | 16 | ```swift 17 | window.titleVisibility = .visible 18 | ``` 19 | 20 | ![window with title invisible](./images/title_hidden_window.png) 21 | This is a streamlined toolbar which is a window with a toolbar while the title setting to invisible: 22 | 23 | ```swift 24 | window.titleVisibility = .hidden 25 | ``` 26 | Example applications: Calendar, Notes, Xcode 27 | 28 | ## Full size content view 29 | When setting the NSWindow.StyleMask.fullSizeContentView, the content view extends to the whole window. The title bar and toolbar use a blur effect if visible. 30 | ```swift 31 | window.styleMask.insert(NSWindow.StyleMask.fullSizeContentView) 32 | ``` 33 | 34 | When both title and toolbar are visible: 35 | ![full size content view](./images/full_size_content.png) 36 | 37 | When title is invisible: 38 | ![full size content view without title](./images/full_size_content_without_title.png) 39 | Example applications: Safari, Photos, Wunderlist 40 | 41 | ## Transparent title bar 42 | If you want to hide the title bar but still need the window buttons (such as close button, minimize button and screen button), you can set the titlebar to transparent: 43 | ```swift 44 | window.titlebarAppearsTransparent = true 45 | ``` 46 | 47 | You may want to hide the title and use full size content view to get the following style. 48 | ```swift 49 | window.titlebarAppearsTransparent = true 50 | window.titleVisibility = .hidden 51 | window.styleMask.insert(NSWindow.StyleMask.fullSizeContentView) 52 | ``` 53 | ![transparent titlebar](./images/transparent_title.png) 54 | Example application: Reeder, 55 | 56 | ## Title accessory view 57 | According to the documentation, title accessory view is a custom view you can put along with the title bar. 58 | 59 | There are three layout choices. 60 | 61 | At the bottom of title bar: 62 | ![title accessory view at the bottom of the title bar](./images/title_accessory_view_at_bottom.png) 63 | It’s at the bottom of title bar or toolbar. You can set the height of the view. 64 | 65 | On the left of the title bar: 66 | ![title accessory view on the left of the title bar](./images/title_accessory_view_on_left.png) 67 | You can set the width of the view. The height of the title bar is fixed. If you set the height of the title accessory view, it doesn’t affect the height of the title and is clipped by the title bar. If the toolbar exist, it overlaps with the toolbar. 68 | 69 | On the right of the title bar: 70 | ![title accessory view on the right of the title bar](./images/title_accessory_view_on_right.png) 71 | You can set the width of the view. The height of the title bar is fixed. If you set the height of the title accessory view, it doesn’t affect the height of the title and is clipped by the title bar. If the toolbar exist, it overlaps with the toolbar. 72 | 73 | Example application: IA Writer 74 | 75 | One thing to remember. **You have to set the layout attribute before add the accessory view to the title**. 76 | 77 | ## Unified title and toolbar 78 | Looks like this has been deprecated. No matter what you set, the title bar and toolbar are unified since Yosemite. 79 | 80 | ## Author 81 | [Lu Yibin](http://robin.github.io) 82 | -------------------------------------------------------------------------------- /TitlebarAndToolbar.xcodeproj/xcuserdata/luyibin.xcuserdatad/xcschemes/TitlebarAndToolbar.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 31 | 32 | 34 | 40 | 41 | 42 | 44 | 50 | 51 | 52 | 53 | 54 | 60 | 61 | 62 | 63 | 64 | 65 | 76 | 78 | 84 | 85 | 86 | 87 | 88 | 89 | 95 | 97 | 103 | 104 | 105 | 106 | 108 | 109 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /TitlebarAndToolbar/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // TitlebarAndToolbar 4 | // 5 | // Created by Lu Yibin on 16/3/24. 6 | // Copyright © 2016年 Lu Yibin. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | 11 | extension OptionSet { 12 | func optionState(_ opt: Self.Element) -> Int { 13 | return self.contains(opt) ? NSControl.StateValue.on.rawValue : NSControl.StateValue.off.rawValue 14 | } 15 | } 16 | 17 | class ViewController: NSViewController, NSWindowDelegate { 18 | 19 | @IBOutlet weak var unifiedTitleAndToolbarCheckbox: NSButton! 20 | @IBOutlet weak var titleAppearsTransparentCheckbox: NSButton! 21 | @IBOutlet weak var titleVisibilityCheckbox: NSButton! 22 | @IBOutlet weak var fullContentViewCheckbox: NSButton! 23 | @IBOutlet weak var titleAccessoryViewCheckbox: NSButton! 24 | @IBOutlet weak var titleAccessoryViewLayoutMatrix: NSMatrix! 25 | @IBOutlet weak var showToolbarCheckbox: NSButton! 26 | @IBOutlet weak var titleBarCheckBox: NSButton! 27 | 28 | @IBOutlet var codeTextView: NSTextView! 29 | 30 | var windowControllers = [NSWindowController]() 31 | 32 | @objc dynamic var titleAccessoryViewEnabled : Bool { 33 | return self.titleAccessoryViewCheckbox.state == NSControl.StateValue.on 34 | } 35 | 36 | override func viewDidLoad() { 37 | super.viewDidLoad() 38 | 39 | // Do any additional setup after loading the view. 40 | self.codeTextView.font = NSFont(name: "Monaco", size: 12) 41 | generateCode() 42 | } 43 | 44 | override var representedObject: Any? { 45 | didSet { 46 | // Update the view, if already loaded. 47 | } 48 | } 49 | 50 | func showWindowWithTitle(_ controller:NSWindowController, title:String) { 51 | windowControllers.append(controller) 52 | controller.window?.title = title 53 | controller.showWindow(self) 54 | } 55 | 56 | func instantiateWindowController() -> NSWindowController? { 57 | if let storyboard = self.storyboard { 58 | return storyboard.instantiateController(withIdentifier: NSStoryboard.SceneIdentifier(rawValue: "windowController")) as? NSWindowController 59 | } 60 | return nil 61 | } 62 | 63 | func generateCode() { 64 | var code : String = "" 65 | if unifiedTitleAndToolbarCheckbox.state == NSControl.StateValue.on { 66 | code.append("window.styleMask.insert(NSWindow.StyleMask.unifiedTitleAndToolbar)\n") 67 | } else { 68 | code.append("window.styleMask.remove(NSWindow.StyleMask.unifiedTitleAndToolbar)\n") 69 | } 70 | if fullContentViewCheckbox.state == NSControl.StateValue.on { 71 | code.append("window.styleMask.insert(NSWindow.StyleMask.fullSizeContentView)\n") 72 | } else { 73 | code.append("window.styleMask.remove(NSWindow.StyleMask.fullSizeContentView)\n") 74 | } 75 | if titleBarCheckBox.state == NSControl.StateValue.on { 76 | code.append("window.styleMask.insert(NSWindow.StyleMask.titled)\n") 77 | } else { 78 | code.append("window.styleMask.remove(NSWindow.StyleMask.titled)\n") 79 | } 80 | let showToolbar = showToolbarCheckbox.state == NSControl.StateValue.on 81 | code.append("window.toolbar?.isVisible = \(showToolbar)\n") 82 | 83 | let visibility = titleVisibilityCheckbox.state == NSControl.StateValue.off ? ".hidden" : ".visible" 84 | code.append("window.titleVisibility = \(visibility)\n") 85 | 86 | let transparent = titleAppearsTransparentCheckbox.state == NSControl.StateValue.on 87 | code.append("window.titlebarAppearsTransparent = \(transparent)\n") 88 | self.codeTextView.string = code 89 | } 90 | 91 | @IBAction func titleAccessoryChecked(_ sender: AnyObject) { 92 | self.willChangeValue(forKey: "titleAccessoryViewEnabled") 93 | self.didChangeValue(forKey: "titleAccessoryViewEnabled") 94 | self.attributeChanged(sender) 95 | } 96 | 97 | @IBAction func attributeChanged(_ sender: AnyObject) { 98 | generateCode() 99 | } 100 | 101 | func setToDefault() { 102 | let userDefaults = UserDefaults.standard 103 | if let defaultStyleMask = self.view.window?.styleMask { 104 | unifiedTitleAndToolbarCheckbox.state = NSControl.StateValue(rawValue: defaultStyleMask.optionState(NSWindow.StyleMask.unifiedTitleAndToolbar)) 105 | userDefaults.set(unifiedTitleAndToolbarCheckbox.state, forKey: "unifiedTitleAndToolbar") 106 | fullContentViewCheckbox.state = NSControl.StateValue(rawValue: defaultStyleMask.optionState(NSWindow.StyleMask.fullSizeContentView)) 107 | userDefaults.set(fullContentViewCheckbox.state, forKey: "fullSizeContentView") 108 | titleBarCheckBox.state = NSControl.StateValue(rawValue: defaultStyleMask.optionState(NSWindow.StyleMask.titled)) 109 | userDefaults.set(titleBarCheckBox.state, forKey: "titleBar") 110 | } 111 | self.titleAccessoryViewCheckbox.state = NSControl.StateValue.off 112 | userDefaults.set(NSControl.StateValue.off, forKey: "hasTitleAccessoryView") 113 | titleVisibilityCheckbox.state = NSControl.StateValue.on 114 | userDefaults.set(titleVisibilityCheckbox.state, forKey: "titleVisibility") 115 | titleAppearsTransparentCheckbox.state = NSControl.StateValue.off 116 | userDefaults.set(titleAppearsTransparentCheckbox.state, forKey: "transparentTitleBar") 117 | } 118 | 119 | @IBAction func restoreSettings(_ sender: AnyObject) { 120 | guard let popUpButton = sender as? NSPopUpButton, let item = popUpButton.selectedItem else { 121 | return 122 | } 123 | let userDefaults = UserDefaults.standard 124 | if item.tag == 1 { 125 | setToDefault() 126 | } else if item.tag == 2 { 127 | setToDefault() 128 | titleVisibilityCheckbox.state = NSControl.StateValue.off 129 | userDefaults.set(titleVisibilityCheckbox.state, forKey: "titleVisibility") 130 | showToolbarCheckbox.state = NSControl.StateValue.on 131 | userDefaults.set(showToolbarCheckbox.state, forKey:"showToolbar") 132 | } else if item.tag == 3 { 133 | setToDefault() 134 | fullContentViewCheckbox.state = NSControl.StateValue.on 135 | userDefaults.set(fullContentViewCheckbox.state, forKey: "fullSizeContentView") 136 | titleVisibilityCheckbox.state = NSControl.StateValue.off 137 | userDefaults.set(titleVisibilityCheckbox.state, forKey: "titleVisibility") 138 | titleAppearsTransparentCheckbox.state = NSControl.StateValue.on 139 | userDefaults.set(titleAppearsTransparentCheckbox.state, forKey: "transparentTitleBar") 140 | showToolbarCheckbox.state = NSControl.StateValue.off 141 | userDefaults.set(showToolbarCheckbox.state, forKey:"showToolbar") 142 | 143 | } 144 | generateCode() 145 | } 146 | 147 | @IBAction func launchWindow(_ sender: AnyObject) { 148 | if let controller = instantiateWindowController() { 149 | if let window = controller.window { 150 | if unifiedTitleAndToolbarCheckbox.state == NSControl.StateValue.on { 151 | window.styleMask.insert(NSWindow.StyleMask.unifiedTitleAndToolbar) 152 | } else { 153 | window.styleMask.remove(NSWindow.StyleMask.unifiedTitleAndToolbar) 154 | } 155 | if fullContentViewCheckbox.state == NSControl.StateValue.on { 156 | window.styleMask.insert(NSWindow.StyleMask.fullSizeContentView) 157 | } else { 158 | window.styleMask.remove(NSWindow.StyleMask.fullSizeContentView) 159 | } 160 | if titleBarCheckBox.state == NSControl.StateValue.on { 161 | window.styleMask.insert(NSWindow.StyleMask.titled) 162 | } else { 163 | window.styleMask.remove(NSWindow.StyleMask.titled) 164 | } 165 | window.toolbar?.isVisible = showToolbarCheckbox.state == NSControl.StateValue.on 166 | 167 | showWindowWithTitle(controller, title: "Window") 168 | 169 | if titleAccessoryViewEnabled { 170 | if let titlebarController = self.storyboard?.instantiateController(withIdentifier: NSStoryboard.SceneIdentifier(rawValue: "titlebarViewController")) as? NSTitlebarAccessoryViewController { 171 | switch self.titleAccessoryViewLayoutMatrix.selectedRow { 172 | case 0: 173 | titlebarController.layoutAttribute = .bottom 174 | case 1: 175 | titlebarController.layoutAttribute = .left 176 | case 2: 177 | titlebarController.layoutAttribute = .right 178 | default: 179 | titlebarController.layoutAttribute = .bottom 180 | } 181 | 182 | // layoutAttribute has to be set before added to window 183 | window.addTitlebarAccessoryViewController(titlebarController) 184 | } 185 | } 186 | window.titleVisibility = titleVisibilityCheckbox.state == NSControl.StateValue.off ? .hidden : .visible 187 | window.titlebarAppearsTransparent = titleAppearsTransparentCheckbox.state == NSControl.StateValue.on 188 | } 189 | } 190 | } 191 | 192 | } 193 | 194 | -------------------------------------------------------------------------------- /TitlebarAndToolbar.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | AEA565561D18EF1900896DC2 /* SampleViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = AEA565551D18EF1900896DC2 /* SampleViewController.swift */; }; 11 | AEE69D821CA39F170061467C /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = AEE69D811CA39F170061467C /* AppDelegate.swift */; }; 12 | AEE69D841CA39F170061467C /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = AEE69D831CA39F170061467C /* ViewController.swift */; }; 13 | AEE69D861CA39F170061467C /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = AEE69D851CA39F170061467C /* Assets.xcassets */; }; 14 | AEE69D891CA39F170061467C /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = AEE69D871CA39F170061467C /* Main.storyboard */; }; 15 | AEE69D941CA39F170061467C /* TitlebarAndToolbarTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = AEE69D931CA39F170061467C /* TitlebarAndToolbarTests.swift */; }; 16 | AEE69D9F1CA39F170061467C /* TitlebarAndToolbarUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = AEE69D9E1CA39F170061467C /* TitlebarAndToolbarUITests.swift */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXContainerItemProxy section */ 20 | AEE69D901CA39F170061467C /* PBXContainerItemProxy */ = { 21 | isa = PBXContainerItemProxy; 22 | containerPortal = AEE69D761CA39F170061467C /* Project object */; 23 | proxyType = 1; 24 | remoteGlobalIDString = AEE69D7D1CA39F170061467C; 25 | remoteInfo = TitlebarAndToolbar; 26 | }; 27 | AEE69D9B1CA39F170061467C /* PBXContainerItemProxy */ = { 28 | isa = PBXContainerItemProxy; 29 | containerPortal = AEE69D761CA39F170061467C /* Project object */; 30 | proxyType = 1; 31 | remoteGlobalIDString = AEE69D7D1CA39F170061467C; 32 | remoteInfo = TitlebarAndToolbar; 33 | }; 34 | /* End PBXContainerItemProxy section */ 35 | 36 | /* Begin PBXFileReference section */ 37 | AEA565551D18EF1900896DC2 /* SampleViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SampleViewController.swift; sourceTree = ""; }; 38 | AEE69D7E1CA39F170061467C /* TitlebarAndToolbar.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TitlebarAndToolbar.app; sourceTree = BUILT_PRODUCTS_DIR; }; 39 | AEE69D811CA39F170061467C /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 40 | AEE69D831CA39F170061467C /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 41 | AEE69D851CA39F170061467C /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 42 | AEE69D881CA39F170061467C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 43 | AEE69D8A1CA39F170061467C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 44 | AEE69D8F1CA39F170061467C /* TitlebarAndToolbarTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = TitlebarAndToolbarTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 45 | AEE69D931CA39F170061467C /* TitlebarAndToolbarTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TitlebarAndToolbarTests.swift; sourceTree = ""; }; 46 | AEE69D951CA39F170061467C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 47 | AEE69D9A1CA39F170061467C /* TitlebarAndToolbarUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = TitlebarAndToolbarUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 48 | AEE69D9E1CA39F170061467C /* TitlebarAndToolbarUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TitlebarAndToolbarUITests.swift; sourceTree = ""; }; 49 | AEE69DA01CA39F170061467C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 50 | /* End PBXFileReference section */ 51 | 52 | /* Begin PBXFrameworksBuildPhase section */ 53 | AEE69D7B1CA39F170061467C /* Frameworks */ = { 54 | isa = PBXFrameworksBuildPhase; 55 | buildActionMask = 2147483647; 56 | files = ( 57 | ); 58 | runOnlyForDeploymentPostprocessing = 0; 59 | }; 60 | AEE69D8C1CA39F170061467C /* Frameworks */ = { 61 | isa = PBXFrameworksBuildPhase; 62 | buildActionMask = 2147483647; 63 | files = ( 64 | ); 65 | runOnlyForDeploymentPostprocessing = 0; 66 | }; 67 | AEE69D971CA39F170061467C /* Frameworks */ = { 68 | isa = PBXFrameworksBuildPhase; 69 | buildActionMask = 2147483647; 70 | files = ( 71 | ); 72 | runOnlyForDeploymentPostprocessing = 0; 73 | }; 74 | /* End PBXFrameworksBuildPhase section */ 75 | 76 | /* Begin PBXGroup section */ 77 | AEE69D751CA39F170061467C = { 78 | isa = PBXGroup; 79 | children = ( 80 | AEE69D801CA39F170061467C /* TitlebarAndToolbar */, 81 | AEE69D921CA39F170061467C /* TitlebarAndToolbarTests */, 82 | AEE69D9D1CA39F170061467C /* TitlebarAndToolbarUITests */, 83 | AEE69D7F1CA39F170061467C /* Products */, 84 | ); 85 | sourceTree = ""; 86 | }; 87 | AEE69D7F1CA39F170061467C /* Products */ = { 88 | isa = PBXGroup; 89 | children = ( 90 | AEE69D7E1CA39F170061467C /* TitlebarAndToolbar.app */, 91 | AEE69D8F1CA39F170061467C /* TitlebarAndToolbarTests.xctest */, 92 | AEE69D9A1CA39F170061467C /* TitlebarAndToolbarUITests.xctest */, 93 | ); 94 | name = Products; 95 | sourceTree = ""; 96 | }; 97 | AEE69D801CA39F170061467C /* TitlebarAndToolbar */ = { 98 | isa = PBXGroup; 99 | children = ( 100 | AEE69D811CA39F170061467C /* AppDelegate.swift */, 101 | AEE69D831CA39F170061467C /* ViewController.swift */, 102 | AEE69D851CA39F170061467C /* Assets.xcassets */, 103 | AEE69D871CA39F170061467C /* Main.storyboard */, 104 | AEA565551D18EF1900896DC2 /* SampleViewController.swift */, 105 | AEE69D8A1CA39F170061467C /* Info.plist */, 106 | ); 107 | path = TitlebarAndToolbar; 108 | sourceTree = ""; 109 | }; 110 | AEE69D921CA39F170061467C /* TitlebarAndToolbarTests */ = { 111 | isa = PBXGroup; 112 | children = ( 113 | AEE69D931CA39F170061467C /* TitlebarAndToolbarTests.swift */, 114 | AEE69D951CA39F170061467C /* Info.plist */, 115 | ); 116 | path = TitlebarAndToolbarTests; 117 | sourceTree = ""; 118 | }; 119 | AEE69D9D1CA39F170061467C /* TitlebarAndToolbarUITests */ = { 120 | isa = PBXGroup; 121 | children = ( 122 | AEE69D9E1CA39F170061467C /* TitlebarAndToolbarUITests.swift */, 123 | AEE69DA01CA39F170061467C /* Info.plist */, 124 | ); 125 | path = TitlebarAndToolbarUITests; 126 | sourceTree = ""; 127 | }; 128 | /* End PBXGroup section */ 129 | 130 | /* Begin PBXNativeTarget section */ 131 | AEE69D7D1CA39F170061467C /* TitlebarAndToolbar */ = { 132 | isa = PBXNativeTarget; 133 | buildConfigurationList = AEE69DA31CA39F170061467C /* Build configuration list for PBXNativeTarget "TitlebarAndToolbar" */; 134 | buildPhases = ( 135 | AEE69D7A1CA39F170061467C /* Sources */, 136 | AEE69D7B1CA39F170061467C /* Frameworks */, 137 | AEE69D7C1CA39F170061467C /* Resources */, 138 | ); 139 | buildRules = ( 140 | ); 141 | dependencies = ( 142 | ); 143 | name = TitlebarAndToolbar; 144 | productName = TitlebarAndToolbar; 145 | productReference = AEE69D7E1CA39F170061467C /* TitlebarAndToolbar.app */; 146 | productType = "com.apple.product-type.application"; 147 | }; 148 | AEE69D8E1CA39F170061467C /* TitlebarAndToolbarTests */ = { 149 | isa = PBXNativeTarget; 150 | buildConfigurationList = AEE69DA61CA39F170061467C /* Build configuration list for PBXNativeTarget "TitlebarAndToolbarTests" */; 151 | buildPhases = ( 152 | AEE69D8B1CA39F170061467C /* Sources */, 153 | AEE69D8C1CA39F170061467C /* Frameworks */, 154 | AEE69D8D1CA39F170061467C /* Resources */, 155 | ); 156 | buildRules = ( 157 | ); 158 | dependencies = ( 159 | AEE69D911CA39F170061467C /* PBXTargetDependency */, 160 | ); 161 | name = TitlebarAndToolbarTests; 162 | productName = TitlebarAndToolbarTests; 163 | productReference = AEE69D8F1CA39F170061467C /* TitlebarAndToolbarTests.xctest */; 164 | productType = "com.apple.product-type.bundle.unit-test"; 165 | }; 166 | AEE69D991CA39F170061467C /* TitlebarAndToolbarUITests */ = { 167 | isa = PBXNativeTarget; 168 | buildConfigurationList = AEE69DA91CA39F170061467C /* Build configuration list for PBXNativeTarget "TitlebarAndToolbarUITests" */; 169 | buildPhases = ( 170 | AEE69D961CA39F170061467C /* Sources */, 171 | AEE69D971CA39F170061467C /* Frameworks */, 172 | AEE69D981CA39F170061467C /* Resources */, 173 | ); 174 | buildRules = ( 175 | ); 176 | dependencies = ( 177 | AEE69D9C1CA39F170061467C /* PBXTargetDependency */, 178 | ); 179 | name = TitlebarAndToolbarUITests; 180 | productName = TitlebarAndToolbarUITests; 181 | productReference = AEE69D9A1CA39F170061467C /* TitlebarAndToolbarUITests.xctest */; 182 | productType = "com.apple.product-type.bundle.ui-testing"; 183 | }; 184 | /* End PBXNativeTarget section */ 185 | 186 | /* Begin PBXProject section */ 187 | AEE69D761CA39F170061467C /* Project object */ = { 188 | isa = PBXProject; 189 | attributes = { 190 | LastSwiftUpdateCheck = 0730; 191 | LastUpgradeCheck = 0900; 192 | ORGANIZATIONNAME = "Lu Yibin"; 193 | TargetAttributes = { 194 | AEE69D7D1CA39F170061467C = { 195 | CreatedOnToolsVersion = 7.3; 196 | LastSwiftMigration = 0900; 197 | }; 198 | AEE69D8E1CA39F170061467C = { 199 | CreatedOnToolsVersion = 7.3; 200 | LastSwiftMigration = 0900; 201 | TestTargetID = AEE69D7D1CA39F170061467C; 202 | }; 203 | AEE69D991CA39F170061467C = { 204 | CreatedOnToolsVersion = 7.3; 205 | LastSwiftMigration = 0900; 206 | TestTargetID = AEE69D7D1CA39F170061467C; 207 | }; 208 | }; 209 | }; 210 | buildConfigurationList = AEE69D791CA39F170061467C /* Build configuration list for PBXProject "TitlebarAndToolbar" */; 211 | compatibilityVersion = "Xcode 3.2"; 212 | developmentRegion = English; 213 | hasScannedForEncodings = 0; 214 | knownRegions = ( 215 | en, 216 | Base, 217 | ); 218 | mainGroup = AEE69D751CA39F170061467C; 219 | productRefGroup = AEE69D7F1CA39F170061467C /* Products */; 220 | projectDirPath = ""; 221 | projectRoot = ""; 222 | targets = ( 223 | AEE69D7D1CA39F170061467C /* TitlebarAndToolbar */, 224 | AEE69D8E1CA39F170061467C /* TitlebarAndToolbarTests */, 225 | AEE69D991CA39F170061467C /* TitlebarAndToolbarUITests */, 226 | ); 227 | }; 228 | /* End PBXProject section */ 229 | 230 | /* Begin PBXResourcesBuildPhase section */ 231 | AEE69D7C1CA39F170061467C /* Resources */ = { 232 | isa = PBXResourcesBuildPhase; 233 | buildActionMask = 2147483647; 234 | files = ( 235 | AEE69D861CA39F170061467C /* Assets.xcassets in Resources */, 236 | AEE69D891CA39F170061467C /* Main.storyboard in Resources */, 237 | ); 238 | runOnlyForDeploymentPostprocessing = 0; 239 | }; 240 | AEE69D8D1CA39F170061467C /* Resources */ = { 241 | isa = PBXResourcesBuildPhase; 242 | buildActionMask = 2147483647; 243 | files = ( 244 | ); 245 | runOnlyForDeploymentPostprocessing = 0; 246 | }; 247 | AEE69D981CA39F170061467C /* Resources */ = { 248 | isa = PBXResourcesBuildPhase; 249 | buildActionMask = 2147483647; 250 | files = ( 251 | ); 252 | runOnlyForDeploymentPostprocessing = 0; 253 | }; 254 | /* End PBXResourcesBuildPhase section */ 255 | 256 | /* Begin PBXSourcesBuildPhase section */ 257 | AEE69D7A1CA39F170061467C /* Sources */ = { 258 | isa = PBXSourcesBuildPhase; 259 | buildActionMask = 2147483647; 260 | files = ( 261 | AEE69D841CA39F170061467C /* ViewController.swift in Sources */, 262 | AEE69D821CA39F170061467C /* AppDelegate.swift in Sources */, 263 | AEA565561D18EF1900896DC2 /* SampleViewController.swift in Sources */, 264 | ); 265 | runOnlyForDeploymentPostprocessing = 0; 266 | }; 267 | AEE69D8B1CA39F170061467C /* Sources */ = { 268 | isa = PBXSourcesBuildPhase; 269 | buildActionMask = 2147483647; 270 | files = ( 271 | AEE69D941CA39F170061467C /* TitlebarAndToolbarTests.swift in Sources */, 272 | ); 273 | runOnlyForDeploymentPostprocessing = 0; 274 | }; 275 | AEE69D961CA39F170061467C /* Sources */ = { 276 | isa = PBXSourcesBuildPhase; 277 | buildActionMask = 2147483647; 278 | files = ( 279 | AEE69D9F1CA39F170061467C /* TitlebarAndToolbarUITests.swift in Sources */, 280 | ); 281 | runOnlyForDeploymentPostprocessing = 0; 282 | }; 283 | /* End PBXSourcesBuildPhase section */ 284 | 285 | /* Begin PBXTargetDependency section */ 286 | AEE69D911CA39F170061467C /* PBXTargetDependency */ = { 287 | isa = PBXTargetDependency; 288 | target = AEE69D7D1CA39F170061467C /* TitlebarAndToolbar */; 289 | targetProxy = AEE69D901CA39F170061467C /* PBXContainerItemProxy */; 290 | }; 291 | AEE69D9C1CA39F170061467C /* PBXTargetDependency */ = { 292 | isa = PBXTargetDependency; 293 | target = AEE69D7D1CA39F170061467C /* TitlebarAndToolbar */; 294 | targetProxy = AEE69D9B1CA39F170061467C /* PBXContainerItemProxy */; 295 | }; 296 | /* End PBXTargetDependency section */ 297 | 298 | /* Begin PBXVariantGroup section */ 299 | AEE69D871CA39F170061467C /* Main.storyboard */ = { 300 | isa = PBXVariantGroup; 301 | children = ( 302 | AEE69D881CA39F170061467C /* Base */, 303 | ); 304 | name = Main.storyboard; 305 | sourceTree = ""; 306 | }; 307 | /* End PBXVariantGroup section */ 308 | 309 | /* Begin XCBuildConfiguration section */ 310 | AEE69DA11CA39F170061467C /* Debug */ = { 311 | isa = XCBuildConfiguration; 312 | buildSettings = { 313 | ALWAYS_SEARCH_USER_PATHS = NO; 314 | CLANG_ANALYZER_NONNULL = YES; 315 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 316 | CLANG_CXX_LIBRARY = "libc++"; 317 | CLANG_ENABLE_MODULES = YES; 318 | CLANG_ENABLE_OBJC_ARC = YES; 319 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 320 | CLANG_WARN_BOOL_CONVERSION = YES; 321 | CLANG_WARN_COMMA = YES; 322 | CLANG_WARN_CONSTANT_CONVERSION = YES; 323 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 324 | CLANG_WARN_EMPTY_BODY = YES; 325 | CLANG_WARN_ENUM_CONVERSION = YES; 326 | CLANG_WARN_INFINITE_RECURSION = YES; 327 | CLANG_WARN_INT_CONVERSION = YES; 328 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 329 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 330 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 331 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 332 | CLANG_WARN_STRICT_PROTOTYPES = YES; 333 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 334 | CLANG_WARN_UNREACHABLE_CODE = YES; 335 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 336 | CODE_SIGN_IDENTITY = "-"; 337 | COPY_PHASE_STRIP = NO; 338 | DEBUG_INFORMATION_FORMAT = dwarf; 339 | ENABLE_STRICT_OBJC_MSGSEND = YES; 340 | ENABLE_TESTABILITY = YES; 341 | GCC_C_LANGUAGE_STANDARD = gnu99; 342 | GCC_DYNAMIC_NO_PIC = NO; 343 | GCC_NO_COMMON_BLOCKS = YES; 344 | GCC_OPTIMIZATION_LEVEL = 0; 345 | GCC_PREPROCESSOR_DEFINITIONS = ( 346 | "DEBUG=1", 347 | "$(inherited)", 348 | ); 349 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 350 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 351 | GCC_WARN_UNDECLARED_SELECTOR = YES; 352 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 353 | GCC_WARN_UNUSED_FUNCTION = YES; 354 | GCC_WARN_UNUSED_VARIABLE = YES; 355 | MACOSX_DEPLOYMENT_TARGET = 10.12; 356 | MTL_ENABLE_DEBUG_INFO = YES; 357 | ONLY_ACTIVE_ARCH = YES; 358 | SDKROOT = macosx; 359 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 360 | }; 361 | name = Debug; 362 | }; 363 | AEE69DA21CA39F170061467C /* Release */ = { 364 | isa = XCBuildConfiguration; 365 | buildSettings = { 366 | ALWAYS_SEARCH_USER_PATHS = NO; 367 | CLANG_ANALYZER_NONNULL = YES; 368 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 369 | CLANG_CXX_LIBRARY = "libc++"; 370 | CLANG_ENABLE_MODULES = YES; 371 | CLANG_ENABLE_OBJC_ARC = YES; 372 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 373 | CLANG_WARN_BOOL_CONVERSION = YES; 374 | CLANG_WARN_COMMA = YES; 375 | CLANG_WARN_CONSTANT_CONVERSION = YES; 376 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 377 | CLANG_WARN_EMPTY_BODY = YES; 378 | CLANG_WARN_ENUM_CONVERSION = YES; 379 | CLANG_WARN_INFINITE_RECURSION = YES; 380 | CLANG_WARN_INT_CONVERSION = YES; 381 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 382 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 383 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 384 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 385 | CLANG_WARN_STRICT_PROTOTYPES = YES; 386 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 387 | CLANG_WARN_UNREACHABLE_CODE = YES; 388 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 389 | CODE_SIGN_IDENTITY = "-"; 390 | COPY_PHASE_STRIP = NO; 391 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 392 | ENABLE_NS_ASSERTIONS = NO; 393 | ENABLE_STRICT_OBJC_MSGSEND = YES; 394 | GCC_C_LANGUAGE_STANDARD = gnu99; 395 | GCC_NO_COMMON_BLOCKS = YES; 396 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 397 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 398 | GCC_WARN_UNDECLARED_SELECTOR = YES; 399 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 400 | GCC_WARN_UNUSED_FUNCTION = YES; 401 | GCC_WARN_UNUSED_VARIABLE = YES; 402 | MACOSX_DEPLOYMENT_TARGET = 10.12; 403 | MTL_ENABLE_DEBUG_INFO = NO; 404 | SDKROOT = macosx; 405 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 406 | }; 407 | name = Release; 408 | }; 409 | AEE69DA41CA39F170061467C /* Debug */ = { 410 | isa = XCBuildConfiguration; 411 | buildSettings = { 412 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 413 | COMBINE_HIDPI_IMAGES = YES; 414 | INFOPLIST_FILE = TitlebarAndToolbar/Info.plist; 415 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; 416 | PRODUCT_BUNDLE_IDENTIFIER = com.robinlu.TitlebarAndToolbar; 417 | PRODUCT_NAME = "$(TARGET_NAME)"; 418 | SWIFT_SWIFT3_OBJC_INFERENCE = Default; 419 | SWIFT_VERSION = 4.0; 420 | }; 421 | name = Debug; 422 | }; 423 | AEE69DA51CA39F170061467C /* Release */ = { 424 | isa = XCBuildConfiguration; 425 | buildSettings = { 426 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 427 | COMBINE_HIDPI_IMAGES = YES; 428 | INFOPLIST_FILE = TitlebarAndToolbar/Info.plist; 429 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; 430 | PRODUCT_BUNDLE_IDENTIFIER = com.robinlu.TitlebarAndToolbar; 431 | PRODUCT_NAME = "$(TARGET_NAME)"; 432 | SWIFT_SWIFT3_OBJC_INFERENCE = Default; 433 | SWIFT_VERSION = 4.0; 434 | }; 435 | name = Release; 436 | }; 437 | AEE69DA71CA39F170061467C /* Debug */ = { 438 | isa = XCBuildConfiguration; 439 | buildSettings = { 440 | BUNDLE_LOADER = "$(TEST_HOST)"; 441 | COMBINE_HIDPI_IMAGES = YES; 442 | INFOPLIST_FILE = TitlebarAndToolbarTests/Info.plist; 443 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; 444 | PRODUCT_BUNDLE_IDENTIFIER = com.robinlu.TitlebarAndToolbarTests; 445 | PRODUCT_NAME = "$(TARGET_NAME)"; 446 | SWIFT_SWIFT3_OBJC_INFERENCE = Default; 447 | SWIFT_VERSION = 4.0; 448 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/TitlebarAndToolbar.app/Contents/MacOS/TitlebarAndToolbar"; 449 | }; 450 | name = Debug; 451 | }; 452 | AEE69DA81CA39F170061467C /* Release */ = { 453 | isa = XCBuildConfiguration; 454 | buildSettings = { 455 | BUNDLE_LOADER = "$(TEST_HOST)"; 456 | COMBINE_HIDPI_IMAGES = YES; 457 | INFOPLIST_FILE = TitlebarAndToolbarTests/Info.plist; 458 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; 459 | PRODUCT_BUNDLE_IDENTIFIER = com.robinlu.TitlebarAndToolbarTests; 460 | PRODUCT_NAME = "$(TARGET_NAME)"; 461 | SWIFT_SWIFT3_OBJC_INFERENCE = Default; 462 | SWIFT_VERSION = 4.0; 463 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/TitlebarAndToolbar.app/Contents/MacOS/TitlebarAndToolbar"; 464 | }; 465 | name = Release; 466 | }; 467 | AEE69DAA1CA39F170061467C /* Debug */ = { 468 | isa = XCBuildConfiguration; 469 | buildSettings = { 470 | COMBINE_HIDPI_IMAGES = YES; 471 | INFOPLIST_FILE = TitlebarAndToolbarUITests/Info.plist; 472 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; 473 | PRODUCT_BUNDLE_IDENTIFIER = com.robinlu.TitlebarAndToolbarUITests; 474 | PRODUCT_NAME = "$(TARGET_NAME)"; 475 | SWIFT_SWIFT3_OBJC_INFERENCE = Default; 476 | SWIFT_VERSION = 4.0; 477 | TEST_TARGET_NAME = TitlebarAndToolbar; 478 | }; 479 | name = Debug; 480 | }; 481 | AEE69DAB1CA39F170061467C /* Release */ = { 482 | isa = XCBuildConfiguration; 483 | buildSettings = { 484 | COMBINE_HIDPI_IMAGES = YES; 485 | INFOPLIST_FILE = TitlebarAndToolbarUITests/Info.plist; 486 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; 487 | PRODUCT_BUNDLE_IDENTIFIER = com.robinlu.TitlebarAndToolbarUITests; 488 | PRODUCT_NAME = "$(TARGET_NAME)"; 489 | SWIFT_SWIFT3_OBJC_INFERENCE = Default; 490 | SWIFT_VERSION = 4.0; 491 | TEST_TARGET_NAME = TitlebarAndToolbar; 492 | }; 493 | name = Release; 494 | }; 495 | /* End XCBuildConfiguration section */ 496 | 497 | /* Begin XCConfigurationList section */ 498 | AEE69D791CA39F170061467C /* Build configuration list for PBXProject "TitlebarAndToolbar" */ = { 499 | isa = XCConfigurationList; 500 | buildConfigurations = ( 501 | AEE69DA11CA39F170061467C /* Debug */, 502 | AEE69DA21CA39F170061467C /* Release */, 503 | ); 504 | defaultConfigurationIsVisible = 0; 505 | defaultConfigurationName = Release; 506 | }; 507 | AEE69DA31CA39F170061467C /* Build configuration list for PBXNativeTarget "TitlebarAndToolbar" */ = { 508 | isa = XCConfigurationList; 509 | buildConfigurations = ( 510 | AEE69DA41CA39F170061467C /* Debug */, 511 | AEE69DA51CA39F170061467C /* Release */, 512 | ); 513 | defaultConfigurationIsVisible = 0; 514 | defaultConfigurationName = Release; 515 | }; 516 | AEE69DA61CA39F170061467C /* Build configuration list for PBXNativeTarget "TitlebarAndToolbarTests" */ = { 517 | isa = XCConfigurationList; 518 | buildConfigurations = ( 519 | AEE69DA71CA39F170061467C /* Debug */, 520 | AEE69DA81CA39F170061467C /* Release */, 521 | ); 522 | defaultConfigurationIsVisible = 0; 523 | defaultConfigurationName = Release; 524 | }; 525 | AEE69DA91CA39F170061467C /* Build configuration list for PBXNativeTarget "TitlebarAndToolbarUITests" */ = { 526 | isa = XCConfigurationList; 527 | buildConfigurations = ( 528 | AEE69DAA1CA39F170061467C /* Debug */, 529 | AEE69DAB1CA39F170061467C /* Release */, 530 | ); 531 | defaultConfigurationIsVisible = 0; 532 | defaultConfigurationName = Release; 533 | }; 534 | /* End XCConfigurationList section */ 535 | }; 536 | rootObject = AEE69D761CA39F170061467C /* Project object */; 537 | } 538 | -------------------------------------------------------------------------------- /TitlebarAndToolbar/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 519 | 520 | 521 | 522 | 523 | 524 | 525 | 526 | 527 | 528 | 529 | 530 | 531 | 532 | 533 | 534 | 535 | 536 | 537 | 538 | 539 | 540 | 541 | 542 | 543 | 544 | 545 | 546 | 547 | 548 | 549 | 550 | 551 | 552 | 553 | 564 | 578 | 579 | 580 | 581 | 582 | 583 | 584 | 585 | 586 | 597 | 608 | 619 | 630 | 641 | 642 | 643 | 644 | 645 | 646 | 647 | 648 | 649 | 650 | 651 | 652 | 653 | 654 | 655 | 656 | 657 | 658 | 659 | 660 | 661 | 662 | 663 | 664 | 665 | 666 | 667 | 668 | 669 | 670 | 671 | 672 | 673 | 674 | 675 | 676 | 677 | 678 | 679 | 680 | 681 | 682 | 683 | 684 | 685 | 686 | 687 | 688 | 689 | 690 | 691 | 692 | 693 | 694 | 695 | 696 | 697 | 698 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 723 | 724 | 725 | 726 | 727 | 728 | 732 | 733 | 734 | 735 | 736 | 737 | 738 | 739 | 740 | 741 | 742 | 743 | 744 | 745 | 746 | 747 | 748 | 749 | 750 | 751 | 752 | 753 | 754 | 755 | 756 | 757 | 758 | 759 | 760 | 761 | 762 | 763 | 764 | 765 | 766 | 767 | 768 | 769 | 770 | 771 | 772 | 773 | 774 | 775 | 776 | 777 | 778 | 779 | 780 | 781 | 782 | 783 | 784 | 785 | 786 | 787 | 788 | 789 | 790 | 791 | 792 | 793 | 794 | 795 | 796 | 797 | 798 | 799 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 829 | 830 | 831 | 832 | 833 | 834 | 835 | 836 | 837 | 838 | 839 | 840 | 841 | 842 | 843 | 844 | 845 | 846 | 847 | 848 | 849 | 850 | 851 | 852 | 853 | 854 | 855 | 856 | 857 | 858 | 859 | 866 | 867 | 868 | 869 | 870 | 871 | 872 | 873 | 874 | 875 | 876 | 877 | 878 | 879 | 880 | 881 | 882 | 883 | 884 | --------------------------------------------------------------------------------