├── NSSharingPickerTest.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── contents.xcworkspacedata ├── NSSharingPickerTest ├── AppDelegate.h ├── AppDelegate.m ├── Base.lproj │ └── MainMenu.xib ├── IMG_4996.PNG ├── Images.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Info.plist ├── InvokeSpecificSharingPicker.h ├── InvokeSpecificSharingPicker.m ├── NSSharingServicePicker+Private.h ├── ShareRolloverView.h ├── ShareRolloverView.m └── main.m ├── NSSharingPickerTestTests ├── Info.plist └── NSSharingPickerTestTests.m ├── README.md └── screenshot.png /NSSharingPickerTest.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 03E208DD1F94A4C4000B553E /* InvokeSpecificSharingPicker.m in Sources */ = {isa = PBXBuildFile; fileRef = 03E208DC1F94A4C4000B553E /* InvokeSpecificSharingPicker.m */; }; 11 | 4D7B4FE01A812755003D23E2 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D7B4FDF1A812755003D23E2 /* AppDelegate.m */; }; 12 | 4D7B4FE21A812755003D23E2 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D7B4FE11A812755003D23E2 /* main.m */; }; 13 | 4D7B4FE41A812755003D23E2 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 4D7B4FE31A812755003D23E2 /* Images.xcassets */; }; 14 | 4D7B4FE71A812755003D23E2 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4D7B4FE51A812755003D23E2 /* MainMenu.xib */; }; 15 | 4D7B4FF31A812755003D23E2 /* NSSharingPickerTestTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D7B4FF21A812755003D23E2 /* NSSharingPickerTestTests.m */; }; 16 | 4D7B4FFD1A81280A003D23E2 /* IMG_4996.PNG in Resources */ = {isa = PBXBuildFile; fileRef = 4D7B4FFC1A81280A003D23E2 /* IMG_4996.PNG */; }; 17 | D45682351D6B5DED000FEE84 /* ShareRolloverView.m in Sources */ = {isa = PBXBuildFile; fileRef = D45682341D6B5DED000FEE84 /* ShareRolloverView.m */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXContainerItemProxy section */ 21 | 4D7B4FED1A812755003D23E2 /* PBXContainerItemProxy */ = { 22 | isa = PBXContainerItemProxy; 23 | containerPortal = 4D7B4FD11A812755003D23E2 /* Project object */; 24 | proxyType = 1; 25 | remoteGlobalIDString = 4D7B4FD81A812755003D23E2; 26 | remoteInfo = NSSharingPickerTest; 27 | }; 28 | /* End PBXContainerItemProxy section */ 29 | 30 | /* Begin PBXFileReference section */ 31 | 03E208DB1F94A4C4000B553E /* InvokeSpecificSharingPicker.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = InvokeSpecificSharingPicker.h; sourceTree = ""; }; 32 | 03E208DC1F94A4C4000B553E /* InvokeSpecificSharingPicker.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = InvokeSpecificSharingPicker.m; sourceTree = ""; }; 33 | 03E208DE1F94A8DB000B553E /* NSSharingServicePicker+Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSSharingServicePicker+Private.h"; sourceTree = ""; }; 34 | 4D7B4FD91A812755003D23E2 /* NSSharingPickerTest.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = NSSharingPickerTest.app; sourceTree = BUILT_PRODUCTS_DIR; }; 35 | 4D7B4FDD1A812755003D23E2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 36 | 4D7B4FDE1A812755003D23E2 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 37 | 4D7B4FDF1A812755003D23E2 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 38 | 4D7B4FE11A812755003D23E2 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 39 | 4D7B4FE31A812755003D23E2 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 40 | 4D7B4FE61A812755003D23E2 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; 41 | 4D7B4FEC1A812755003D23E2 /* NSSharingPickerTestTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = NSSharingPickerTestTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 42 | 4D7B4FF11A812755003D23E2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 43 | 4D7B4FF21A812755003D23E2 /* NSSharingPickerTestTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NSSharingPickerTestTests.m; sourceTree = ""; }; 44 | 4D7B4FFC1A81280A003D23E2 /* IMG_4996.PNG */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = IMG_4996.PNG; sourceTree = ""; }; 45 | D45682331D6B5DED000FEE84 /* ShareRolloverView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShareRolloverView.h; sourceTree = ""; }; 46 | D45682341D6B5DED000FEE84 /* ShareRolloverView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ShareRolloverView.m; sourceTree = ""; }; 47 | /* End PBXFileReference section */ 48 | 49 | /* Begin PBXFrameworksBuildPhase section */ 50 | 4D7B4FD61A812755003D23E2 /* Frameworks */ = { 51 | isa = PBXFrameworksBuildPhase; 52 | buildActionMask = 2147483647; 53 | files = ( 54 | ); 55 | runOnlyForDeploymentPostprocessing = 0; 56 | }; 57 | 4D7B4FE91A812755003D23E2 /* Frameworks */ = { 58 | isa = PBXFrameworksBuildPhase; 59 | buildActionMask = 2147483647; 60 | files = ( 61 | ); 62 | runOnlyForDeploymentPostprocessing = 0; 63 | }; 64 | /* End PBXFrameworksBuildPhase section */ 65 | 66 | /* Begin PBXGroup section */ 67 | 4D7B4FD01A812755003D23E2 = { 68 | isa = PBXGroup; 69 | children = ( 70 | 4D7B4FDB1A812755003D23E2 /* NSSharingPickerTest */, 71 | 4D7B4FEF1A812755003D23E2 /* NSSharingPickerTestTests */, 72 | 4D7B4FDA1A812755003D23E2 /* Products */, 73 | ); 74 | sourceTree = ""; 75 | }; 76 | 4D7B4FDA1A812755003D23E2 /* Products */ = { 77 | isa = PBXGroup; 78 | children = ( 79 | 4D7B4FD91A812755003D23E2 /* NSSharingPickerTest.app */, 80 | 4D7B4FEC1A812755003D23E2 /* NSSharingPickerTestTests.xctest */, 81 | ); 82 | name = Products; 83 | sourceTree = ""; 84 | }; 85 | 4D7B4FDB1A812755003D23E2 /* NSSharingPickerTest */ = { 86 | isa = PBXGroup; 87 | children = ( 88 | 4D7B4FDE1A812755003D23E2 /* AppDelegate.h */, 89 | 4D7B4FDF1A812755003D23E2 /* AppDelegate.m */, 90 | 03E208DB1F94A4C4000B553E /* InvokeSpecificSharingPicker.h */, 91 | 03E208DC1F94A4C4000B553E /* InvokeSpecificSharingPicker.m */, 92 | D45682331D6B5DED000FEE84 /* ShareRolloverView.h */, 93 | D45682341D6B5DED000FEE84 /* ShareRolloverView.m */, 94 | 03E208DE1F94A8DB000B553E /* NSSharingServicePicker+Private.h */, 95 | 4D7B4FE31A812755003D23E2 /* Images.xcassets */, 96 | 4D7B4FE51A812755003D23E2 /* MainMenu.xib */, 97 | 4D7B4FDC1A812755003D23E2 /* Supporting Files */, 98 | ); 99 | path = NSSharingPickerTest; 100 | sourceTree = ""; 101 | }; 102 | 4D7B4FDC1A812755003D23E2 /* Supporting Files */ = { 103 | isa = PBXGroup; 104 | children = ( 105 | 4D7B4FFC1A81280A003D23E2 /* IMG_4996.PNG */, 106 | 4D7B4FDD1A812755003D23E2 /* Info.plist */, 107 | 4D7B4FE11A812755003D23E2 /* main.m */, 108 | ); 109 | name = "Supporting Files"; 110 | sourceTree = ""; 111 | }; 112 | 4D7B4FEF1A812755003D23E2 /* NSSharingPickerTestTests */ = { 113 | isa = PBXGroup; 114 | children = ( 115 | 4D7B4FF21A812755003D23E2 /* NSSharingPickerTestTests.m */, 116 | 4D7B4FF01A812755003D23E2 /* Supporting Files */, 117 | ); 118 | path = NSSharingPickerTestTests; 119 | sourceTree = ""; 120 | }; 121 | 4D7B4FF01A812755003D23E2 /* Supporting Files */ = { 122 | isa = PBXGroup; 123 | children = ( 124 | 4D7B4FF11A812755003D23E2 /* Info.plist */, 125 | ); 126 | name = "Supporting Files"; 127 | sourceTree = ""; 128 | }; 129 | /* End PBXGroup section */ 130 | 131 | /* Begin PBXNativeTarget section */ 132 | 4D7B4FD81A812755003D23E2 /* NSSharingPickerTest */ = { 133 | isa = PBXNativeTarget; 134 | buildConfigurationList = 4D7B4FF61A812755003D23E2 /* Build configuration list for PBXNativeTarget "NSSharingPickerTest" */; 135 | buildPhases = ( 136 | 4D7B4FD51A812755003D23E2 /* Sources */, 137 | 4D7B4FD61A812755003D23E2 /* Frameworks */, 138 | 4D7B4FD71A812755003D23E2 /* Resources */, 139 | ); 140 | buildRules = ( 141 | ); 142 | dependencies = ( 143 | ); 144 | name = NSSharingPickerTest; 145 | productName = NSSharingPickerTest; 146 | productReference = 4D7B4FD91A812755003D23E2 /* NSSharingPickerTest.app */; 147 | productType = "com.apple.product-type.application"; 148 | }; 149 | 4D7B4FEB1A812755003D23E2 /* NSSharingPickerTestTests */ = { 150 | isa = PBXNativeTarget; 151 | buildConfigurationList = 4D7B4FF91A812755003D23E2 /* Build configuration list for PBXNativeTarget "NSSharingPickerTestTests" */; 152 | buildPhases = ( 153 | 4D7B4FE81A812755003D23E2 /* Sources */, 154 | 4D7B4FE91A812755003D23E2 /* Frameworks */, 155 | 4D7B4FEA1A812755003D23E2 /* Resources */, 156 | ); 157 | buildRules = ( 158 | ); 159 | dependencies = ( 160 | 4D7B4FEE1A812755003D23E2 /* PBXTargetDependency */, 161 | ); 162 | name = NSSharingPickerTestTests; 163 | productName = NSSharingPickerTestTests; 164 | productReference = 4D7B4FEC1A812755003D23E2 /* NSSharingPickerTestTests.xctest */; 165 | productType = "com.apple.product-type.bundle.unit-test"; 166 | }; 167 | /* End PBXNativeTarget section */ 168 | 169 | /* Begin PBXProject section */ 170 | 4D7B4FD11A812755003D23E2 /* Project object */ = { 171 | isa = PBXProject; 172 | attributes = { 173 | LastUpgradeCheck = 0900; 174 | ORGANIZATIONNAME = "iwascoding GmbH"; 175 | TargetAttributes = { 176 | 4D7B4FD81A812755003D23E2 = { 177 | CreatedOnToolsVersion = 6.1.1; 178 | }; 179 | 4D7B4FEB1A812755003D23E2 = { 180 | CreatedOnToolsVersion = 6.1.1; 181 | TestTargetID = 4D7B4FD81A812755003D23E2; 182 | }; 183 | }; 184 | }; 185 | buildConfigurationList = 4D7B4FD41A812755003D23E2 /* Build configuration list for PBXProject "NSSharingPickerTest" */; 186 | compatibilityVersion = "Xcode 3.2"; 187 | developmentRegion = English; 188 | hasScannedForEncodings = 0; 189 | knownRegions = ( 190 | en, 191 | Base, 192 | ); 193 | mainGroup = 4D7B4FD01A812755003D23E2; 194 | productRefGroup = 4D7B4FDA1A812755003D23E2 /* Products */; 195 | projectDirPath = ""; 196 | projectRoot = ""; 197 | targets = ( 198 | 4D7B4FD81A812755003D23E2 /* NSSharingPickerTest */, 199 | 4D7B4FEB1A812755003D23E2 /* NSSharingPickerTestTests */, 200 | ); 201 | }; 202 | /* End PBXProject section */ 203 | 204 | /* Begin PBXResourcesBuildPhase section */ 205 | 4D7B4FD71A812755003D23E2 /* Resources */ = { 206 | isa = PBXResourcesBuildPhase; 207 | buildActionMask = 2147483647; 208 | files = ( 209 | 4D7B4FFD1A81280A003D23E2 /* IMG_4996.PNG in Resources */, 210 | 4D7B4FE41A812755003D23E2 /* Images.xcassets in Resources */, 211 | 4D7B4FE71A812755003D23E2 /* MainMenu.xib in Resources */, 212 | ); 213 | runOnlyForDeploymentPostprocessing = 0; 214 | }; 215 | 4D7B4FEA1A812755003D23E2 /* Resources */ = { 216 | isa = PBXResourcesBuildPhase; 217 | buildActionMask = 2147483647; 218 | files = ( 219 | ); 220 | runOnlyForDeploymentPostprocessing = 0; 221 | }; 222 | /* End PBXResourcesBuildPhase section */ 223 | 224 | /* Begin PBXSourcesBuildPhase section */ 225 | 4D7B4FD51A812755003D23E2 /* Sources */ = { 226 | isa = PBXSourcesBuildPhase; 227 | buildActionMask = 2147483647; 228 | files = ( 229 | 03E208DD1F94A4C4000B553E /* InvokeSpecificSharingPicker.m in Sources */, 230 | 4D7B4FE21A812755003D23E2 /* main.m in Sources */, 231 | 4D7B4FE01A812755003D23E2 /* AppDelegate.m in Sources */, 232 | D45682351D6B5DED000FEE84 /* ShareRolloverView.m in Sources */, 233 | ); 234 | runOnlyForDeploymentPostprocessing = 0; 235 | }; 236 | 4D7B4FE81A812755003D23E2 /* Sources */ = { 237 | isa = PBXSourcesBuildPhase; 238 | buildActionMask = 2147483647; 239 | files = ( 240 | 4D7B4FF31A812755003D23E2 /* NSSharingPickerTestTests.m in Sources */, 241 | ); 242 | runOnlyForDeploymentPostprocessing = 0; 243 | }; 244 | /* End PBXSourcesBuildPhase section */ 245 | 246 | /* Begin PBXTargetDependency section */ 247 | 4D7B4FEE1A812755003D23E2 /* PBXTargetDependency */ = { 248 | isa = PBXTargetDependency; 249 | target = 4D7B4FD81A812755003D23E2 /* NSSharingPickerTest */; 250 | targetProxy = 4D7B4FED1A812755003D23E2 /* PBXContainerItemProxy */; 251 | }; 252 | /* End PBXTargetDependency section */ 253 | 254 | /* Begin PBXVariantGroup section */ 255 | 4D7B4FE51A812755003D23E2 /* MainMenu.xib */ = { 256 | isa = PBXVariantGroup; 257 | children = ( 258 | 4D7B4FE61A812755003D23E2 /* Base */, 259 | ); 260 | name = MainMenu.xib; 261 | sourceTree = ""; 262 | }; 263 | /* End PBXVariantGroup section */ 264 | 265 | /* Begin XCBuildConfiguration section */ 266 | 4D7B4FF41A812755003D23E2 /* Debug */ = { 267 | isa = XCBuildConfiguration; 268 | buildSettings = { 269 | ALWAYS_SEARCH_USER_PATHS = NO; 270 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 271 | CLANG_CXX_LIBRARY = "libc++"; 272 | CLANG_ENABLE_MODULES = YES; 273 | CLANG_ENABLE_OBJC_ARC = YES; 274 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 275 | CLANG_WARN_BOOL_CONVERSION = YES; 276 | CLANG_WARN_COMMA = YES; 277 | CLANG_WARN_CONSTANT_CONVERSION = YES; 278 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 279 | CLANG_WARN_EMPTY_BODY = YES; 280 | CLANG_WARN_ENUM_CONVERSION = YES; 281 | CLANG_WARN_INFINITE_RECURSION = YES; 282 | CLANG_WARN_INT_CONVERSION = YES; 283 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 284 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 285 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 286 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 287 | CLANG_WARN_STRICT_PROTOTYPES = YES; 288 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 289 | CLANG_WARN_UNREACHABLE_CODE = YES; 290 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 291 | CODE_SIGN_IDENTITY = "-"; 292 | COPY_PHASE_STRIP = NO; 293 | ENABLE_STRICT_OBJC_MSGSEND = YES; 294 | ENABLE_TESTABILITY = YES; 295 | GCC_C_LANGUAGE_STANDARD = gnu99; 296 | GCC_DYNAMIC_NO_PIC = NO; 297 | GCC_NO_COMMON_BLOCKS = YES; 298 | GCC_OPTIMIZATION_LEVEL = 0; 299 | GCC_PREPROCESSOR_DEFINITIONS = ( 300 | "DEBUG=1", 301 | "$(inherited)", 302 | ); 303 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 304 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 305 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 306 | GCC_WARN_UNDECLARED_SELECTOR = YES; 307 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 308 | GCC_WARN_UNUSED_FUNCTION = YES; 309 | GCC_WARN_UNUSED_VARIABLE = YES; 310 | MACOSX_DEPLOYMENT_TARGET = 10.10; 311 | MTL_ENABLE_DEBUG_INFO = YES; 312 | ONLY_ACTIVE_ARCH = YES; 313 | SDKROOT = macosx; 314 | }; 315 | name = Debug; 316 | }; 317 | 4D7B4FF51A812755003D23E2 /* Release */ = { 318 | isa = XCBuildConfiguration; 319 | buildSettings = { 320 | ALWAYS_SEARCH_USER_PATHS = NO; 321 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 322 | CLANG_CXX_LIBRARY = "libc++"; 323 | CLANG_ENABLE_MODULES = YES; 324 | CLANG_ENABLE_OBJC_ARC = YES; 325 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 326 | CLANG_WARN_BOOL_CONVERSION = YES; 327 | CLANG_WARN_COMMA = YES; 328 | CLANG_WARN_CONSTANT_CONVERSION = YES; 329 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 330 | CLANG_WARN_EMPTY_BODY = YES; 331 | CLANG_WARN_ENUM_CONVERSION = YES; 332 | CLANG_WARN_INFINITE_RECURSION = YES; 333 | CLANG_WARN_INT_CONVERSION = YES; 334 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 335 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 336 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 337 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 338 | CLANG_WARN_STRICT_PROTOTYPES = YES; 339 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 340 | CLANG_WARN_UNREACHABLE_CODE = YES; 341 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 342 | CODE_SIGN_IDENTITY = "-"; 343 | COPY_PHASE_STRIP = YES; 344 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 345 | ENABLE_NS_ASSERTIONS = NO; 346 | ENABLE_STRICT_OBJC_MSGSEND = YES; 347 | GCC_C_LANGUAGE_STANDARD = gnu99; 348 | GCC_NO_COMMON_BLOCKS = YES; 349 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 350 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 351 | GCC_WARN_UNDECLARED_SELECTOR = YES; 352 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 353 | GCC_WARN_UNUSED_FUNCTION = YES; 354 | GCC_WARN_UNUSED_VARIABLE = YES; 355 | MACOSX_DEPLOYMENT_TARGET = 10.10; 356 | MTL_ENABLE_DEBUG_INFO = NO; 357 | SDKROOT = macosx; 358 | }; 359 | name = Release; 360 | }; 361 | 4D7B4FF71A812755003D23E2 /* Debug */ = { 362 | isa = XCBuildConfiguration; 363 | buildSettings = { 364 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 365 | COMBINE_HIDPI_IMAGES = YES; 366 | INFOPLIST_FILE = NSSharingPickerTest/Info.plist; 367 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; 368 | PRODUCT_BUNDLE_IDENTIFIER = "com.iwascoding.$(PRODUCT_NAME:rfc1034identifier)"; 369 | PRODUCT_NAME = "$(TARGET_NAME)"; 370 | }; 371 | name = Debug; 372 | }; 373 | 4D7B4FF81A812755003D23E2 /* Release */ = { 374 | isa = XCBuildConfiguration; 375 | buildSettings = { 376 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 377 | COMBINE_HIDPI_IMAGES = YES; 378 | INFOPLIST_FILE = NSSharingPickerTest/Info.plist; 379 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; 380 | PRODUCT_BUNDLE_IDENTIFIER = "com.iwascoding.$(PRODUCT_NAME:rfc1034identifier)"; 381 | PRODUCT_NAME = "$(TARGET_NAME)"; 382 | }; 383 | name = Release; 384 | }; 385 | 4D7B4FFA1A812755003D23E2 /* Debug */ = { 386 | isa = XCBuildConfiguration; 387 | buildSettings = { 388 | BUNDLE_LOADER = "$(TEST_HOST)"; 389 | COMBINE_HIDPI_IMAGES = YES; 390 | FRAMEWORK_SEARCH_PATHS = ( 391 | "$(DEVELOPER_FRAMEWORKS_DIR)", 392 | "$(inherited)", 393 | ); 394 | GCC_PREPROCESSOR_DEFINITIONS = ( 395 | "DEBUG=1", 396 | "$(inherited)", 397 | ); 398 | INFOPLIST_FILE = NSSharingPickerTestTests/Info.plist; 399 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; 400 | PRODUCT_BUNDLE_IDENTIFIER = "com.iwascoding.$(PRODUCT_NAME:rfc1034identifier)"; 401 | PRODUCT_NAME = "$(TARGET_NAME)"; 402 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/NSSharingPickerTest.app/Contents/MacOS/NSSharingPickerTest"; 403 | }; 404 | name = Debug; 405 | }; 406 | 4D7B4FFB1A812755003D23E2 /* Release */ = { 407 | isa = XCBuildConfiguration; 408 | buildSettings = { 409 | BUNDLE_LOADER = "$(TEST_HOST)"; 410 | COMBINE_HIDPI_IMAGES = YES; 411 | FRAMEWORK_SEARCH_PATHS = ( 412 | "$(DEVELOPER_FRAMEWORKS_DIR)", 413 | "$(inherited)", 414 | ); 415 | INFOPLIST_FILE = NSSharingPickerTestTests/Info.plist; 416 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; 417 | PRODUCT_BUNDLE_IDENTIFIER = "com.iwascoding.$(PRODUCT_NAME:rfc1034identifier)"; 418 | PRODUCT_NAME = "$(TARGET_NAME)"; 419 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/NSSharingPickerTest.app/Contents/MacOS/NSSharingPickerTest"; 420 | }; 421 | name = Release; 422 | }; 423 | /* End XCBuildConfiguration section */ 424 | 425 | /* Begin XCConfigurationList section */ 426 | 4D7B4FD41A812755003D23E2 /* Build configuration list for PBXProject "NSSharingPickerTest" */ = { 427 | isa = XCConfigurationList; 428 | buildConfigurations = ( 429 | 4D7B4FF41A812755003D23E2 /* Debug */, 430 | 4D7B4FF51A812755003D23E2 /* Release */, 431 | ); 432 | defaultConfigurationIsVisible = 0; 433 | defaultConfigurationName = Release; 434 | }; 435 | 4D7B4FF61A812755003D23E2 /* Build configuration list for PBXNativeTarget "NSSharingPickerTest" */ = { 436 | isa = XCConfigurationList; 437 | buildConfigurations = ( 438 | 4D7B4FF71A812755003D23E2 /* Debug */, 439 | 4D7B4FF81A812755003D23E2 /* Release */, 440 | ); 441 | defaultConfigurationIsVisible = 0; 442 | defaultConfigurationName = Release; 443 | }; 444 | 4D7B4FF91A812755003D23E2 /* Build configuration list for PBXNativeTarget "NSSharingPickerTestTests" */ = { 445 | isa = XCConfigurationList; 446 | buildConfigurations = ( 447 | 4D7B4FFA1A812755003D23E2 /* Debug */, 448 | 4D7B4FFB1A812755003D23E2 /* Release */, 449 | ); 450 | defaultConfigurationIsVisible = 0; 451 | defaultConfigurationName = Release; 452 | }; 453 | /* End XCConfigurationList section */ 454 | }; 455 | rootObject = 4D7B4FD11A812755003D23E2 /* Project object */; 456 | } 457 | -------------------------------------------------------------------------------- /NSSharingPickerTest.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /NSSharingPickerTest/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // NSSharingPickerTest 4 | // 5 | // Created by ilja on 03.02.15. 6 | // Copyright (c) 2015 iwascoding GmbH. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "InvokeSpecificSharingPicker.h" 12 | 13 | @interface AppDelegate : NSObject 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /NSSharingPickerTest/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // NSSharingPickerTest 4 | // 5 | // Created by ilja on 03.02.15. 6 | // Copyright (c) 2015 iwascoding GmbH. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "ShareRolloverView.h" 11 | 12 | @interface AppDelegate () 13 | 14 | @property (weak) IBOutlet NSWindow *window; 15 | @property (weak) IBOutlet NSImageView *imageView; 16 | 17 | @end 18 | 19 | @implementation AppDelegate 20 | 21 | #pragma mark - Share rollover view delegate 22 | 23 | - (NSArray *)itemsForShareRolloverView:(ShareRolloverView *)view { 24 | return @[[self.imageView image]]; 25 | } 26 | 27 | - (NSImage *)transitionImageForShareRolloverView:(ShareRolloverView *)view { 28 | return [self.imageView image]; 29 | } 30 | 31 | - (void)shareRolloverView:(ShareRolloverView *)view didShareItems:(NSArray *)items { 32 | [self writeSharedItems:(NSArray *)items]; 33 | } 34 | 35 | #pragma mark - Invoke specific sharing picker delegate 36 | 37 | - (void)invokeSpecificSharingPicker:(InvokeSpecificSharingPicker *)picker didShareItems:(NSArray *)items { 38 | [self writeSharedItems:(NSArray *)items]; 39 | } 40 | 41 | #pragma mark - Common 42 | 43 | - (void)writeSharedItems:(NSArray *)items { 44 | NSItemProvider *itemProvider = items[0]; 45 | 46 | NSItemProviderCompletionHandler itemHandler = ^(NSData *item, NSError *error) { 47 | if (error) { 48 | NSLog(@"%@", error.localizedDescription); 49 | } 50 | NSBitmapImageRep *bitmap = [NSBitmapImageRep imageRepWithData:item]; 51 | NSData *data = [bitmap representationUsingType:NSPNGFileType properties:@{}]; 52 | 53 | NSError *fileWriteError; 54 | if ([data writeToFile:@"/tmp/IMG.PNG" options:0 error:&fileWriteError]) { 55 | self.imageView.image = [[NSImage alloc] initWithContentsOfFile:@"/tmp/IMG.PNG"]; 56 | } 57 | }; 58 | 59 | [itemProvider loadItemForTypeIdentifier:[itemProvider registeredTypeIdentifiers][0] options:nil completionHandler:itemHandler]; 60 | } 61 | 62 | #pragma mark - UI 63 | 64 | - (IBAction)markupClicked:(id)sender { 65 | InvokeSpecificSharingPicker *invokeSpecificSharingPicker = [[InvokeSpecificSharingPicker alloc] init]; 66 | invokeSpecificSharingPicker.delegate = self; 67 | [invokeSpecificSharingPicker invokePicker:@"Markup" onObject:self.imageView.image showRelativeToRect:NSMakeRect(0, 0, 100, 100) ofView:self.window.contentView]; 68 | } 69 | 70 | 71 | @end 72 | -------------------------------------------------------------------------------- /NSSharingPickerTest/Base.lproj/MainMenu.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 519 | 520 | 521 | 522 | 523 | 524 | 525 | 526 | 527 | 528 | 529 | 530 | 531 | 532 | 533 | 534 | 535 | 536 | 537 | 538 | 539 | 540 | 541 | Default 542 | 543 | 544 | 545 | 546 | 547 | 548 | Left to Right 549 | 550 | 551 | 552 | 553 | 554 | 555 | Right to Left 556 | 557 | 558 | 559 | 560 | 561 | 562 | 563 | 564 | 565 | 566 | Default 567 | 568 | 569 | 570 | 571 | 572 | 573 | Left to Right 574 | 575 | 576 | 577 | 578 | 579 | 580 | Right to Left 581 | 582 | 583 | 584 | 585 | 586 | 587 | 588 | 589 | 590 | 591 | 592 | 593 | 594 | 595 | 596 | 597 | 598 | 599 | 600 | 601 | 602 | 603 | 604 | 605 | 606 | 607 | 608 | 609 | 610 | 611 | 612 | 613 | 614 | 615 | 616 | 617 | 618 | 619 | 620 | 621 | 622 | 623 | 624 | 625 | 626 | 627 | 628 | 629 | 630 | 631 | 632 | 633 | 634 | 635 | 636 | 637 | 638 | 639 | 640 | 641 | 642 | 643 | 644 | 645 | 646 | 647 | 648 | 649 | 650 | 651 | 652 | 653 | 654 | 655 | 656 | 657 | 658 | 659 | 660 | 661 | 662 | 663 | 664 | 665 | 666 | 667 | 668 | 669 | 670 | 671 | 672 | 673 | 674 | 675 | 676 | 677 | 678 | 679 | 680 | 681 | 682 | 683 | 684 | 685 | 686 | 687 | 688 | 689 | 690 | 691 | 692 | 693 | 694 | 695 | 696 | 697 | 698 | 699 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | -------------------------------------------------------------------------------- /NSSharingPickerTest/IMG_4996.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iljaiwas/NSSharingPickerTest/a6dc197cc96f3416dc2d329b80cb2ee50c9c69e2/NSSharingPickerTest/IMG_4996.PNG -------------------------------------------------------------------------------- /NSSharingPickerTest/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "mac", 5 | "size" : "16x16", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "mac", 10 | "size" : "16x16", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "mac", 15 | "size" : "32x32", 16 | "scale" : "1x" 17 | }, 18 | { 19 | "idiom" : "mac", 20 | "size" : "32x32", 21 | "scale" : "2x" 22 | }, 23 | { 24 | "idiom" : "mac", 25 | "size" : "128x128", 26 | "scale" : "1x" 27 | }, 28 | { 29 | "idiom" : "mac", 30 | "size" : "128x128", 31 | "scale" : "2x" 32 | }, 33 | { 34 | "idiom" : "mac", 35 | "size" : "256x256", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "mac", 40 | "size" : "256x256", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "mac", 45 | "size" : "512x512", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "mac", 50 | "size" : "512x512", 51 | "scale" : "2x" 52 | } 53 | ], 54 | "info" : { 55 | "version" : 1, 56 | "author" : "xcode" 57 | } 58 | } -------------------------------------------------------------------------------- /NSSharingPickerTest/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSMinimumSystemVersion 26 | $(MACOSX_DEPLOYMENT_TARGET) 27 | NSHumanReadableCopyright 28 | Copyright © 2015 iwascoding GmbH. All rights reserved. 29 | NSMainNibFile 30 | MainMenu 31 | NSPrincipalClass 32 | NSApplication 33 | 34 | 35 | -------------------------------------------------------------------------------- /NSSharingPickerTest/InvokeSpecificSharingPicker.h: -------------------------------------------------------------------------------- 1 | // 2 | // InvokeSpecificSharingPicker.h 3 | // NSSharingPickerTest 4 | // 5 | // Created by Josh Parnham on 16/10/17. 6 | // Copyright © 2017 iwascoding GmbH. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @protocol InvokeSpecificSharingPickerDelegate; 12 | 13 | @interface InvokeSpecificSharingPicker : NSObject 14 | 15 | - (void)invokePicker:(NSString *)pickerTitle onObject:(id)object showRelativeToRect:(NSRect)rect ofView:(NSView *)view; 16 | 17 | @property (nonatomic, weak) id delegate; 18 | 19 | @end 20 | 21 | @protocol InvokeSpecificSharingPickerDelegate 22 | 23 | - (void)invokeSpecificSharingPicker:(InvokeSpecificSharingPicker *)picker didShareItems:(NSArray *)items; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /NSSharingPickerTest/InvokeSpecificSharingPicker.m: -------------------------------------------------------------------------------- 1 | // 2 | // InvokeSpecificSharingPicker.m 3 | // NSSharingPickerTest 4 | // 5 | // Created by Josh Parnham on 16/10/17. 6 | // Copyright © 2017 iwascoding GmbH. All rights reserved. 7 | // 8 | 9 | #import "InvokeSpecificSharingPicker.h" 10 | #import "NSSharingServicePicker+Private.h" 11 | 12 | @interface InvokeSpecificSharingPicker () 13 | 14 | @property (strong, nonatomic) NSArray *actionExtensionsArray; 15 | 16 | @end 17 | 18 | @implementation InvokeSpecificSharingPicker 19 | 20 | - (void)invokePicker:(NSString *)pickerTitle onObject:(id)object showRelativeToRect:(NSRect)rect ofView:(NSView *)view { 21 | NSSharingServicePicker *sharingServicePicker = [[NSSharingServicePicker alloc] initWithItems:@[object]]; 22 | sharingServicePicker.style = 1; 23 | sharingServicePicker.delegate = self; 24 | [sharingServicePicker showRelativeToRect:rect ofView:view preferredEdge:1]; 25 | 26 | if (self.actionExtensionsArray) { 27 | for (NSSharingService *service in self.actionExtensionsArray) { 28 | if ([service.title isEqualTo:pickerTitle]) { 29 | service.delegate = self; 30 | [service performWithItems:@[object]]; 31 | } 32 | } 33 | } 34 | } 35 | 36 | - (NSArray *)sharingServicePicker:(NSSharingServicePicker *)sharingServicePicker sharingServicesForItems:(NSArray *)items proposedSharingServices:(NSArray *)proposedServices { 37 | self.actionExtensionsArray = proposedServices; 38 | return proposedServices; 39 | } 40 | 41 | - (void)sharingService:(NSSharingService *)sharingService didFailToShareItems:(NSArray *)items error:(NSError *)error { 42 | NSLog(@"sharingService:didFailToShareItems:"); 43 | } 44 | 45 | - (void)sharingService:(NSSharingService *)sharingService didShareItems:(NSArray *)items { 46 | NSLog(@"sharingService:didShareItems:"); 47 | 48 | [self.delegate invokeSpecificSharingPicker:self didShareItems:items]; 49 | } 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /NSSharingPickerTest/NSSharingServicePicker+Private.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSSharingServicePicker+Private.h 3 | // NSSharingPickerTest 4 | // 5 | // Created by Josh Parnham on 16/10/17. 6 | // Copyright © 2017 iwascoding GmbH. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NSSharingServicePicker (private) 12 | 13 | @property (nonatomic) NSUInteger style; 14 | @property (nonatomic, strong, readonly) NSButtonCell *rolloverButtonCell; 15 | 16 | - (void)hide; 17 | 18 | - (NSRect)rectForBounds:(NSRect)bounds preferredEdge:(NSRectEdge)preferredEdge; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /NSSharingPickerTest/ShareRolloverView.h: -------------------------------------------------------------------------------- 1 | // 2 | // ShareRolloverView.h 3 | // NSSharingPickerTest 4 | // 5 | // Created by Stephan Michels on 22.08.16. 6 | // Copyright © 2016 iwascoding GmbH. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @protocol ShareRolloverView; 12 | 13 | @interface ShareRolloverView : NSView 14 | 15 | @property (nonatomic, weak) IBOutlet id delegate; 16 | 17 | @end 18 | 19 | @protocol ShareRolloverView 20 | 21 | - (NSArray *)itemsForShareRolloverView:(ShareRolloverView *)view; 22 | - (NSImage *)transitionImageForShareRolloverView:(ShareRolloverView *)view; 23 | - (void)shareRolloverView:(ShareRolloverView *)view didShareItems:(NSArray *)items; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /NSSharingPickerTest/ShareRolloverView.m: -------------------------------------------------------------------------------- 1 | // 2 | // ShareRolloverView.m 3 | // NSSharingPickerTest 4 | // 5 | // Created by Stephan Michels on 22.08.16. 6 | // Copyright © 2016 iwascoding GmbH. All rights reserved. 7 | // 8 | 9 | #import "ShareRolloverView.h" 10 | #import "NSSharingServicePicker+Private.h" 11 | 12 | @interface ShareRolloverView () 13 | 14 | @property (nonatomic, strong) NSTrackingArea *trackingArea; 15 | @property (nonatomic) BOOL mouseInside; 16 | 17 | @property (nonatomic, strong) NSSharingServicePicker *picker; 18 | 19 | @end 20 | 21 | @implementation ShareRolloverView 22 | 23 | - (instancetype)initWithFrame:(NSRect)frame { 24 | if (!(self = [super initWithFrame:frame])) return nil; 25 | 26 | NSTrackingArea *trackingArea = [[NSTrackingArea alloc] initWithRect:NSZeroRect options:NSTrackingMouseEnteredAndExited|NSTrackingActiveInActiveApp|NSTrackingInVisibleRect owner:self userInfo:nil]; 27 | [self addTrackingArea:trackingArea]; 28 | self.trackingArea = trackingArea; 29 | 30 | return self; 31 | } 32 | 33 | - (void)mouseEntered:(NSEvent *)event { 34 | if (event.trackingArea != self.trackingArea) { 35 | [super mouseEntered:event]; 36 | return; 37 | } 38 | 39 | self.mouseInside = YES; 40 | NSSharingServicePicker *picker = self.picker; 41 | NSRect rect = self.visibleRect; 42 | [picker showRelativeToRect:rect ofView:self preferredEdge:NSMinYEdge]; 43 | } 44 | 45 | - (void)mouseExited:(NSEvent *)event { 46 | if (event.trackingArea != self.trackingArea) { 47 | [super mouseExited:event]; 48 | return; 49 | } 50 | 51 | self.mouseInside = NO; 52 | NSSharingServicePicker *picker = self.picker; 53 | [picker hide]; 54 | } 55 | 56 | - (BOOL)isFlipped { 57 | return YES; 58 | } 59 | 60 | - (NSView *)hitTest:(NSPoint)point { 61 | NSView *superView = self.superview; 62 | point = [self convertPoint:point fromView:superView]; 63 | 64 | NSSharingServicePicker *picker = self.picker; 65 | NSRect bounds = self.bounds; 66 | NSRect rect = [picker rectForBounds:bounds preferredEdge:NSMinYEdge]; 67 | 68 | if (NSPointInRect(point, rect)) { 69 | return self; 70 | } 71 | return nil; 72 | } 73 | 74 | - (void)mouseDown:(NSEvent *)event { 75 | NSSharingServicePicker *picker = self.picker; 76 | NSButtonCell *rolloverButtonCell = picker.rolloverButtonCell; 77 | 78 | NSPoint point = [self convertPoint:event.locationInWindow fromView:nil]; 79 | 80 | NSRect bounds = self.bounds; 81 | NSRect rect = [picker rectForBounds:bounds preferredEdge:NSMinYEdge]; 82 | 83 | if (NSPointInRect(point, rect)) { 84 | [rolloverButtonCell trackMouse:event inRect:rect ofView:self untilMouseUp:YES]; 85 | } 86 | } 87 | 88 | - (NSSharingServicePicker *)picker { 89 | NSSharingServicePicker *picker = _picker; 90 | if (!picker) { 91 | id delegate = self.delegate; 92 | if (delegate) { 93 | NSArray *items = [delegate itemsForShareRolloverView:self]; 94 | if (items.count > 0) { 95 | picker = [[NSSharingServicePicker alloc] initWithItems:items]; 96 | if (picker) { 97 | picker.style = 1; 98 | picker.delegate = self; 99 | _picker = picker; 100 | } 101 | } 102 | } 103 | } 104 | return picker; 105 | } 106 | 107 | - (id)sharingServicePicker:(NSSharingServicePicker *)sharingServicePicker delegateForSharingService:(NSSharingService *)sharingService { 108 | return self; 109 | } 110 | 111 | - (NSRect)sharingService:(NSSharingService *)sharingService sourceFrameOnScreenForShareItem:(id )item { 112 | NSRect frame = self.bounds; 113 | frame = [self convertRect:frame toView:nil]; 114 | frame = [self.window convertRectToScreen:frame]; 115 | return frame; 116 | } 117 | 118 | - (NSWindow*)sharingService:(NSSharingService *)sharingService sourceWindowForShareItems:(NSArray *)items sharingContentScope:(NSSharingContentScope *)sharingContentScope { 119 | return self.window; 120 | } 121 | 122 | - (NSImage*)sharingService:(NSSharingService *)sharingService transitionImageForShareItem:(id)item contentRect:(NSRect *)contentRect { 123 | return [self.delegate transitionImageForShareRolloverView:self]; 124 | } 125 | 126 | - (BOOL)sharingServicePicker:(NSSharingServicePicker *)sharingService shouldShowForView:(NSView*) inView { 127 | return YES; 128 | } 129 | 130 | - (void)sharingService:(NSSharingService *)sharingService didFailToShareItems:(NSArray *)items error:(NSError *)error { 131 | NSLog(@"sharingService:didFailToShareItems:"); 132 | } 133 | 134 | - (void)sharingService:(NSSharingService *)sharingService didShareItems:(NSArray *)items { 135 | NSLog(@"sharingService:didShareItems:"); 136 | 137 | [self.delegate shareRolloverView:self didShareItems:items]; 138 | 139 | // reset picker for new items 140 | self.picker = nil; 141 | } 142 | 143 | @end 144 | -------------------------------------------------------------------------------- /NSSharingPickerTest/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // NSSharingPickerTest 4 | // 5 | // Created by ilja on 03.02.15. 6 | // Copyright (c) 2015 iwascoding GmbH. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, const char * argv[]) { 12 | return NSApplicationMain(argc, argv); 13 | } 14 | -------------------------------------------------------------------------------- /NSSharingPickerTestTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /NSSharingPickerTestTests/NSSharingPickerTestTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSSharingPickerTestTests.m 3 | // NSSharingPickerTestTests 4 | // 5 | // Created by ilja on 03.02.15. 6 | // Copyright (c) 2015 iwascoding GmbH. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface NSSharingPickerTestTests : XCTestCase 13 | 14 | @end 15 | 16 | @implementation NSSharingPickerTestTests 17 | 18 | - (void)setUp { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown { 24 | // Put teardown code here. This method is called after the invocation of each test method in the class. 25 | [super tearDown]; 26 | } 27 | 28 | - (void)testExample { 29 | // This is an example of a functional test case. 30 | XCTAssert(YES, @"Pass"); 31 | } 32 | 33 | - (void)testPerformanceExample { 34 | // This is an example of a performance test case. 35 | [self measureBlock:^{ 36 | // Put the code you want to measure the time of here. 37 | }]; 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # NSSharingPickerTest 2 | 3 | A simple demo how you can use Action Extensions within you own application using the NSSharingServicePicker. 4 | 5 | ![Screenshot](screenshot.png) 6 | -------------------------------------------------------------------------------- /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iljaiwas/NSSharingPickerTest/a6dc197cc96f3416dc2d329b80cb2ee50c9c69e2/screenshot.png --------------------------------------------------------------------------------