├── .DS_Store ├── .gitignore ├── ObjC ├── .DS_Store ├── Base.lproj │ ├── .DS_Store │ └── MainMenu.nib │ │ ├── designable.nib │ │ └── keyedobjects.nib ├── DockTile.ObjC-Info.plist ├── DockTile.ObjC.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist ├── DockTileAppDelegate.h ├── DockTileAppDelegate.m ├── DockTilePlugIn │ ├── DockTile.ObjC.PlugIn-Info.plist │ ├── DockTilePlugIn.h │ └── DockTilePlugIn.m ├── Prefix.pch ├── README.rtf ├── en.lproj │ ├── Credits.rtf │ └── InfoPlist.strings ├── icon.icns └── main.m └── README.md /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CartBlanche/MacDockTileSample/764a5dcadf885bddb7999c75d44a3b0f10a52322/.DS_Store -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## User settings 6 | xcuserdata/ 7 | 8 | ## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) 9 | *.xcscmblueprint 10 | *.xccheckout 11 | 12 | ## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) 13 | build/ 14 | DerivedData/ 15 | *.moved-aside 16 | *.pbxuser 17 | !default.pbxuser 18 | *.mode1v3 19 | !default.mode1v3 20 | *.mode2v3 21 | !default.mode2v3 22 | *.perspectivev3 23 | !default.perspectivev3 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | 28 | ## App packaging 29 | *.ipa 30 | *.dSYM.zip 31 | *.dSYM 32 | 33 | # CocoaPods 34 | # 35 | # We recommend against adding the Pods directory to your .gitignore. However 36 | # you should judge for yourself, the pros and cons are mentioned at: 37 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 38 | # 39 | # Pods/ 40 | # 41 | # Add this line if you want to avoid checking in source code from the Xcode workspace 42 | # *.xcworkspace 43 | 44 | # Carthage 45 | # 46 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 47 | # Carthage/Checkouts 48 | 49 | Carthage/Build/ 50 | 51 | # fastlane 52 | # 53 | # It is recommended to not store the screenshots in the git repo. 54 | # Instead, use fastlane to re-generate the screenshots whenever they are needed. 55 | # For more information about the recommended setup visit: 56 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 57 | 58 | fastlane/report.xml 59 | fastlane/Preview.html 60 | fastlane/screenshots/**/*.png 61 | fastlane/test_output 62 | 63 | # Code Injection 64 | # 65 | # After new code Injection tools there's a generated folder /iOSInjectionProject 66 | # https://github.com/johnno1962/injectionforxcode 67 | 68 | iOSInjectionProject/ -------------------------------------------------------------------------------- /ObjC/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CartBlanche/MacDockTileSample/764a5dcadf885bddb7999c75d44a3b0f10a52322/ObjC/.DS_Store -------------------------------------------------------------------------------- /ObjC/Base.lproj/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CartBlanche/MacDockTileSample/764a5dcadf885bddb7999c75d44a3b0f10a52322/ObjC/Base.lproj/.DS_Store -------------------------------------------------------------------------------- /ObjC/Base.lproj/MainMenu.nib/designable.nib: -------------------------------------------------------------------------------- 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 | 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 | -------------------------------------------------------------------------------- /ObjC/Base.lproj/MainMenu.nib/keyedobjects.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CartBlanche/MacDockTileSample/764a5dcadf885bddb7999c75d44a3b0f10a52322/ObjC/Base.lproj/MainMenu.nib/keyedobjects.nib -------------------------------------------------------------------------------- /ObjC/DockTile.ObjC-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | icon.icns 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | LSMinimumSystemVersion 24 | 10.6 25 | NSDockTilePlugIn 26 | DockTile.ObjC.docktileplugin 27 | NSMainNibFile 28 | MainMenu 29 | NSPrincipalClass 30 | NSApplication 31 | 32 | 33 | -------------------------------------------------------------------------------- /ObjC/DockTile.ObjC.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 536F14130D33E1A200B2806D /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = 536F14110D33E1A200B2806D /* Credits.rtf */; }; 11 | 53CC47720ABB251700F70973 /* DockTileAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 53CC47700ABB251700F70973 /* DockTileAppDelegate.m */; }; 12 | 53D67A260FD6F3DD001688B3 /* DockTile.ObjC.docktileplugin in CopyFiles */ = {isa = PBXBuildFile; fileRef = 53D679D50FD6F0DB001688B3 /* DockTile.ObjC.docktileplugin */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; 13 | 53D67A8F0FD6F773001688B3 /* DockTilePlugIn.m in Sources */ = {isa = PBXBuildFile; fileRef = 53D67A650FD6F5B5001688B3 /* DockTilePlugIn.m */; }; 14 | 53FE44190FD71991007FBB65 /* icon.icns in Resources */ = {isa = PBXBuildFile; fileRef = 53FE44180FD71991007FBB65 /* icon.icns */; }; 15 | 8D11072A0486CEB800E47090 /* MainMenu.nib in Resources */ = {isa = PBXBuildFile; fileRef = 29B97318FDCFA39411CA2CEA /* MainMenu.nib */; }; 16 | 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; }; 17 | 8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; }; 18 | 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; 19 | /* End PBXBuildFile section */ 20 | 21 | /* Begin PBXContainerItemProxy section */ 22 | 53D67A2D0FD6F3FE001688B3 /* PBXContainerItemProxy */ = { 23 | isa = PBXContainerItemProxy; 24 | containerPortal = 29B97313FDCFA39411CA2CEA /* Project object */; 25 | proxyType = 1; 26 | remoteGlobalIDString = 53D679D40FD6F0DB001688B3; 27 | remoteInfo = DockTile; 28 | }; 29 | /* End PBXContainerItemProxy section */ 30 | 31 | /* Begin PBXCopyFilesBuildPhase section */ 32 | 53D67A370FD6F42F001688B3 /* CopyFiles */ = { 33 | isa = PBXCopyFilesBuildPhase; 34 | buildActionMask = 2147483647; 35 | dstPath = ""; 36 | dstSubfolderSpec = 13; 37 | files = ( 38 | 53D67A260FD6F3DD001688B3 /* DockTile.ObjC.docktileplugin in CopyFiles */, 39 | ); 40 | runOnlyForDeploymentPostprocessing = 0; 41 | }; 42 | /* End PBXCopyFilesBuildPhase section */ 43 | 44 | /* Begin PBXFileReference section */ 45 | 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; 46 | 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 47 | 29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; 48 | 29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; 49 | 41D5F1550FEE95CE004546AB /* README.rtf */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; path = README.rtf; sourceTree = ""; }; 50 | 53CC47700ABB251700F70973 /* DockTileAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = DockTileAppDelegate.m; sourceTree = ""; }; 51 | 53CC47710ABB251700F70973 /* DockTileAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DockTileAppDelegate.h; sourceTree = ""; }; 52 | 53D679D50FD6F0DB001688B3 /* DockTile.ObjC.docktileplugin */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DockTile.ObjC.docktileplugin; sourceTree = BUILT_PRODUCTS_DIR; }; 53 | 53D67A640FD6F5B5001688B3 /* DockTilePlugIn.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DockTilePlugIn.h; path = DockTilePlugIn/DockTilePlugIn.h; sourceTree = ""; }; 54 | 53D67A650FD6F5B5001688B3 /* DockTilePlugIn.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = DockTilePlugIn.m; path = DockTilePlugIn/DockTilePlugIn.m; sourceTree = ""; }; 55 | 53D67A890FD6F722001688B3 /* DockTile.ObjC.PlugIn-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "DockTile.ObjC.PlugIn-Info.plist"; path = "DockTilePlugIn/DockTile.ObjC.PlugIn-Info.plist"; sourceTree = ""; }; 56 | 53E5B1B10B6021EF0087DD13 /* Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Prefix.pch; sourceTree = ""; }; 57 | 53FE44180FD71991007FBB65 /* icon.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = icon.icns; sourceTree = ""; }; 58 | 8D1107310486CEB800E47090 /* DockTile.ObjC-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "DockTile.ObjC-Info.plist"; sourceTree = ""; }; 59 | 8D1107320486CEB800E47090 /* DockTile.ObjC.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DockTile.ObjC.app; sourceTree = BUILT_PRODUCTS_DIR; }; 60 | 9673543E23A9035700FD6C03 /* Base */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = Base; path = Base.lproj/MainMenu.nib; sourceTree = ""; }; 61 | 9673543F23A9035D00FD6C03 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = en; path = en.lproj/Credits.rtf; sourceTree = ""; }; 62 | 9673544023A9035D00FD6C03 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 63 | /* End PBXFileReference section */ 64 | 65 | /* Begin PBXFrameworksBuildPhase section */ 66 | 53D679D30FD6F0DB001688B3 /* Frameworks */ = { 67 | isa = PBXFrameworksBuildPhase; 68 | buildActionMask = 2147483647; 69 | files = ( 70 | ); 71 | runOnlyForDeploymentPostprocessing = 0; 72 | }; 73 | 8D11072E0486CEB800E47090 /* Frameworks */ = { 74 | isa = PBXFrameworksBuildPhase; 75 | buildActionMask = 2147483647; 76 | files = ( 77 | 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */, 78 | ); 79 | runOnlyForDeploymentPostprocessing = 0; 80 | }; 81 | /* End PBXFrameworksBuildPhase section */ 82 | 83 | /* Begin PBXGroup section */ 84 | 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = { 85 | isa = PBXGroup; 86 | children = ( 87 | 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */, 88 | ); 89 | name = "Linked Frameworks"; 90 | sourceTree = ""; 91 | }; 92 | 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */ = { 93 | isa = PBXGroup; 94 | children = ( 95 | 29B97324FDCFA39411CA2CEA /* AppKit.framework */, 96 | 29B97325FDCFA39411CA2CEA /* Foundation.framework */, 97 | ); 98 | name = "Other Frameworks"; 99 | sourceTree = ""; 100 | }; 101 | 19C28FACFE9D520D11CA2CBB /* Products */ = { 102 | isa = PBXGroup; 103 | children = ( 104 | 8D1107320486CEB800E47090 /* DockTile.ObjC.app */, 105 | 53D679D50FD6F0DB001688B3 /* DockTile.ObjC.docktileplugin */, 106 | ); 107 | name = Products; 108 | sourceTree = ""; 109 | }; 110 | 29B97314FDCFA39411CA2CEA /* TrackIt */ = { 111 | isa = PBXGroup; 112 | children = ( 113 | 41D5F1550FEE95CE004546AB /* README.rtf */, 114 | 29B97315FDCFA39411CA2CEA /* Sources */, 115 | 29B97317FDCFA39411CA2CEA /* Resources */, 116 | 29B97323FDCFA39411CA2CEA /* Frameworks */, 117 | 19C28FACFE9D520D11CA2CBB /* Products */, 118 | 53D6795A0FD6EF91001688B3 /* DockTilePlugin */, 119 | ); 120 | name = TrackIt; 121 | sourceTree = ""; 122 | }; 123 | 29B97315FDCFA39411CA2CEA /* Sources */ = { 124 | isa = PBXGroup; 125 | children = ( 126 | 29B97316FDCFA39411CA2CEA /* main.m */, 127 | 53E5B1B10B6021EF0087DD13 /* Prefix.pch */, 128 | 53CC47710ABB251700F70973 /* DockTileAppDelegate.h */, 129 | 53CC47700ABB251700F70973 /* DockTileAppDelegate.m */, 130 | ); 131 | name = Sources; 132 | sourceTree = ""; 133 | }; 134 | 29B97317FDCFA39411CA2CEA /* Resources */ = { 135 | isa = PBXGroup; 136 | children = ( 137 | 53FE44180FD71991007FBB65 /* icon.icns */, 138 | 536F14110D33E1A200B2806D /* Credits.rtf */, 139 | 8D1107310486CEB800E47090 /* DockTile.ObjC-Info.plist */, 140 | 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */, 141 | 29B97318FDCFA39411CA2CEA /* MainMenu.nib */, 142 | ); 143 | name = Resources; 144 | sourceTree = ""; 145 | }; 146 | 29B97323FDCFA39411CA2CEA /* Frameworks */ = { 147 | isa = PBXGroup; 148 | children = ( 149 | 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */, 150 | 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */, 151 | ); 152 | name = Frameworks; 153 | sourceTree = ""; 154 | }; 155 | 53D6795A0FD6EF91001688B3 /* DockTilePlugin */ = { 156 | isa = PBXGroup; 157 | children = ( 158 | 53D67A890FD6F722001688B3 /* DockTile.ObjC.PlugIn-Info.plist */, 159 | 53D67A640FD6F5B5001688B3 /* DockTilePlugIn.h */, 160 | 53D67A650FD6F5B5001688B3 /* DockTilePlugIn.m */, 161 | ); 162 | name = DockTilePlugin; 163 | sourceTree = ""; 164 | }; 165 | /* End PBXGroup section */ 166 | 167 | /* Begin PBXNativeTarget section */ 168 | 53D679D40FD6F0DB001688B3 /* DockTile.ObjCPlugIn */ = { 169 | isa = PBXNativeTarget; 170 | buildConfigurationList = 53D679D90FD6F0DC001688B3 /* Build configuration list for PBXNativeTarget "DockTile.ObjCPlugIn" */; 171 | buildPhases = ( 172 | 53D679D10FD6F0DB001688B3 /* Resources */, 173 | 53D679D20FD6F0DB001688B3 /* Sources */, 174 | 53D679D30FD6F0DB001688B3 /* Frameworks */, 175 | ); 176 | buildRules = ( 177 | ); 178 | dependencies = ( 179 | ); 180 | name = DockTile.ObjCPlugIn; 181 | productName = DockTile.docktileplugin; 182 | productReference = 53D679D50FD6F0DB001688B3 /* DockTile.ObjC.docktileplugin */; 183 | productType = "com.apple.product-type.bundle"; 184 | }; 185 | 8D1107260486CEB800E47090 /* DockTile.ObjCApp */ = { 186 | isa = PBXNativeTarget; 187 | buildConfigurationList = C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "DockTile.ObjCApp" */; 188 | buildPhases = ( 189 | 8D1107290486CEB800E47090 /* Resources */, 190 | 8D11072C0486CEB800E47090 /* Sources */, 191 | 8D11072E0486CEB800E47090 /* Frameworks */, 192 | 53D67A370FD6F42F001688B3 /* CopyFiles */, 193 | ); 194 | buildRules = ( 195 | ); 196 | dependencies = ( 197 | 53D67A2E0FD6F3FE001688B3 /* PBXTargetDependency */, 198 | ); 199 | name = DockTile.ObjCApp; 200 | productInstallPath = "$(HOME)/Applications"; 201 | productName = TrackIt; 202 | productReference = 8D1107320486CEB800E47090 /* DockTile.ObjC.app */; 203 | productType = "com.apple.product-type.application"; 204 | }; 205 | /* End PBXNativeTarget section */ 206 | 207 | /* Begin PBXProject section */ 208 | 29B97313FDCFA39411CA2CEA /* Project object */ = { 209 | isa = PBXProject; 210 | attributes = { 211 | LastUpgradeCheck = 1130; 212 | }; 213 | buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "DockTile.ObjC" */; 214 | compatibilityVersion = "Xcode 3.2"; 215 | developmentRegion = en; 216 | hasScannedForEncodings = 1; 217 | knownRegions = ( 218 | en, 219 | Base, 220 | ); 221 | mainGroup = 29B97314FDCFA39411CA2CEA /* TrackIt */; 222 | projectDirPath = ""; 223 | projectRoot = ""; 224 | targets = ( 225 | 8D1107260486CEB800E47090 /* DockTile.ObjCApp */, 226 | 53D679D40FD6F0DB001688B3 /* DockTile.ObjCPlugIn */, 227 | ); 228 | }; 229 | /* End PBXProject section */ 230 | 231 | /* Begin PBXResourcesBuildPhase section */ 232 | 53D679D10FD6F0DB001688B3 /* Resources */ = { 233 | isa = PBXResourcesBuildPhase; 234 | buildActionMask = 2147483647; 235 | files = ( 236 | ); 237 | runOnlyForDeploymentPostprocessing = 0; 238 | }; 239 | 8D1107290486CEB800E47090 /* Resources */ = { 240 | isa = PBXResourcesBuildPhase; 241 | buildActionMask = 2147483647; 242 | files = ( 243 | 8D11072A0486CEB800E47090 /* MainMenu.nib in Resources */, 244 | 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */, 245 | 536F14130D33E1A200B2806D /* Credits.rtf in Resources */, 246 | 53FE44190FD71991007FBB65 /* icon.icns in Resources */, 247 | ); 248 | runOnlyForDeploymentPostprocessing = 0; 249 | }; 250 | /* End PBXResourcesBuildPhase section */ 251 | 252 | /* Begin PBXSourcesBuildPhase section */ 253 | 53D679D20FD6F0DB001688B3 /* Sources */ = { 254 | isa = PBXSourcesBuildPhase; 255 | buildActionMask = 2147483647; 256 | files = ( 257 | 53D67A8F0FD6F773001688B3 /* DockTilePlugIn.m in Sources */, 258 | ); 259 | runOnlyForDeploymentPostprocessing = 0; 260 | }; 261 | 8D11072C0486CEB800E47090 /* Sources */ = { 262 | isa = PBXSourcesBuildPhase; 263 | buildActionMask = 2147483647; 264 | files = ( 265 | 8D11072D0486CEB800E47090 /* main.m in Sources */, 266 | 53CC47720ABB251700F70973 /* DockTileAppDelegate.m in Sources */, 267 | ); 268 | runOnlyForDeploymentPostprocessing = 0; 269 | }; 270 | /* End PBXSourcesBuildPhase section */ 271 | 272 | /* Begin PBXTargetDependency section */ 273 | 53D67A2E0FD6F3FE001688B3 /* PBXTargetDependency */ = { 274 | isa = PBXTargetDependency; 275 | target = 53D679D40FD6F0DB001688B3 /* DockTile.ObjCPlugIn */; 276 | targetProxy = 53D67A2D0FD6F3FE001688B3 /* PBXContainerItemProxy */; 277 | }; 278 | /* End PBXTargetDependency section */ 279 | 280 | /* Begin PBXVariantGroup section */ 281 | 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */ = { 282 | isa = PBXVariantGroup; 283 | children = ( 284 | 9673544023A9035D00FD6C03 /* en */, 285 | ); 286 | name = InfoPlist.strings; 287 | sourceTree = ""; 288 | }; 289 | 29B97318FDCFA39411CA2CEA /* MainMenu.nib */ = { 290 | isa = PBXVariantGroup; 291 | children = ( 292 | 9673543E23A9035700FD6C03 /* Base */, 293 | ); 294 | name = MainMenu.nib; 295 | sourceTree = ""; 296 | }; 297 | 536F14110D33E1A200B2806D /* Credits.rtf */ = { 298 | isa = PBXVariantGroup; 299 | children = ( 300 | 9673543F23A9035D00FD6C03 /* en */, 301 | ); 302 | name = Credits.rtf; 303 | sourceTree = ""; 304 | }; 305 | /* End PBXVariantGroup section */ 306 | 307 | /* Begin XCBuildConfiguration section */ 308 | 53D679D70FD6F0DC001688B3 /* Debug */ = { 309 | isa = XCBuildConfiguration; 310 | buildSettings = { 311 | ALWAYS_SEARCH_USER_PATHS = NO; 312 | CLANG_ENABLE_OBJC_WEAK = YES; 313 | COPY_PHASE_STRIP = NO; 314 | DEBUG_INFORMATION_FORMAT = dwarf; 315 | GCC_DYNAMIC_NO_PIC = NO; 316 | GCC_MODEL_TUNING = G5; 317 | GCC_OPTIMIZATION_LEVEL = 0; 318 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 319 | GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h"; 320 | INFOPLIST_FILE = "DockTilePlugIn/DockTile.ObjC.PlugIn-Info.plist"; 321 | INSTALL_PATH = "$(LOCAL_DEVELOPER_DIR)/Demos"; 322 | MACOSX_DEPLOYMENT_TARGET = 10.9; 323 | OTHER_LDFLAGS = ( 324 | "-framework", 325 | Foundation, 326 | "-framework", 327 | AppKit, 328 | ); 329 | PRODUCT_BUNDLE_IDENTIFIER = com.apple.samplecode.DockTilePlugIn; 330 | PRODUCT_NAME = DockTile.ObjC; 331 | WRAPPER_EXTENSION = docktileplugin; 332 | }; 333 | name = Debug; 334 | }; 335 | 53D679D80FD6F0DC001688B3 /* Release */ = { 336 | isa = XCBuildConfiguration; 337 | buildSettings = { 338 | ALWAYS_SEARCH_USER_PATHS = NO; 339 | CLANG_ENABLE_OBJC_WEAK = YES; 340 | COPY_PHASE_STRIP = YES; 341 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 342 | GCC_MODEL_TUNING = G5; 343 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 344 | GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h"; 345 | INFOPLIST_FILE = "DockTilePlugIn/DockTile.ObjC.PlugIn-Info.plist"; 346 | INSTALL_PATH = "$(LOCAL_DEVELOPER_DIR)/Demos"; 347 | MACOSX_DEPLOYMENT_TARGET = 10.9; 348 | OTHER_LDFLAGS = ( 349 | "-framework", 350 | Foundation, 351 | "-framework", 352 | AppKit, 353 | ); 354 | PRODUCT_BUNDLE_IDENTIFIER = com.apple.samplecode.DockTilePlugIn; 355 | PRODUCT_NAME = DockTile.ObjC; 356 | WRAPPER_EXTENSION = docktileplugin; 357 | ZERO_LINK = NO; 358 | }; 359 | name = Release; 360 | }; 361 | C01FCF4B08A954540054247B /* Debug */ = { 362 | isa = XCBuildConfiguration; 363 | buildSettings = { 364 | CLANG_ENABLE_OBJC_WEAK = YES; 365 | CODE_SIGN_IDENTITY = "-"; 366 | COPY_PHASE_STRIP = NO; 367 | DEBUG_INFORMATION_FORMAT = dwarf; 368 | GCC_DYNAMIC_NO_PIC = NO; 369 | GCC_MODEL_TUNING = G5; 370 | GCC_OPTIMIZATION_LEVEL = 0; 371 | GCC_PREFIX_HEADER = Prefix.pch; 372 | INFOPLIST_FILE = "DockTile.ObjC-Info.plist"; 373 | INSTALL_PATH = "$(LOCAL_DEVELOPER_DIR)/Demos"; 374 | MACOSX_DEPLOYMENT_TARGET = 10.9; 375 | PRODUCT_BUNDLE_IDENTIFIER = com.apple.examples.DockTile.ObjC.App; 376 | PRODUCT_NAME = DockTile.ObjC; 377 | WRAPPER_EXTENSION = app; 378 | ZERO_LINK = YES; 379 | }; 380 | name = Debug; 381 | }; 382 | C01FCF4C08A954540054247B /* Release */ = { 383 | isa = XCBuildConfiguration; 384 | buildSettings = { 385 | CLANG_ENABLE_OBJC_WEAK = YES; 386 | CODE_SIGN_IDENTITY = "-"; 387 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 388 | GCC_GENERATE_DEBUGGING_SYMBOLS = NO; 389 | GCC_MODEL_TUNING = G5; 390 | GCC_PREFIX_HEADER = Prefix.pch; 391 | INFOPLIST_FILE = "DockTile.ObjC-Info.plist"; 392 | INSTALL_PATH = "$(LOCAL_DEVELOPER_DIR)/Demos"; 393 | MACOSX_DEPLOYMENT_TARGET = 10.9; 394 | PRODUCT_BUNDLE_IDENTIFIER = com.apple.examples.DockTile.ObjC.App; 395 | PRODUCT_NAME = DockTile.ObjC; 396 | WRAPPER_EXTENSION = app; 397 | }; 398 | name = Release; 399 | }; 400 | C01FCF4F08A954540054247B /* Debug */ = { 401 | isa = XCBuildConfiguration; 402 | buildSettings = { 403 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 404 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 405 | CLANG_WARN_BOOL_CONVERSION = YES; 406 | CLANG_WARN_COMMA = YES; 407 | CLANG_WARN_CONSTANT_CONVERSION = YES; 408 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 409 | CLANG_WARN_EMPTY_BODY = YES; 410 | CLANG_WARN_ENUM_CONVERSION = YES; 411 | CLANG_WARN_INFINITE_RECURSION = YES; 412 | CLANG_WARN_INT_CONVERSION = YES; 413 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 414 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 415 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 416 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 417 | CLANG_WARN_STRICT_PROTOTYPES = YES; 418 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 419 | CLANG_WARN_UNREACHABLE_CODE = YES; 420 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 421 | ENABLE_STRICT_OBJC_MSGSEND = YES; 422 | ENABLE_TESTABILITY = YES; 423 | GCC_NO_COMMON_BLOCKS = YES; 424 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 425 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 426 | GCC_WARN_UNDECLARED_SELECTOR = YES; 427 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 428 | GCC_WARN_UNUSED_FUNCTION = YES; 429 | GCC_WARN_UNUSED_VARIABLE = YES; 430 | MACOSX_DEPLOYMENT_TARGET = 10.6; 431 | ONLY_ACTIVE_ARCH = YES; 432 | SDKROOT = macosx; 433 | }; 434 | name = Debug; 435 | }; 436 | C01FCF5008A954540054247B /* Release */ = { 437 | isa = XCBuildConfiguration; 438 | buildSettings = { 439 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 440 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 441 | CLANG_WARN_BOOL_CONVERSION = YES; 442 | CLANG_WARN_COMMA = YES; 443 | CLANG_WARN_CONSTANT_CONVERSION = YES; 444 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 445 | CLANG_WARN_EMPTY_BODY = YES; 446 | CLANG_WARN_ENUM_CONVERSION = YES; 447 | CLANG_WARN_INFINITE_RECURSION = YES; 448 | CLANG_WARN_INT_CONVERSION = YES; 449 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 450 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 451 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 452 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 453 | CLANG_WARN_STRICT_PROTOTYPES = YES; 454 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 455 | CLANG_WARN_UNREACHABLE_CODE = YES; 456 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 457 | ENABLE_STRICT_OBJC_MSGSEND = YES; 458 | GCC_NO_COMMON_BLOCKS = YES; 459 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 460 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 461 | GCC_WARN_UNDECLARED_SELECTOR = YES; 462 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 463 | GCC_WARN_UNUSED_FUNCTION = YES; 464 | GCC_WARN_UNUSED_VARIABLE = YES; 465 | MACOSX_DEPLOYMENT_TARGET = 10.6; 466 | SDKROOT = macosx; 467 | }; 468 | name = Release; 469 | }; 470 | /* End XCBuildConfiguration section */ 471 | 472 | /* Begin XCConfigurationList section */ 473 | 53D679D90FD6F0DC001688B3 /* Build configuration list for PBXNativeTarget "DockTile.ObjCPlugIn" */ = { 474 | isa = XCConfigurationList; 475 | buildConfigurations = ( 476 | 53D679D70FD6F0DC001688B3 /* Debug */, 477 | 53D679D80FD6F0DC001688B3 /* Release */, 478 | ); 479 | defaultConfigurationIsVisible = 0; 480 | defaultConfigurationName = Release; 481 | }; 482 | C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "DockTile.ObjCApp" */ = { 483 | isa = XCConfigurationList; 484 | buildConfigurations = ( 485 | C01FCF4B08A954540054247B /* Debug */, 486 | C01FCF4C08A954540054247B /* Release */, 487 | ); 488 | defaultConfigurationIsVisible = 0; 489 | defaultConfigurationName = Release; 490 | }; 491 | C01FCF4E08A954540054247B /* Build configuration list for PBXProject "DockTile.ObjC" */ = { 492 | isa = XCConfigurationList; 493 | buildConfigurations = ( 494 | C01FCF4F08A954540054247B /* Debug */, 495 | C01FCF5008A954540054247B /* Release */, 496 | ); 497 | defaultConfigurationIsVisible = 0; 498 | defaultConfigurationName = Release; 499 | }; 500 | /* End XCConfigurationList section */ 501 | }; 502 | rootObject = 29B97313FDCFA39411CA2CEA /* Project object */; 503 | } 504 | -------------------------------------------------------------------------------- /ObjC/DockTile.ObjC.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ObjC/DockTile.ObjC.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ObjC/DockTileAppDelegate.h: -------------------------------------------------------------------------------- 1 | /* 2 | File: DockTileAppDelegate.h 3 | Abstract: DockTile is a "game" which demonstrates the use of NSDockTile, and more importantly, the NSDockTilePlugIn protocol introduced in 10.6. 4 | 5 | The game is terribly simple: Your score goes up by 1 just by launching the app! So keep on launching the app over and over to reach new high scores. 6 | 7 | The high score is shown in the dock tile, and the app window, where you can also reset it. 8 | 9 | The whole game is implemented in the DockTileAppDelegate class, which is the delegate of the application. On applicationDidFinishLaunching: it updates the highScore. The only other thing it does is to implement resetHighScore: to set it back to 0. 10 | 11 | The dock tile plug-in is useful as a way to show off your high score even when the app is not running. The plug-in simply reads the high score from defaults, displays it as a badge on the dock tile, then updates it on receipt of a distributed notification that indicates when the high score changed. 12 | Version: 1.1 13 | 14 | Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple 15 | Inc. ("Apple") in consideration of your agreement to the following 16 | terms, and your use, installation, modification or redistribution of 17 | this Apple software constitutes acceptance of these terms. If you do 18 | not agree with these terms, please do not use, install, modify or 19 | redistribute this Apple software. 20 | 21 | In consideration of your agreement to abide by the following terms, and 22 | subject to these terms, Apple grants you a personal, non-exclusive 23 | license, under Apple's copyrights in this original Apple software (the 24 | "Apple Software"), to use, reproduce, modify and redistribute the Apple 25 | Software, with or without modifications, in source and/or binary forms; 26 | provided that if you redistribute the Apple Software in its entirety and 27 | without modifications, you must retain this notice and the following 28 | text and disclaimers in all such redistributions of the Apple Software. 29 | Neither the name, trademarks, service marks or logos of Apple Inc. may 30 | be used to endorse or promote products derived from the Apple Software 31 | without specific prior written permission from Apple. Except as 32 | expressly stated in this notice, no other rights or licenses, express or 33 | implied, are granted by Apple herein, including but not limited to any 34 | patent rights that may be infringed by your derivative works or by other 35 | works in which the Apple Software may be incorporated. 36 | 37 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE 38 | MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION 39 | THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS 40 | FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND 41 | OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 42 | 43 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL 44 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 45 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 46 | INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, 47 | MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED 48 | AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), 49 | STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE 50 | POSSIBILITY OF SUCH DAMAGE. 51 | 52 | Copyright (C) 2011 Apple Inc. All Rights Reserved. 53 | 54 | */ 55 | 56 | #include 57 | 58 | @interface DockTileAppDelegate : NSObject{ 59 | NSMenu *dockMenu; 60 | } 61 | 62 | @property NSInteger highScore; 63 | 64 | - (IBAction)resetHighScore:(id)sender; 65 | 66 | @end 67 | -------------------------------------------------------------------------------- /ObjC/DockTileAppDelegate.m: -------------------------------------------------------------------------------- 1 | /* 2 | File: DockTileAppDelegate.m 3 | Abstract: DockTile is a "game" which demonstrates the use of NSDockTile, and more importantly, the NSDockTilePlugIn protocol introduced in 10.6. 4 | 5 | The game is terribly simple: Your score goes up by 1 just by launching the app! So keep on launching the app over and over to reach new high scores. 6 | 7 | The high score is shown in the dock tile, and the app window, where you can also reset it. 8 | 9 | The whole game is implemented in the DockTileAppDelegate class, which is the delegate of the application. On applicationDidFinishLaunching: it updates the highScore. The only other thing it does is to implement resetHighScore: to set it back to 0. 10 | 11 | The dock tile plug-in is useful as a way to show off your high score even when the app is not running. The plug-in simply reads the high score from defaults, displays it as a badge on the dock tile, then updates it on receipt of a distributed notification that indicates when the high score changed. 12 | Version: 1.1 13 | 14 | Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple 15 | Inc. ("Apple") in consideration of your agreement to the following 16 | terms, and your use, installation, modification or redistribution of 17 | this Apple software constitutes acceptance of these terms. If you do 18 | not agree with these terms, please do not use, install, modify or 19 | redistribute this Apple software. 20 | 21 | In consideration of your agreement to abide by the following terms, and 22 | subject to these terms, Apple grants you a personal, non-exclusive 23 | license, under Apple's copyrights in this original Apple software (the 24 | "Apple Software"), to use, reproduce, modify and redistribute the Apple 25 | Software, with or without modifications, in source and/or binary forms; 26 | provided that if you redistribute the Apple Software in its entirety and 27 | without modifications, you must retain this notice and the following 28 | text and disclaimers in all such redistributions of the Apple Software. 29 | Neither the name, trademarks, service marks or logos of Apple Inc. may 30 | be used to endorse or promote products derived from the Apple Software 31 | without specific prior written permission from Apple. Except as 32 | expressly stated in this notice, no other rights or licenses, express or 33 | implied, are granted by Apple herein, including but not limited to any 34 | patent rights that may be infringed by your derivative works or by other 35 | works in which the Apple Software may be incorporated. 36 | 37 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE 38 | MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION 39 | THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS 40 | FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND 41 | OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 42 | 43 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL 44 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 45 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 46 | INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, 47 | MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED 48 | AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), 49 | STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE 50 | POSSIBILITY OF SUCH DAMAGE. 51 | 52 | Copyright (C) 2011 Apple Inc. All Rights Reserved. 53 | 54 | */ 55 | 56 | #include "DockTileAppDelegate.h" 57 | 58 | @implementation DockTileAppDelegate 59 | 60 | /* highScore accessors. highScore is declared as a property, but we don't have an instance variable for it, and nor do we use synthesized accessors since we do special things. 61 | */ 62 | - (NSInteger)highScore { 63 | // We get the value from defaults (preferences), we don't keep a copy of the high score in the app. 64 | return [[NSUserDefaults standardUserDefaults] integerForKey:@"HighScore"]; 65 | } 66 | 67 | - (void)setHighScore:(NSInteger)newScore { 68 | NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; 69 | 70 | // We just save the value out, we don't keep a copy of the high score in the app. 71 | [defaults setInteger:newScore forKey:@"HighScore"]; 72 | 73 | // Save the value out to defaults now. We often don't explicit synchronize, since it's best to let the system take care of it automatically. However, in this case since we're asking the plug-in to update the score, synchronizing before the notification ensures that the plug-in sees the latest value. Always make sure the value is updated and synchronized before sending out the distributed notification to other processes. 74 | [defaults synchronize]; 75 | 76 | // And post a notification so the plug-in sees the change. 77 | [[NSDistributedNotificationCenter defaultCenter] postNotificationName:@"com.apple.DockTile.ObjC.HighScoreChanged" object:nil]; 78 | 79 | // Now update the dock tile. Note that a more general way to do this would be to observe the highScore property, but we're just keeping things short and sweet here, trying to demo how to write a plug-in. 80 | [[[NSApplication sharedApplication] dockTile] setBadgeLabel:[NSString stringWithFormat:@"%ld", (long)newScore]]; 81 | } 82 | 83 | /* On launch, get the previous score, increment by one, and save it. By definition all updated scores are high scores. 84 | */ 85 | - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { 86 | [self setHighScore:[self highScore] + 1]; 87 | } 88 | 89 | /* Reset the high score. Simple... 90 | */ 91 | - (void)resetHighScore:(id)sender { 92 | [self setHighScore:0]; 93 | } 94 | 95 | // This menu will ONLY appear when the app is running. We need NSDockPlugin for it to appear when the app isn't running. 96 | - (NSMenu *)applicationDockMenu:(NSApplication *)sender { 97 | // Create the menu 98 | if (dockMenu == nil) 99 | dockMenu = [[NSMenu alloc] init]; 100 | else 101 | [dockMenu removeAllItems]; 102 | 103 | // Let's Find the HighScore 104 | CFPreferencesAppSynchronize(CFSTR("com.apple.examples.DockTile.ObjC.App")); 105 | NSInteger highScore = CFPreferencesGetAppIntegerValue(CFSTR("HighScore"), CFSTR("com.apple.examples.DockTile.ObjC.App"), NULL); 106 | 107 | // Convert it into a string 108 | NSString *highScoreAsString = [NSString stringWithFormat:@"%ld", (long)highScore]; 109 | NSMenuItem *highScoreMenu = [[NSMenuItem alloc] initWithTitle:highScoreAsString action:NULL keyEquivalent:@""]; 110 | 111 | [dockMenu addItem: highScoreMenu]; 112 | [highScoreMenu release]; 113 | 114 | return dockMenu; 115 | } 116 | 117 | @end 118 | -------------------------------------------------------------------------------- /ObjC/DockTilePlugIn/DockTile.ObjC.PlugIn-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | NSPrincipalClass 22 | DockTilePlugIn 23 | 24 | 25 | -------------------------------------------------------------------------------- /ObjC/DockTilePlugIn/DockTilePlugIn.h: -------------------------------------------------------------------------------- 1 | /* 2 | File: DockTilePlugIn.h 3 | Abstract: DockTile is a "game" which demonstrates the use of NSDockTile, and more importantly, the NSDockTilePlugIn protocol introduced in 10.6. 4 | 5 | The game is terribly simple: Your score goes up by 1 just by launching the app! So keep on launching the app over and over to reach new high scores. 6 | 7 | This class, DockTilePlugIn, is part of the dock plug-in for the app, which allows the dock tile to show the score even when the app is not running. This class implements the NSDockTilePlugIn protocol, which has just one required method, -setDockTile:. 8 | 9 | When the plug-in is loaded, an instance of DockTilePlugIn is instantiated, and setDockTile: called with an instance of NSDockTile. The implementation of setDockTile: in DockTilePlugIn sets the plug-in as an observer of high score changes (using NSDistributedNotification), causing the badge on the dock tile to update everytime the score is updated. 10 | 11 | The NSDistributedNotificationCenter registry happens with the 10.6 method addObserverForName:object:queue:block:. The body of the block has no references to the DockTilePlugIn instance, which means the notification does not cause it to be retained. In this case that does not matter (since setDockTile:nil is called, which removes the observer), but in some cases this is important to watch for. 12 | Version: 1.1 13 | 14 | Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple 15 | Inc. ("Apple") in consideration of your agreement to the following 16 | terms, and your use, installation, modification or redistribution of 17 | this Apple software constitutes acceptance of these terms. If you do 18 | not agree with these terms, please do not use, install, modify or 19 | redistribute this Apple software. 20 | 21 | In consideration of your agreement to abide by the following terms, and 22 | subject to these terms, Apple grants you a personal, non-exclusive 23 | license, under Apple's copyrights in this original Apple software (the 24 | "Apple Software"), to use, reproduce, modify and redistribute the Apple 25 | Software, with or without modifications, in source and/or binary forms; 26 | provided that if you redistribute the Apple Software in its entirety and 27 | without modifications, you must retain this notice and the following 28 | text and disclaimers in all such redistributions of the Apple Software. 29 | Neither the name, trademarks, service marks or logos of Apple Inc. may 30 | be used to endorse or promote products derived from the Apple Software 31 | without specific prior written permission from Apple. Except as 32 | expressly stated in this notice, no other rights or licenses, express or 33 | implied, are granted by Apple herein, including but not limited to any 34 | patent rights that may be infringed by your derivative works or by other 35 | works in which the Apple Software may be incorporated. 36 | 37 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE 38 | MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION 39 | THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS 40 | FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND 41 | OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 42 | 43 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL 44 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 45 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 46 | INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, 47 | MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED 48 | AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), 49 | STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE 50 | POSSIBILITY OF SUCH DAMAGE. 51 | 52 | Copyright (C) 2011 Apple Inc. All Rights Reserved. 53 | 54 | */ 55 | 56 | #include 57 | 58 | @interface DockTilePlugIn : NSObject { 59 | id highScoreObserver; 60 | NSMenu *dockMenu; 61 | } 62 | 63 | @property(retain) id highScoreObserver; 64 | @end 65 | -------------------------------------------------------------------------------- /ObjC/DockTilePlugIn/DockTilePlugIn.m: -------------------------------------------------------------------------------- 1 | /* 2 | File: DockTilePlugIn.m 3 | Abstract: DockTile is a "game" which demonstrates the use of NSDockTile, and more importantly, the NSDockTilePlugIn protocol introduced in 10.6. 4 | 5 | The game is terribly simple: Your score goes up by 1 just by launching the app! So keep on launching the app over and over to reach new high scores. 6 | 7 | This class, DockTilePlugIn, is part of the dock plug-in for the app, which allows the dock tile to show the score even when the app is not running. This class implements the NSDockTilePlugIn protocol, which has just one required method, -setDockTile:. 8 | 9 | When the plug-in is loaded, an instance of DockTilePlugIn is instantiated, and setDockTile: called with an instance of NSDockTile. The implementation of setDockTile: in DockTilePlugIn sets the plug-in as an observer of high score changes (using NSDistributedNotification), causing the badge on the dock tile to update everytime the score is updated. 10 | 11 | The NSDistributedNotificationCenter registry happens with the 10.6 method addObserverForName:object:queue:block:. The body of the block has no references to the DockTilePlugIn instance, which means the notification does not cause it to be retained. In this case that does not matter (since setDockTile:nil is called, which removes the observer), but in some cases this is important to watch for. 12 | Version: 1.1 13 | 14 | Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple 15 | Inc. ("Apple") in consideration of your agreement to the following 16 | terms, and your use, installation, modification or redistribution of 17 | this Apple software constitutes acceptance of these terms. If you do 18 | not agree with these terms, please do not use, install, modify or 19 | redistribute this Apple software. 20 | 21 | In consideration of your agreement to abide by the following terms, and 22 | subject to these terms, Apple grants you a personal, non-exclusive 23 | license, under Apple's copyrights in this original Apple software (the 24 | "Apple Software"), to use, reproduce, modify and redistribute the Apple 25 | Software, with or without modifications, in source and/or binary forms; 26 | provided that if you redistribute the Apple Software in its entirety and 27 | without modifications, you must retain this notice and the following 28 | text and disclaimers in all such redistributions of the Apple Software. 29 | Neither the name, trademarks, service marks or logos of Apple Inc. may 30 | be used to endorse or promote products derived from the Apple Software 31 | without specific prior written permission from Apple. Except as 32 | expressly stated in this notice, no other rights or licenses, express or 33 | implied, are granted by Apple herein, including but not limited to any 34 | patent rights that may be infringed by your derivative works or by other 35 | works in which the Apple Software may be incorporated. 36 | 37 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE 38 | MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION 39 | THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS 40 | FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND 41 | OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 42 | 43 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL 44 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 45 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 46 | INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, 47 | MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED 48 | AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), 49 | STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE 50 | POSSIBILITY OF SUCH DAMAGE. 51 | 52 | Copyright (C) 2011 Apple Inc. All Rights Reserved. 53 | 54 | */ 55 | 56 | #include "DockTilePlugIn.h" 57 | 58 | @implementation DockTilePlugIn 59 | 60 | @synthesize highScoreObserver; 61 | 62 | /* To update the score, we first make sure we are looking at the latest state of the defaults database, then we fetch the score and set it as the badge label. 63 | */ 64 | static void updateScore(NSDockTile *tile) { 65 | CFPreferencesAppSynchronize(CFSTR("com.apple.examples.DockTile.ObjC.App")); 66 | NSInteger highScore = CFPreferencesGetAppIntegerValue(CFSTR("HighScore"), CFSTR("com.apple.examples.DockTile.ObjC.App"), NULL); 67 | [tile setBadgeLabel:[NSString stringWithFormat:@"%ld", (long)highScore]]; 68 | } 69 | 70 | - (void)setDockTile:(NSDockTile *)dockTile { 71 | if (dockTile) { 72 | // Attach an observer that will update the high score in the dock tile whenever it changes 73 | self.highScoreObserver = [[NSDistributedNotificationCenter defaultCenter] addObserverForName:@"com.apple.DockTile.ObjC.HighScoreChanged" object:nil queue:nil usingBlock:^(NSNotification *notification) { 74 | updateScore(dockTile); // Note that this block captures (and retains) dockTile for use later. Also note that it does not capture self, which means -dealloc may be called even while the notification is active. Although it's not clear this needs to be supported, this does eliminate a potential source of leaks. 75 | }]; 76 | updateScore(dockTile); // Make sure score is updated from the get-go as well 77 | } else { 78 | // Strictly speaking this may not be necessary (since the plug-in may be terminated when it's removed from the dock), but it's good practice 79 | [[NSDistributedNotificationCenter defaultCenter] removeObserver:self.highScoreObserver]; 80 | self.highScoreObserver = nil; 81 | } 82 | } 83 | 84 | - (NSMenu *)dockMenu { 85 | 86 | // Create the menu 87 | if (dockMenu == nil) 88 | dockMenu = [[NSMenu alloc] init]; 89 | else 90 | [dockMenu removeAllItems]; 91 | 92 | // Let's Find the HighScore 93 | CFPreferencesAppSynchronize(CFSTR("com.apple.examples.DockTile.ObjC.App")); 94 | NSInteger highScore = CFPreferencesGetAppIntegerValue(CFSTR("HighScore"), CFSTR("com.apple.examples.DockTile.ObjC.App"), NULL); 95 | 96 | // Convert it into a string 97 | NSString *highScoreAsString = [NSString stringWithFormat:@"%ld", (long)highScore]; 98 | NSMenuItem *highScoreMenu = [[NSMenuItem alloc] initWithTitle:highScoreAsString action:NULL keyEquivalent:@""]; 99 | 100 | [dockMenu addItem: highScoreMenu]; 101 | [highScoreMenu release]; 102 | 103 | return dockMenu; 104 | } 105 | 106 | - (void)dealloc { 107 | if (self.highScoreObserver) { 108 | [[NSDistributedNotificationCenter defaultCenter] removeObserver:self.highScoreObserver]; 109 | self.highScoreObserver = nil; 110 | } 111 | [dockMenu release]; 112 | [super dealloc]; 113 | } 114 | 115 | @end 116 | -------------------------------------------------------------------------------- /ObjC/Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // File: Prefix.pch 3 | // 4 | // Version: 1.0 5 | // 6 | // Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Inc. ("Apple") 7 | // in consideration of your agreement to the following terms, and your use, 8 | // installation, modification or redistribution of this Apple software 9 | // constitutes acceptance of these terms. If you do not agree with these 10 | // terms, please do not use, install, modify or redistribute this Apple 11 | // software. 12 | // 13 | // In consideration of your agreement to abide by the following terms, and 14 | // subject to these terms, Apple grants you a personal, non - exclusive 15 | // license, under Apple's copyrights in this original Apple software ( the 16 | // "Apple Software" ), to use, reproduce, modify and redistribute the Apple 17 | // Software, with or without modifications, in source and / or binary forms; 18 | // provided that if you redistribute the Apple Software in its entirety and 19 | // without modifications, you must retain this notice and the following text 20 | // and disclaimers in all such redistributions of the Apple Software. Neither 21 | // the name, trademarks, service marks or logos of Apple Inc. may be used to 22 | // endorse or promote products derived from the Apple Software without specific 23 | // prior written permission from Apple. Except as expressly stated in this 24 | // notice, no other rights or licenses, express or implied, are granted by 25 | // Apple herein, including but not limited to any patent rights that may be 26 | // infringed by your derivative works or by other works in which the Apple 27 | // Software may be incorporated. 28 | // 29 | // The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO 30 | // WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED 31 | // WARRANTIES OF NON - INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A 32 | // PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION 33 | // ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 34 | // 35 | // IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR 36 | // CONSEQUENTIAL DAMAGES ( INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 37 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 38 | // INTERRUPTION ) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION 39 | // AND / OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER 40 | // UNDER THEORY OF CONTRACT, TORT ( INCLUDING NEGLIGENCE ), STRICT LIABILITY OR 41 | // OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 42 | // 43 | // Copyright (C) 2008 Apple Inc. All Rights Reserved. 44 | // 45 | 46 | #ifdef __OBJC__ 47 | #import 48 | #endif 49 | -------------------------------------------------------------------------------- /ObjC/README.rtf: -------------------------------------------------------------------------------- 1 | {\rtf1\ansi\ansicpg1252\cocoartf1027 2 | {\fonttbl\f0\fswiss\fcharset0 Helvetica;} 3 | {\colortbl;\red255\green255\blue255;} 4 | \vieww10160\viewh10700\viewkind0 5 | \deftab1120 6 | \pard\tx1120\pardeftab1120\ql\qnatural\pardirnatural 7 | 8 | \f0\b\fs48 \cf0 DockTile\ 9 | 10 | \b0\fs24 \ 11 | DockTile application demonstrates the use of NSDockTile, and more importantly, the NSDockTilePlugIn protocol introduced in 10.6. The example includes two pieces: The DockTile app, and the plug-in, DockTilePlugIn. Building the target for the app will build and package both together.\ 12 | \ 13 | You can think of DockTile as a terribly simple game. Your score goes up by 1 just by launching the app! So keep on launching the app over and over to reach new high scores.\ 14 | \ 15 | The high score is shown in the dock tile, and the app window, where you can also reset it. The plug-in is useful as a way to show the score even when the application is not running.\ 16 | \ 17 | The whole application source code is implemented in the DockTileAppDelegate class, which is the delegate of the application. On applicationDidFinishLaunching: it updates the high score. The only other thing it does is to implement resetHighScore: to set it back to 0.\ 18 | \ 19 | The dock tile plug-in shows off your high score even when the app is not running. The plug-in simply reads the high score from the defaults domain of the app, displays it as a badge on the dock tile, then updates it on receipt of a distributed notification that indicates when the high score changed.\ 20 | \ 21 | Some notes and things to watch out for:\ 22 | \'95 The project has two targets; the DockTileApp target also builds the DockTilePlugIn target, and includes it in the app package. \ 23 | \'95 The plug-in goes inside the Contents/PlugIns folder in the app package. Just the file name goes in the app's Info.plist, as the value of NSDockTilePlugIn. \ 24 | \pard\pardeftab720\ql\qnatural 25 | \cf0 \'95 Remember to build the plug-in 32 and 64 bits.\ 26 | \pard\tx1120\pardeftab1120\ql\qnatural\pardirnatural 27 | \cf0 \'95 The plug-in's principal class should be listed in the plug-in's Info.plist.\ 28 | \'95 As of 10.6, SystemUIServer (the server which hosts the plug-ins) does not always notice when the plug-ins are updated. So during development, you may want to restart it after updating the plug-in. Most thorough steps are: Remove your app from the dock. Wait 3-5 seconds. killall Dock. \'a0killall SystemUIServer.\ 29 | \'95 If your app does not draw into the dock tile, the plug-in's updates will be in effect even when the app is running. So you can actually have your dock tile plug-in do all dock tile updating if you wish. In the DockTile example the app actually shows the score itself while it's running.\ 30 | \'95 Dock tile plug-ins should remember they are "guests" inside SystemUIServer, and take care not to destabilize or hog the process, or do anything that would block the main thread, such as networking, messaging, etc. The DockTile example itself uses two techniques to hear about the high score status: Registers for a distributed notification, and access the high score using CFPreferences out of the app's preferences domain. For instance the latter could have also been achieved using the NSUserDefaults addSuiteNamed: API, but that would have changed the global preferences domain list for the SystemUIServer\'97not a good idea.\ 31 | \ 32 | \ 33 | \ 34 | \ 35 | } -------------------------------------------------------------------------------- /ObjC/en.lproj/Credits.rtf: -------------------------------------------------------------------------------- 1 | {\rtf1\ansi\ansicpg1252\cocoartf1027 2 | {\fonttbl\f0\fnil\fcharset0 LucidaGrande;} 3 | {\colortbl;\red255\green255\blue255;} 4 | \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\qc 5 | 6 | \f0\fs20 \cf0 Demonstrates NSDockTilePlugIn.} -------------------------------------------------------------------------------- /ObjC/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CartBlanche/MacDockTileSample/764a5dcadf885bddb7999c75d44a3b0f10a52322/ObjC/en.lproj/InfoPlist.strings -------------------------------------------------------------------------------- /ObjC/icon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CartBlanche/MacDockTileSample/764a5dcadf885bddb7999c75d44a3b0f10a52322/ObjC/icon.icns -------------------------------------------------------------------------------- /ObjC/main.m: -------------------------------------------------------------------------------- 1 | /* 2 | File: main.m 3 | Abstract: Default main.m 4 | Version: 1.1 5 | 6 | Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple 7 | Inc. ("Apple") in consideration of your agreement to the following 8 | terms, and your use, installation, modification or redistribution of 9 | this Apple software constitutes acceptance of these terms. If you do 10 | not agree with these terms, please do not use, install, modify or 11 | redistribute this Apple software. 12 | 13 | In consideration of your agreement to abide by the following terms, and 14 | subject to these terms, Apple grants you a personal, non-exclusive 15 | license, under Apple's copyrights in this original Apple software (the 16 | "Apple Software"), to use, reproduce, modify and redistribute the Apple 17 | Software, with or without modifications, in source and/or binary forms; 18 | provided that if you redistribute the Apple Software in its entirety and 19 | without modifications, you must retain this notice and the following 20 | text and disclaimers in all such redistributions of the Apple Software. 21 | Neither the name, trademarks, service marks or logos of Apple Inc. may 22 | be used to endorse or promote products derived from the Apple Software 23 | without specific prior written permission from Apple. Except as 24 | expressly stated in this notice, no other rights or licenses, express or 25 | implied, are granted by Apple herein, including but not limited to any 26 | patent rights that may be infringed by your derivative works or by other 27 | works in which the Apple Software may be incorporated. 28 | 29 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE 30 | MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION 31 | THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS 32 | FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND 33 | OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 34 | 35 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL 36 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 37 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 38 | INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, 39 | MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED 40 | AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), 41 | STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE 42 | POSSIBILITY OF SUCH DAMAGE. 43 | 44 | Copyright (C) 2011 Apple Inc. All Rights Reserved. 45 | 46 | */ 47 | 48 | #include 49 | 50 | int main(int argc, char *argv[]) 51 | { 52 | return NSApplicationMain(argc, (const char **) argv); 53 | } 54 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DockTile Sample 2 | As Apple has removed any tutorials on how to write **NSDockTilePlugin**s so I Googled for one. This is an updated version of [Janetzko Helmut's](https://github.com/HelmutJ) Objective C [DockTile](https://github.com/HelmutJ/CocoaSampleCode/tree/master/DockTile) sample. 3 | His version is 7 years out of date, so this version updates the code to work in Xcode 11. 4 | 5 | ## Original Sample's ReadMe 6 | DockTile application demonstrates the use of NSDockTile, and more importantly, the NSDockTilePlugIn protocol introduced in 10.6. The example includes two pieces: The DockTile app, and the plug-in, DockTilePlugIn. Building the target for the app will build and package both together. 7 | 8 | You can think of DockTile as a terribly simple game. Your score goes up by 1 just by launching the app! So keep on launching the app over and over to reach new high scores. 9 | 10 | The high score is shown in the dock tile, and the app window, where you can also reset it. The plug-in is useful as a way to show the score even when the application is not running. 11 | 12 | The whole application source code is implemented in the DockTileAppDelegate class, which is the delegate of the application. On applicationDidFinishLaunching: it updates the high score. The only other thing it does is to implement resetHighScore: to set it back to 0. 13 | 14 | The dock tile plug-in shows off your high score even when the app is not running. The plug-in simply reads the high score from the defaults domain of the app, displays it as a badge on the dock tile, then updates it on receipt of a distributed notification that indicates when the high score changed. 15 | 16 | Some notes and things to watch out for: 17 | * The project has two targets; the DockTileApp target also builds the DockTilePlugIn target, and includes it in the app package. 18 | * The plug-in goes inside the Contents/PlugIns folder in the app package. Just the file name goes in the app's Info.plist, as the value of NSDockTilePlugIn. 19 | * Remember to build the plug-in 32 and 64 bits. 20 | * The plug-in's principal class should be listed in the plug-in's Info.plist. 21 | * As of 10.6, SystemUIServer (the server which hosts the plug-ins) does not always notice when the plug-ins are updated. So during development, you may want to restart it after updating the plug-in. Most thorough steps are: Remove your app from the dock. Wait 3-5 seconds. killall Dock.  killall SystemUIServer. 22 | * If your app does not draw into the dock tile, the plug-in's updates will be in effect even when the app is running. So you can actually have your dock tile plug-in do all dock tile updating if you wish. In the DockTile example the app actually shows the score itself while it's running. 23 | * Dock tile plug-ins should remember they are "guests" inside SystemUIServer, and take care not to destabilize or hog the process, or do anything that would block the main thread, such as networking, messaging, etc. The DockTile example itself uses two techniques to hear about the high score status: Registers for a distributed notification, and access the high score using CFPreferences out of the app's preferences domain. For instance the latter could have also been achieved using the NSUserDefaults addSuiteNamed: API, but that would have changed the global preferences domain list for the SystemUIServer—not a good idea. 24 | 25 | 26 | ## What the original sample showed 27 | Each time the app is opened a counter increments and the app's DockTile is updated with the new value. 28 | 29 | ## Enhancement over original Sample 30 | * Added DockMenu support 31 | * When you right click the app's dock tile, while it is running, the popped up menu will display the current counter 32 | * After setting the app to **Keep in Dock**, then shutting it down, when you right click the app's dock tile, now no longer running, the popped up menu will display the current counter 33 | 34 | 35 | ## Future 36 | I hope to update this repo with example of how to do DockTile plugins in other languages. 37 | 1st should be a Xamarin/.NET sample. 38 | 39 | If you would like to port this sample to another language and would like to add it to this repo, please fork the repo as Pull Requests are always welcome!! :D 40 | 41 | ## License 42 | 43 | The DockTile project is under the [Microsoft Public License](https://opensource.org/licenses/MS-PL) except for a few portions of the code. See the [LICENSE.txt](LICENSE.txt) file for more details. Third-party libraries used by MonoGame are under their own licenses. Please refer to those libraries for details on the license they use. --------------------------------------------------------------------------------