├── LICENSE ├── MenuBarPopover.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ │ └── IDEWorkspaceChecks.plist │ └── xcuserdata │ │ └── zafer.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── zafer.xcuserdatad │ └── xcschemes │ └── xcschememanagement.plist ├── MenuBarPopover ├── Assets.xcassets │ ├── AccentColor.colorset │ │ └── Contents.json │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── Contents.json ├── ContentView.swift ├── EmptyView.swift ├── Info.plist ├── MenuBarPopover.entitlements ├── MenuBarPopoverApp.swift └── Preview Content │ └── Preview Assets.xcassets │ └── Contents.json └── README.md /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Zafer ARICAN 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /MenuBarPopover.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1E85FE7C24B5D0F800B23E2E /* MenuBarPopoverApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E85FE7B24B5D0F800B23E2E /* MenuBarPopoverApp.swift */; }; 11 | 1E85FE7E24B5D0F800B23E2E /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E85FE7D24B5D0F800B23E2E /* ContentView.swift */; }; 12 | 1E85FE8024B5D0FE00B23E2E /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 1E85FE7F24B5D0FE00B23E2E /* Assets.xcassets */; }; 13 | 1E85FE8324B5D0FE00B23E2E /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 1E85FE8224B5D0FE00B23E2E /* Preview Assets.xcassets */; }; 14 | 1E85FE8C24B5E07700B23E2E /* EmptyView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E85FE8B24B5E07700B23E2E /* EmptyView.swift */; }; 15 | /* End PBXBuildFile section */ 16 | 17 | /* Begin PBXFileReference section */ 18 | 1E85FE7824B5D0F800B23E2E /* MenuBarPopover.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MenuBarPopover.app; sourceTree = BUILT_PRODUCTS_DIR; }; 19 | 1E85FE7B24B5D0F800B23E2E /* MenuBarPopoverApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MenuBarPopoverApp.swift; sourceTree = ""; }; 20 | 1E85FE7D24B5D0F800B23E2E /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; 21 | 1E85FE7F24B5D0FE00B23E2E /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 22 | 1E85FE8224B5D0FE00B23E2E /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; 23 | 1E85FE8424B5D0FE00B23E2E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 24 | 1E85FE8524B5D0FE00B23E2E /* MenuBarPopover.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = MenuBarPopover.entitlements; sourceTree = ""; }; 25 | 1E85FE8B24B5E07700B23E2E /* EmptyView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmptyView.swift; sourceTree = ""; }; 26 | /* End PBXFileReference section */ 27 | 28 | /* Begin PBXFrameworksBuildPhase section */ 29 | 1E85FE7524B5D0F800B23E2E /* Frameworks */ = { 30 | isa = PBXFrameworksBuildPhase; 31 | buildActionMask = 2147483647; 32 | files = ( 33 | ); 34 | runOnlyForDeploymentPostprocessing = 0; 35 | }; 36 | /* End PBXFrameworksBuildPhase section */ 37 | 38 | /* Begin PBXGroup section */ 39 | 1E85FE6F24B5D0F800B23E2E = { 40 | isa = PBXGroup; 41 | children = ( 42 | 1E85FE7A24B5D0F800B23E2E /* MenuBarPopover */, 43 | 1E85FE7924B5D0F800B23E2E /* Products */, 44 | ); 45 | sourceTree = ""; 46 | }; 47 | 1E85FE7924B5D0F800B23E2E /* Products */ = { 48 | isa = PBXGroup; 49 | children = ( 50 | 1E85FE7824B5D0F800B23E2E /* MenuBarPopover.app */, 51 | ); 52 | name = Products; 53 | sourceTree = ""; 54 | }; 55 | 1E85FE7A24B5D0F800B23E2E /* MenuBarPopover */ = { 56 | isa = PBXGroup; 57 | children = ( 58 | 1E85FE7B24B5D0F800B23E2E /* MenuBarPopoverApp.swift */, 59 | 1E85FE7D24B5D0F800B23E2E /* ContentView.swift */, 60 | 1E85FE8B24B5E07700B23E2E /* EmptyView.swift */, 61 | 1E85FE7F24B5D0FE00B23E2E /* Assets.xcassets */, 62 | 1E85FE8424B5D0FE00B23E2E /* Info.plist */, 63 | 1E85FE8524B5D0FE00B23E2E /* MenuBarPopover.entitlements */, 64 | 1E85FE8124B5D0FE00B23E2E /* Preview Content */, 65 | ); 66 | path = MenuBarPopover; 67 | sourceTree = ""; 68 | }; 69 | 1E85FE8124B5D0FE00B23E2E /* Preview Content */ = { 70 | isa = PBXGroup; 71 | children = ( 72 | 1E85FE8224B5D0FE00B23E2E /* Preview Assets.xcassets */, 73 | ); 74 | path = "Preview Content"; 75 | sourceTree = ""; 76 | }; 77 | /* End PBXGroup section */ 78 | 79 | /* Begin PBXNativeTarget section */ 80 | 1E85FE7724B5D0F800B23E2E /* MenuBarPopover */ = { 81 | isa = PBXNativeTarget; 82 | buildConfigurationList = 1E85FE8824B5D0FE00B23E2E /* Build configuration list for PBXNativeTarget "MenuBarPopover" */; 83 | buildPhases = ( 84 | 1E85FE7424B5D0F800B23E2E /* Sources */, 85 | 1E85FE7524B5D0F800B23E2E /* Frameworks */, 86 | 1E85FE7624B5D0F800B23E2E /* Resources */, 87 | ); 88 | buildRules = ( 89 | ); 90 | dependencies = ( 91 | ); 92 | name = MenuBarPopover; 93 | productName = MenuBarPopover; 94 | productReference = 1E85FE7824B5D0F800B23E2E /* MenuBarPopover.app */; 95 | productType = "com.apple.product-type.application"; 96 | }; 97 | /* End PBXNativeTarget section */ 98 | 99 | /* Begin PBXProject section */ 100 | 1E85FE7024B5D0F800B23E2E /* Project object */ = { 101 | isa = PBXProject; 102 | attributes = { 103 | LastSwiftUpdateCheck = 1200; 104 | LastUpgradeCheck = 1250; 105 | TargetAttributes = { 106 | 1E85FE7724B5D0F800B23E2E = { 107 | CreatedOnToolsVersion = 12.0; 108 | }; 109 | }; 110 | }; 111 | buildConfigurationList = 1E85FE7324B5D0F800B23E2E /* Build configuration list for PBXProject "MenuBarPopover" */; 112 | compatibilityVersion = "Xcode 9.3"; 113 | developmentRegion = en; 114 | hasScannedForEncodings = 0; 115 | knownRegions = ( 116 | en, 117 | Base, 118 | ); 119 | mainGroup = 1E85FE6F24B5D0F800B23E2E; 120 | productRefGroup = 1E85FE7924B5D0F800B23E2E /* Products */; 121 | projectDirPath = ""; 122 | projectRoot = ""; 123 | targets = ( 124 | 1E85FE7724B5D0F800B23E2E /* MenuBarPopover */, 125 | ); 126 | }; 127 | /* End PBXProject section */ 128 | 129 | /* Begin PBXResourcesBuildPhase section */ 130 | 1E85FE7624B5D0F800B23E2E /* Resources */ = { 131 | isa = PBXResourcesBuildPhase; 132 | buildActionMask = 2147483647; 133 | files = ( 134 | 1E85FE8324B5D0FE00B23E2E /* Preview Assets.xcassets in Resources */, 135 | 1E85FE8024B5D0FE00B23E2E /* Assets.xcassets in Resources */, 136 | ); 137 | runOnlyForDeploymentPostprocessing = 0; 138 | }; 139 | /* End PBXResourcesBuildPhase section */ 140 | 141 | /* Begin PBXSourcesBuildPhase section */ 142 | 1E85FE7424B5D0F800B23E2E /* Sources */ = { 143 | isa = PBXSourcesBuildPhase; 144 | buildActionMask = 2147483647; 145 | files = ( 146 | 1E85FE7E24B5D0F800B23E2E /* ContentView.swift in Sources */, 147 | 1E85FE8C24B5E07700B23E2E /* EmptyView.swift in Sources */, 148 | 1E85FE7C24B5D0F800B23E2E /* MenuBarPopoverApp.swift in Sources */, 149 | ); 150 | runOnlyForDeploymentPostprocessing = 0; 151 | }; 152 | /* End PBXSourcesBuildPhase section */ 153 | 154 | /* Begin XCBuildConfiguration section */ 155 | 1E85FE8624B5D0FE00B23E2E /* Debug */ = { 156 | isa = XCBuildConfiguration; 157 | buildSettings = { 158 | ALWAYS_SEARCH_USER_PATHS = NO; 159 | CLANG_ANALYZER_NONNULL = YES; 160 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 161 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 162 | CLANG_CXX_LIBRARY = "libc++"; 163 | CLANG_ENABLE_MODULES = YES; 164 | CLANG_ENABLE_OBJC_ARC = YES; 165 | CLANG_ENABLE_OBJC_WEAK = YES; 166 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 167 | CLANG_WARN_BOOL_CONVERSION = YES; 168 | CLANG_WARN_COMMA = YES; 169 | CLANG_WARN_CONSTANT_CONVERSION = YES; 170 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 171 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 172 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 173 | CLANG_WARN_EMPTY_BODY = YES; 174 | CLANG_WARN_ENUM_CONVERSION = YES; 175 | CLANG_WARN_INFINITE_RECURSION = YES; 176 | CLANG_WARN_INT_CONVERSION = YES; 177 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 178 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 179 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 180 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 181 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 182 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 183 | CLANG_WARN_STRICT_PROTOTYPES = YES; 184 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 185 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 186 | CLANG_WARN_UNREACHABLE_CODE = YES; 187 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 188 | COPY_PHASE_STRIP = NO; 189 | DEBUG_INFORMATION_FORMAT = dwarf; 190 | ENABLE_STRICT_OBJC_MSGSEND = YES; 191 | ENABLE_TESTABILITY = YES; 192 | GCC_C_LANGUAGE_STANDARD = gnu11; 193 | GCC_DYNAMIC_NO_PIC = NO; 194 | GCC_NO_COMMON_BLOCKS = YES; 195 | GCC_OPTIMIZATION_LEVEL = 0; 196 | GCC_PREPROCESSOR_DEFINITIONS = ( 197 | "DEBUG=1", 198 | "$(inherited)", 199 | ); 200 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 201 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 202 | GCC_WARN_UNDECLARED_SELECTOR = YES; 203 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 204 | GCC_WARN_UNUSED_FUNCTION = YES; 205 | GCC_WARN_UNUSED_VARIABLE = YES; 206 | MACOSX_DEPLOYMENT_TARGET = 10.15; 207 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 208 | MTL_FAST_MATH = YES; 209 | ONLY_ACTIVE_ARCH = YES; 210 | SDKROOT = macosx; 211 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 212 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 213 | }; 214 | name = Debug; 215 | }; 216 | 1E85FE8724B5D0FE00B23E2E /* Release */ = { 217 | isa = XCBuildConfiguration; 218 | buildSettings = { 219 | ALWAYS_SEARCH_USER_PATHS = NO; 220 | CLANG_ANALYZER_NONNULL = YES; 221 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 222 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 223 | CLANG_CXX_LIBRARY = "libc++"; 224 | CLANG_ENABLE_MODULES = YES; 225 | CLANG_ENABLE_OBJC_ARC = YES; 226 | CLANG_ENABLE_OBJC_WEAK = YES; 227 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 228 | CLANG_WARN_BOOL_CONVERSION = YES; 229 | CLANG_WARN_COMMA = YES; 230 | CLANG_WARN_CONSTANT_CONVERSION = YES; 231 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 232 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 233 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 234 | CLANG_WARN_EMPTY_BODY = YES; 235 | CLANG_WARN_ENUM_CONVERSION = YES; 236 | CLANG_WARN_INFINITE_RECURSION = YES; 237 | CLANG_WARN_INT_CONVERSION = YES; 238 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 239 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 240 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 241 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 242 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 243 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 244 | CLANG_WARN_STRICT_PROTOTYPES = YES; 245 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 246 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 247 | CLANG_WARN_UNREACHABLE_CODE = YES; 248 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 249 | COPY_PHASE_STRIP = NO; 250 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 251 | ENABLE_NS_ASSERTIONS = NO; 252 | ENABLE_STRICT_OBJC_MSGSEND = YES; 253 | GCC_C_LANGUAGE_STANDARD = gnu11; 254 | GCC_NO_COMMON_BLOCKS = YES; 255 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 256 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 257 | GCC_WARN_UNDECLARED_SELECTOR = YES; 258 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 259 | GCC_WARN_UNUSED_FUNCTION = YES; 260 | GCC_WARN_UNUSED_VARIABLE = YES; 261 | MACOSX_DEPLOYMENT_TARGET = 10.15; 262 | MTL_ENABLE_DEBUG_INFO = NO; 263 | MTL_FAST_MATH = YES; 264 | SDKROOT = macosx; 265 | SWIFT_COMPILATION_MODE = wholemodule; 266 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 267 | }; 268 | name = Release; 269 | }; 270 | 1E85FE8924B5D0FE00B23E2E /* Debug */ = { 271 | isa = XCBuildConfiguration; 272 | buildSettings = { 273 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 274 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 275 | CODE_SIGN_ENTITLEMENTS = MenuBarPopover/MenuBarPopover.entitlements; 276 | CODE_SIGN_IDENTITY = "-"; 277 | CODE_SIGN_STYLE = Automatic; 278 | COMBINE_HIDPI_IMAGES = YES; 279 | CURRENT_PROJECT_VERSION = 2; 280 | DEVELOPMENT_ASSET_PATHS = "\"MenuBarPopover/Preview Content\""; 281 | DEVELOPMENT_TEAM = ""; 282 | ENABLE_HARDENED_RUNTIME = YES; 283 | ENABLE_PREVIEWS = YES; 284 | INFOPLIST_FILE = MenuBarPopover/Info.plist; 285 | LD_RUNPATH_SEARCH_PATHS = ( 286 | "$(inherited)", 287 | "@executable_path/../Frameworks", 288 | ); 289 | MACOSX_DEPLOYMENT_TARGET = 11.0; 290 | PRODUCT_BUNDLE_IDENTIFIER = com.zaferarican.MenuBarPopover; 291 | PRODUCT_NAME = "$(TARGET_NAME)"; 292 | SWIFT_VERSION = 5.0; 293 | }; 294 | name = Debug; 295 | }; 296 | 1E85FE8A24B5D0FE00B23E2E /* Release */ = { 297 | isa = XCBuildConfiguration; 298 | buildSettings = { 299 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 300 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 301 | CODE_SIGN_ENTITLEMENTS = MenuBarPopover/MenuBarPopover.entitlements; 302 | CODE_SIGN_IDENTITY = "-"; 303 | CODE_SIGN_STYLE = Automatic; 304 | COMBINE_HIDPI_IMAGES = YES; 305 | CURRENT_PROJECT_VERSION = 2; 306 | DEVELOPMENT_ASSET_PATHS = "\"MenuBarPopover/Preview Content\""; 307 | DEVELOPMENT_TEAM = ""; 308 | ENABLE_HARDENED_RUNTIME = YES; 309 | ENABLE_PREVIEWS = YES; 310 | INFOPLIST_FILE = MenuBarPopover/Info.plist; 311 | LD_RUNPATH_SEARCH_PATHS = ( 312 | "$(inherited)", 313 | "@executable_path/../Frameworks", 314 | ); 315 | MACOSX_DEPLOYMENT_TARGET = 11.0; 316 | PRODUCT_BUNDLE_IDENTIFIER = com.zaferarican.MenuBarPopover; 317 | PRODUCT_NAME = "$(TARGET_NAME)"; 318 | SWIFT_VERSION = 5.0; 319 | }; 320 | name = Release; 321 | }; 322 | /* End XCBuildConfiguration section */ 323 | 324 | /* Begin XCConfigurationList section */ 325 | 1E85FE7324B5D0F800B23E2E /* Build configuration list for PBXProject "MenuBarPopover" */ = { 326 | isa = XCConfigurationList; 327 | buildConfigurations = ( 328 | 1E85FE8624B5D0FE00B23E2E /* Debug */, 329 | 1E85FE8724B5D0FE00B23E2E /* Release */, 330 | ); 331 | defaultConfigurationIsVisible = 0; 332 | defaultConfigurationName = Release; 333 | }; 334 | 1E85FE8824B5D0FE00B23E2E /* Build configuration list for PBXNativeTarget "MenuBarPopover" */ = { 335 | isa = XCConfigurationList; 336 | buildConfigurations = ( 337 | 1E85FE8924B5D0FE00B23E2E /* Debug */, 338 | 1E85FE8A24B5D0FE00B23E2E /* Release */, 339 | ); 340 | defaultConfigurationIsVisible = 0; 341 | defaultConfigurationName = Release; 342 | }; 343 | /* End XCConfigurationList section */ 344 | }; 345 | rootObject = 1E85FE7024B5D0F800B23E2E /* Project object */; 346 | } 347 | -------------------------------------------------------------------------------- /MenuBarPopover.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /MenuBarPopover.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /MenuBarPopover.xcodeproj/project.xcworkspace/xcuserdata/zafer.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zaferarican/menubarpopoverswiftui2/1d972f051ce5a76959517600defb7587cc188093/MenuBarPopover.xcodeproj/project.xcworkspace/xcuserdata/zafer.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /MenuBarPopover.xcodeproj/xcuserdata/zafer.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | MenuBarPopover.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /MenuBarPopover/Assets.xcassets/AccentColor.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "colors" : [ 3 | { 4 | "idiom" : "universal" 5 | } 6 | ], 7 | "info" : { 8 | "author" : "xcode", 9 | "version" : 1 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /MenuBarPopover/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "mac", 5 | "scale" : "1x", 6 | "size" : "16x16" 7 | }, 8 | { 9 | "idiom" : "mac", 10 | "scale" : "2x", 11 | "size" : "16x16" 12 | }, 13 | { 14 | "idiom" : "mac", 15 | "scale" : "1x", 16 | "size" : "32x32" 17 | }, 18 | { 19 | "idiom" : "mac", 20 | "scale" : "2x", 21 | "size" : "32x32" 22 | }, 23 | { 24 | "idiom" : "mac", 25 | "scale" : "1x", 26 | "size" : "128x128" 27 | }, 28 | { 29 | "idiom" : "mac", 30 | "scale" : "2x", 31 | "size" : "128x128" 32 | }, 33 | { 34 | "idiom" : "mac", 35 | "scale" : "1x", 36 | "size" : "256x256" 37 | }, 38 | { 39 | "idiom" : "mac", 40 | "scale" : "2x", 41 | "size" : "256x256" 42 | }, 43 | { 44 | "idiom" : "mac", 45 | "scale" : "1x", 46 | "size" : "512x512" 47 | }, 48 | { 49 | "idiom" : "mac", 50 | "scale" : "2x", 51 | "size" : "512x512" 52 | } 53 | ], 54 | "info" : { 55 | "author" : "xcode", 56 | "version" : 1 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /MenuBarPopover/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /MenuBarPopover/ContentView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ContentView.swift 3 | // MenuBarPopover 4 | // 5 | // Created by Zafer Arıcan on 8.07.2020. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct ContentView: View { 11 | @State var isUpdated : Bool = false 12 | var body: some View { 13 | VStack{ 14 | Text("Hello, world!").padding() 15 | Button("Ok", action: { 16 | updateStatusBarTitle(title: isUpdated ? "Test" : "TestIt") 17 | isUpdated.toggle() 18 | }).padding() 19 | }.frame(maxWidth: .infinity, maxHeight: .infinity) //https://www.reddit.com/r/SwiftUI/comments/hnfwuh/a_menubar_example_with_popover_window_using/fygojkd?utm_source=share&utm_medium=web2x for fix. 20 | } 21 | func updateStatusBarTitle(title: String){ 22 | AppDelegate.shared.statusBarItem?.button?.title = title 23 | } 24 | } 25 | struct ContentView_Previews: PreviewProvider { 26 | static var previews: some View { 27 | ContentView() 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /MenuBarPopover/EmptyView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // EmptyView.swift 3 | // MenuBarPopover 4 | // 5 | // Created by Zafer Arıcan on 8.07.2020. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct EmptyView: View { 11 | var body: some View { 12 | Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/) 13 | } 14 | } 15 | 16 | struct EmptyView_Previews: PreviewProvider { 17 | static var previews: some View { 18 | EmptyView() 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /MenuBarPopover/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | LSMinimumSystemVersion 22 | $(MACOSX_DEPLOYMENT_TARGET) 23 | LSUIElement 24 | 25 | NSSupportsAutomaticTermination 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /MenuBarPopover/MenuBarPopover.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.files.user-selected.read-only 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /MenuBarPopover/MenuBarPopoverApp.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MenuBarPopoverApp.swift 3 | // MenuBarPopover 4 | // 5 | // Created by Zafer Arıcan on 8.07.2020. 6 | // 7 | 8 | import SwiftUI 9 | 10 | @main 11 | struct MenuBarPopoverApp: App { 12 | @NSApplicationDelegateAdaptor(AppDelegate.self) var appDelegate 13 | init() { 14 | AppDelegate.shared = self.appDelegate 15 | } 16 | /* For #2 I followed the solution in https://stackoverflow.com/a/65789202/827681 */ 17 | var body: some Scene { 18 | Settings{ 19 | EmptyView() 20 | } 21 | } 22 | } 23 | class AppDelegate: NSObject, NSApplicationDelegate { 24 | var popover = NSPopover.init() 25 | var statusBarItem: NSStatusItem? 26 | static var shared : AppDelegate! 27 | func applicationDidFinishLaunching(_ notification: Notification) { 28 | 29 | let contentView = ContentView() 30 | 31 | // Set the SwiftUI's ContentView to the Popover's ContentViewController 32 | popover.behavior = .transient 33 | popover.animates = false 34 | popover.contentViewController = NSViewController() 35 | popover.contentViewController?.view = NSHostingView(rootView: contentView) 36 | popover.contentViewController?.view.window?.makeKey() 37 | statusBarItem = NSStatusBar.system.statusItem(withLength: NSStatusItem.variableLength) 38 | statusBarItem?.button?.title = "Test" 39 | statusBarItem?.button?.action = #selector(AppDelegate.togglePopover(_:)) 40 | } 41 | @objc func showPopover(_ sender: AnyObject?) { 42 | if let button = statusBarItem?.button { 43 | popover.show(relativeTo: button.bounds, of: button, preferredEdge: NSRectEdge.minY) 44 | // !!! - displays the popover window with an offset in x in macOS BigSur. 45 | } 46 | } 47 | @objc func closePopover(_ sender: AnyObject?) { 48 | popover.performClose(sender) 49 | } 50 | @objc func togglePopover(_ sender: AnyObject?) { 51 | if popover.isShown { 52 | closePopover(sender) 53 | } else { 54 | showPopover(sender) 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /MenuBarPopover/Preview Content/Preview Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # menubarpopoverswiftui2 2 | An example of a menu bar app with popover window using SwiftUI 2.0 3 | 4 | I created this example based on the discussions: 5 | 6 | * https://www.reddit.com/r/SwiftUI/comments/hltt9a/is_it_possible_to_create_a_menubar_app_with/?utm_source=share&utm_medium=web2x 7 | 8 | * https://www.reddit.com/r/SwiftUI/comments/e21m7q/a_macos_menu_bar_app_built_with_swiftui/?utm_source=share&utm_medium=web2x 9 | 10 | This example works on the newly introduced "app" struct in SwiftUI 2.0 and it is the first attempt to implement a popover window based menu bar app for this struct. 11 | 12 | Known issues: 13 | * Not any so far 14 | 15 | --------------------------------------------------------------------------------