├── .gitignore ├── .swift-version ├── JLYoutubeActivity.podspec ├── JLYoutubeActivity ├── JLYoutubeActivity.bundle │ ├── youtube-7.png │ ├── youtube-7@2x.png │ ├── youtube-7@2x~iPad.png │ ├── youtube-7@3x.png │ ├── youtube-7~iPad.png │ ├── youtube.png │ ├── youtube@2x.png │ ├── youtube@2x~iPad.png │ ├── youtube@3x.png │ └── youtube~iPad.png └── JLYoutubeActivity.swift ├── JLYoutubeActivityDemo ├── JLYoutubeActivityDemo.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── JLYoutubeActivityDemo │ ├── AppDelegate.swift │ ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── Info.plist │ └── ViewController.swift ├── LICENSE ├── README.md └── ScreenShorts ├── 1.png └── 2.png /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | build/ 4 | *.pbxuser 5 | !default.pbxuser 6 | *.mode1v3 7 | !default.mode1v3 8 | *.mode2v3 9 | !default.mode2v3 10 | *.perspectivev3 11 | !default.perspectivev3 12 | xcuserdata 13 | *.xccheckout 14 | *.moved-aside 15 | DerivedData 16 | *.hmap 17 | *.ipa 18 | *.xcuserstate 19 | 20 | # CocoaPods 21 | # 22 | # We recommend against adding the Pods directory to your .gitignore. However 23 | # you should judge for yourself, the pros and cons are mentioned at: 24 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 25 | # 26 | #Pods/ 27 | -------------------------------------------------------------------------------- /.swift-version: -------------------------------------------------------------------------------- 1 | 4.0 2 | -------------------------------------------------------------------------------- /JLYoutubeActivity.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "JLYoutubeActivity" 3 | s.version = "2.0" 4 | s.summary = "JLYoutubeActivity" 5 | s.homepage = "https://github.com/jangsy7883/JLYoutubeActivity" 6 | s.license = { :type => 'MIT', :file => 'LICENSE' } 7 | s.author = { "hmhv" => "jangsy7883@gmail.com" } 8 | s.source = { :git => "https://github.com/jangsy7883/JLYoutubeActivity.git", :tag => s.version } 9 | s.source_files = 'JLYoutubeActivity/*.{swift}' 10 | s.resources = 'JLYoutubeActivity/*.bundle' 11 | s.requires_arc = true 12 | s.ios.deployment_target = '8.0' 13 | s.swift_version = '4.0' 14 | end 15 | -------------------------------------------------------------------------------- /JLYoutubeActivity/JLYoutubeActivity.bundle/youtube-7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jangsy7883/JLYouTubeActivity/5ce28fc01a92900ab3ae8f93bb1a6d78a4fb1324/JLYoutubeActivity/JLYoutubeActivity.bundle/youtube-7.png -------------------------------------------------------------------------------- /JLYoutubeActivity/JLYoutubeActivity.bundle/youtube-7@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jangsy7883/JLYouTubeActivity/5ce28fc01a92900ab3ae8f93bb1a6d78a4fb1324/JLYoutubeActivity/JLYoutubeActivity.bundle/youtube-7@2x.png -------------------------------------------------------------------------------- /JLYoutubeActivity/JLYoutubeActivity.bundle/youtube-7@2x~iPad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jangsy7883/JLYouTubeActivity/5ce28fc01a92900ab3ae8f93bb1a6d78a4fb1324/JLYoutubeActivity/JLYoutubeActivity.bundle/youtube-7@2x~iPad.png -------------------------------------------------------------------------------- /JLYoutubeActivity/JLYoutubeActivity.bundle/youtube-7@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jangsy7883/JLYouTubeActivity/5ce28fc01a92900ab3ae8f93bb1a6d78a4fb1324/JLYoutubeActivity/JLYoutubeActivity.bundle/youtube-7@3x.png -------------------------------------------------------------------------------- /JLYoutubeActivity/JLYoutubeActivity.bundle/youtube-7~iPad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jangsy7883/JLYouTubeActivity/5ce28fc01a92900ab3ae8f93bb1a6d78a4fb1324/JLYoutubeActivity/JLYoutubeActivity.bundle/youtube-7~iPad.png -------------------------------------------------------------------------------- /JLYoutubeActivity/JLYoutubeActivity.bundle/youtube.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jangsy7883/JLYouTubeActivity/5ce28fc01a92900ab3ae8f93bb1a6d78a4fb1324/JLYoutubeActivity/JLYoutubeActivity.bundle/youtube.png -------------------------------------------------------------------------------- /JLYoutubeActivity/JLYoutubeActivity.bundle/youtube@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jangsy7883/JLYouTubeActivity/5ce28fc01a92900ab3ae8f93bb1a6d78a4fb1324/JLYoutubeActivity/JLYoutubeActivity.bundle/youtube@2x.png -------------------------------------------------------------------------------- /JLYoutubeActivity/JLYoutubeActivity.bundle/youtube@2x~iPad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jangsy7883/JLYouTubeActivity/5ce28fc01a92900ab3ae8f93bb1a6d78a4fb1324/JLYoutubeActivity/JLYoutubeActivity.bundle/youtube@2x~iPad.png -------------------------------------------------------------------------------- /JLYoutubeActivity/JLYoutubeActivity.bundle/youtube@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jangsy7883/JLYouTubeActivity/5ce28fc01a92900ab3ae8f93bb1a6d78a4fb1324/JLYoutubeActivity/JLYoutubeActivity.bundle/youtube@3x.png -------------------------------------------------------------------------------- /JLYoutubeActivity/JLYoutubeActivity.bundle/youtube~iPad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jangsy7883/JLYouTubeActivity/5ce28fc01a92900ab3ae8f93bb1a6d78a4fb1324/JLYoutubeActivity/JLYoutubeActivity.bundle/youtube~iPad.png -------------------------------------------------------------------------------- /JLYoutubeActivity/JLYoutubeActivity.swift: -------------------------------------------------------------------------------- 1 | // 2 | // JLYoutubeActivity.swift 3 | // JLYoutubeActivityDemo 4 | // 5 | // Created by Woody on 2018. 4. 24.. 6 | // Copyright © 2018년 Woody. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class JLYoutubeActivity: UIActivity { 12 | var YoutubeURLSchema: String = "youtube://" 13 | var YoutubeBaseURL: String = "youtube://watch?v=" 14 | 15 | var url:URL? 16 | // override activity 17 | 18 | override var activityType: UIActivityType? { 19 | return UIActivityType(String(describing: self.self)) 20 | } 21 | 22 | override var activityTitle: String?{ 23 | return "Youtube" 24 | } 25 | 26 | override var activityImage: UIImage? { 27 | return UIImage(named: "JLYoutubeActivity.bundle/youtube", in: Bundle(for: JLYoutubeActivity.self), compatibleWith: nil) 28 | } 29 | 30 | override func canPerform(withActivityItems activityItems: [Any]) -> Bool { 31 | guard let opneURL = URL(string: YoutubeURLSchema) else { return false } 32 | 33 | if UIApplication.shared.canOpenURL(opneURL) { 34 | return activityItems.contains { (item) -> Bool in 35 | guard let url = item as? URL else { return false } 36 | return url.isYoutube 37 | } 38 | } 39 | return false 40 | } 41 | 42 | override func prepare(withActivityItems activityItems: [Any]) { 43 | for item in activityItems { 44 | if let url = item as? URL, let identifier = url.videoIdentifier { 45 | self.url = URL(string: YoutubeBaseURL+identifier) 46 | } 47 | } 48 | } 49 | 50 | override func perform() { 51 | guard let url = url else { return } 52 | 53 | if #available(iOS 10.0, *) { 54 | UIApplication.shared.open(url, options: [String:Any]()) { (success) in 55 | self.activityDidFinish(success) 56 | } 57 | } 58 | else { 59 | UIApplication.shared.openURL(url) 60 | } 61 | } 62 | 63 | } 64 | 65 | extension URL { 66 | fileprivate var videoIdentifier: String? { 67 | guard isYoutube != false else { return nil} 68 | 69 | if let identifier = parameters?["v"] { 70 | return identifier 71 | } 72 | return nil 73 | } 74 | 75 | fileprivate var isYoutube: Bool { 76 | if let feature = parameters?["feature"], feature == "youtu.be" { 77 | return true 78 | } 79 | return false 80 | } 81 | 82 | fileprivate var parameters: [String:String]? { 83 | guard let components = NSURLComponents(url: self, resolvingAgainstBaseURL: false) else { return nil } 84 | guard let items = components.queryItems, items.isEmpty == false else { return nil } 85 | 86 | var parameters = [String:String]() 87 | for item in items { 88 | if let value = item.value { 89 | parameters[item.name] = value 90 | } 91 | } 92 | return parameters; 93 | } 94 | 95 | } 96 | -------------------------------------------------------------------------------- /JLYoutubeActivityDemo/JLYoutubeActivityDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | EFE42DD21ED67F8200F1A49E /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = EFE42DD11ED67F8200F1A49E /* AppDelegate.swift */; }; 11 | EFE42DD41ED67F8200F1A49E /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EFE42DD31ED67F8200F1A49E /* ViewController.swift */; }; 12 | EFE42DD71ED67F8200F1A49E /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = EFE42DD51ED67F8200F1A49E /* Main.storyboard */; }; 13 | EFE42DD91ED67F8200F1A49E /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = EFE42DD81ED67F8200F1A49E /* Assets.xcassets */; }; 14 | EFE42DDC1ED67F8200F1A49E /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = EFE42DDA1ED67F8200F1A49E /* LaunchScreen.storyboard */; }; 15 | EFE42DF41ED6851A00F1A49E /* JLYoutubeActivity.bundle in Resources */ = {isa = PBXBuildFile; fileRef = EFE42DF01ED6851A00F1A49E /* JLYoutubeActivity.bundle */; }; 16 | EFE42DF61ED6851A00F1A49E /* JLYoutubeActivity.podspec in Resources */ = {isa = PBXBuildFile; fileRef = EFE42DF31ED6851A00F1A49E /* JLYoutubeActivity.podspec */; }; 17 | EFE8533D208F025C00859E98 /* JLYoutubeActivity.swift in Sources */ = {isa = PBXBuildFile; fileRef = EFE8533C208F025C00859E98 /* JLYoutubeActivity.swift */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXFileReference section */ 21 | EFE42DCE1ED67F8200F1A49E /* JLYoutubeActivityDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = JLYoutubeActivityDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 22 | EFE42DD11ED67F8200F1A49E /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 23 | EFE42DD31ED67F8200F1A49E /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 24 | EFE42DD61ED67F8200F1A49E /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 25 | EFE42DD81ED67F8200F1A49E /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 26 | EFE42DDB1ED67F8200F1A49E /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 27 | EFE42DDD1ED67F8200F1A49E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 28 | EFE42DF01ED6851A00F1A49E /* JLYoutubeActivity.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = JLYoutubeActivity.bundle; sourceTree = ""; }; 29 | EFE42DF31ED6851A00F1A49E /* JLYoutubeActivity.podspec */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = JLYoutubeActivity.podspec; path = ../JLYoutubeActivity.podspec; sourceTree = ""; }; 30 | EFE8533C208F025C00859E98 /* JLYoutubeActivity.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JLYoutubeActivity.swift; sourceTree = ""; }; 31 | /* End PBXFileReference section */ 32 | 33 | /* Begin PBXFrameworksBuildPhase section */ 34 | EFE42DCB1ED67F8200F1A49E /* Frameworks */ = { 35 | isa = PBXFrameworksBuildPhase; 36 | buildActionMask = 2147483647; 37 | files = ( 38 | ); 39 | runOnlyForDeploymentPostprocessing = 0; 40 | }; 41 | /* End PBXFrameworksBuildPhase section */ 42 | 43 | /* Begin PBXGroup section */ 44 | EFE42DC51ED67F8200F1A49E = { 45 | isa = PBXGroup; 46 | children = ( 47 | EFE42DF31ED6851A00F1A49E /* JLYoutubeActivity.podspec */, 48 | EFE42DEF1ED6851A00F1A49E /* JLYoutubeActivity */, 49 | EFE42DD01ED67F8200F1A49E /* JLYoutubeActivityDemo */, 50 | EFE42DCF1ED67F8200F1A49E /* Products */, 51 | ); 52 | sourceTree = ""; 53 | }; 54 | EFE42DCF1ED67F8200F1A49E /* Products */ = { 55 | isa = PBXGroup; 56 | children = ( 57 | EFE42DCE1ED67F8200F1A49E /* JLYoutubeActivityDemo.app */, 58 | ); 59 | name = Products; 60 | sourceTree = ""; 61 | }; 62 | EFE42DD01ED67F8200F1A49E /* JLYoutubeActivityDemo */ = { 63 | isa = PBXGroup; 64 | children = ( 65 | EFE42DD11ED67F8200F1A49E /* AppDelegate.swift */, 66 | EFE42DD31ED67F8200F1A49E /* ViewController.swift */, 67 | EFE42DD51ED67F8200F1A49E /* Main.storyboard */, 68 | EFE42DD81ED67F8200F1A49E /* Assets.xcassets */, 69 | EFE42DDA1ED67F8200F1A49E /* LaunchScreen.storyboard */, 70 | EFE42DDD1ED67F8200F1A49E /* Info.plist */, 71 | ); 72 | path = JLYoutubeActivityDemo; 73 | sourceTree = ""; 74 | }; 75 | EFE42DEF1ED6851A00F1A49E /* JLYoutubeActivity */ = { 76 | isa = PBXGroup; 77 | children = ( 78 | EFE42DF01ED6851A00F1A49E /* JLYoutubeActivity.bundle */, 79 | EFE8533C208F025C00859E98 /* JLYoutubeActivity.swift */, 80 | ); 81 | name = JLYoutubeActivity; 82 | path = ../JLYoutubeActivity; 83 | sourceTree = ""; 84 | }; 85 | /* End PBXGroup section */ 86 | 87 | /* Begin PBXNativeTarget section */ 88 | EFE42DCD1ED67F8200F1A49E /* JLYoutubeActivityDemo */ = { 89 | isa = PBXNativeTarget; 90 | buildConfigurationList = EFE42DE01ED67F8200F1A49E /* Build configuration list for PBXNativeTarget "JLYoutubeActivityDemo" */; 91 | buildPhases = ( 92 | EFE42DCA1ED67F8200F1A49E /* Sources */, 93 | EFE42DCB1ED67F8200F1A49E /* Frameworks */, 94 | EFE42DCC1ED67F8200F1A49E /* Resources */, 95 | ); 96 | buildRules = ( 97 | ); 98 | dependencies = ( 99 | ); 100 | name = JLYoutubeActivityDemo; 101 | productName = JLYoutubeActivityDemo; 102 | productReference = EFE42DCE1ED67F8200F1A49E /* JLYoutubeActivityDemo.app */; 103 | productType = "com.apple.product-type.application"; 104 | }; 105 | /* End PBXNativeTarget section */ 106 | 107 | /* Begin PBXProject section */ 108 | EFE42DC61ED67F8200F1A49E /* Project object */ = { 109 | isa = PBXProject; 110 | attributes = { 111 | LastSwiftUpdateCheck = 0830; 112 | LastUpgradeCheck = 0930; 113 | ORGANIZATIONNAME = Woody; 114 | TargetAttributes = { 115 | EFE42DCD1ED67F8200F1A49E = { 116 | CreatedOnToolsVersion = 8.3.2; 117 | DevelopmentTeam = SCHCN3R38K; 118 | LastSwiftMigration = 0930; 119 | ProvisioningStyle = Automatic; 120 | }; 121 | }; 122 | }; 123 | buildConfigurationList = EFE42DC91ED67F8200F1A49E /* Build configuration list for PBXProject "JLYoutubeActivityDemo" */; 124 | compatibilityVersion = "Xcode 3.2"; 125 | developmentRegion = English; 126 | hasScannedForEncodings = 0; 127 | knownRegions = ( 128 | en, 129 | Base, 130 | ); 131 | mainGroup = EFE42DC51ED67F8200F1A49E; 132 | productRefGroup = EFE42DCF1ED67F8200F1A49E /* Products */; 133 | projectDirPath = ""; 134 | projectRoot = ""; 135 | targets = ( 136 | EFE42DCD1ED67F8200F1A49E /* JLYoutubeActivityDemo */, 137 | ); 138 | }; 139 | /* End PBXProject section */ 140 | 141 | /* Begin PBXResourcesBuildPhase section */ 142 | EFE42DCC1ED67F8200F1A49E /* Resources */ = { 143 | isa = PBXResourcesBuildPhase; 144 | buildActionMask = 2147483647; 145 | files = ( 146 | EFE42DF61ED6851A00F1A49E /* JLYoutubeActivity.podspec in Resources */, 147 | EFE42DF41ED6851A00F1A49E /* JLYoutubeActivity.bundle in Resources */, 148 | EFE42DDC1ED67F8200F1A49E /* LaunchScreen.storyboard in Resources */, 149 | EFE42DD91ED67F8200F1A49E /* Assets.xcassets in Resources */, 150 | EFE42DD71ED67F8200F1A49E /* Main.storyboard in Resources */, 151 | ); 152 | runOnlyForDeploymentPostprocessing = 0; 153 | }; 154 | /* End PBXResourcesBuildPhase section */ 155 | 156 | /* Begin PBXSourcesBuildPhase section */ 157 | EFE42DCA1ED67F8200F1A49E /* Sources */ = { 158 | isa = PBXSourcesBuildPhase; 159 | buildActionMask = 2147483647; 160 | files = ( 161 | EFE42DD41ED67F8200F1A49E /* ViewController.swift in Sources */, 162 | EFE42DD21ED67F8200F1A49E /* AppDelegate.swift in Sources */, 163 | EFE8533D208F025C00859E98 /* JLYoutubeActivity.swift in Sources */, 164 | ); 165 | runOnlyForDeploymentPostprocessing = 0; 166 | }; 167 | /* End PBXSourcesBuildPhase section */ 168 | 169 | /* Begin PBXVariantGroup section */ 170 | EFE42DD51ED67F8200F1A49E /* Main.storyboard */ = { 171 | isa = PBXVariantGroup; 172 | children = ( 173 | EFE42DD61ED67F8200F1A49E /* Base */, 174 | ); 175 | name = Main.storyboard; 176 | sourceTree = ""; 177 | }; 178 | EFE42DDA1ED67F8200F1A49E /* LaunchScreen.storyboard */ = { 179 | isa = PBXVariantGroup; 180 | children = ( 181 | EFE42DDB1ED67F8200F1A49E /* Base */, 182 | ); 183 | name = LaunchScreen.storyboard; 184 | sourceTree = ""; 185 | }; 186 | /* End PBXVariantGroup section */ 187 | 188 | /* Begin XCBuildConfiguration section */ 189 | EFE42DDE1ED67F8200F1A49E /* Debug */ = { 190 | isa = XCBuildConfiguration; 191 | buildSettings = { 192 | ALWAYS_SEARCH_USER_PATHS = NO; 193 | CLANG_ANALYZER_NONNULL = YES; 194 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 195 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 196 | CLANG_CXX_LIBRARY = "libc++"; 197 | CLANG_ENABLE_MODULES = YES; 198 | CLANG_ENABLE_OBJC_ARC = YES; 199 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 200 | CLANG_WARN_BOOL_CONVERSION = YES; 201 | CLANG_WARN_COMMA = YES; 202 | CLANG_WARN_CONSTANT_CONVERSION = YES; 203 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 204 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 205 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 206 | CLANG_WARN_EMPTY_BODY = YES; 207 | CLANG_WARN_ENUM_CONVERSION = YES; 208 | CLANG_WARN_INFINITE_RECURSION = YES; 209 | CLANG_WARN_INT_CONVERSION = YES; 210 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 211 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 212 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 213 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 214 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 215 | CLANG_WARN_STRICT_PROTOTYPES = YES; 216 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 217 | CLANG_WARN_UNREACHABLE_CODE = YES; 218 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 219 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 220 | COPY_PHASE_STRIP = NO; 221 | DEBUG_INFORMATION_FORMAT = dwarf; 222 | ENABLE_STRICT_OBJC_MSGSEND = YES; 223 | ENABLE_TESTABILITY = YES; 224 | GCC_C_LANGUAGE_STANDARD = gnu99; 225 | GCC_DYNAMIC_NO_PIC = NO; 226 | GCC_NO_COMMON_BLOCKS = YES; 227 | GCC_OPTIMIZATION_LEVEL = 0; 228 | GCC_PREPROCESSOR_DEFINITIONS = ( 229 | "DEBUG=1", 230 | "$(inherited)", 231 | ); 232 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 233 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 234 | GCC_WARN_UNDECLARED_SELECTOR = YES; 235 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 236 | GCC_WARN_UNUSED_FUNCTION = YES; 237 | GCC_WARN_UNUSED_VARIABLE = YES; 238 | IPHONEOS_DEPLOYMENT_TARGET = 10.3; 239 | MTL_ENABLE_DEBUG_INFO = YES; 240 | ONLY_ACTIVE_ARCH = YES; 241 | SDKROOT = iphoneos; 242 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 243 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 244 | SWIFT_VERSION = 4.0; 245 | }; 246 | name = Debug; 247 | }; 248 | EFE42DDF1ED67F8200F1A49E /* Release */ = { 249 | isa = XCBuildConfiguration; 250 | buildSettings = { 251 | ALWAYS_SEARCH_USER_PATHS = NO; 252 | CLANG_ANALYZER_NONNULL = YES; 253 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 254 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 255 | CLANG_CXX_LIBRARY = "libc++"; 256 | CLANG_ENABLE_MODULES = YES; 257 | CLANG_ENABLE_OBJC_ARC = YES; 258 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 259 | CLANG_WARN_BOOL_CONVERSION = YES; 260 | CLANG_WARN_COMMA = YES; 261 | CLANG_WARN_CONSTANT_CONVERSION = YES; 262 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 263 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 264 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 265 | CLANG_WARN_EMPTY_BODY = YES; 266 | CLANG_WARN_ENUM_CONVERSION = YES; 267 | CLANG_WARN_INFINITE_RECURSION = YES; 268 | CLANG_WARN_INT_CONVERSION = YES; 269 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 270 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 271 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 272 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 273 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 274 | CLANG_WARN_STRICT_PROTOTYPES = YES; 275 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 276 | CLANG_WARN_UNREACHABLE_CODE = YES; 277 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 278 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 279 | COPY_PHASE_STRIP = NO; 280 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 281 | ENABLE_NS_ASSERTIONS = NO; 282 | ENABLE_STRICT_OBJC_MSGSEND = YES; 283 | GCC_C_LANGUAGE_STANDARD = gnu99; 284 | GCC_NO_COMMON_BLOCKS = YES; 285 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 286 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 287 | GCC_WARN_UNDECLARED_SELECTOR = YES; 288 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 289 | GCC_WARN_UNUSED_FUNCTION = YES; 290 | GCC_WARN_UNUSED_VARIABLE = YES; 291 | IPHONEOS_DEPLOYMENT_TARGET = 10.3; 292 | MTL_ENABLE_DEBUG_INFO = NO; 293 | SDKROOT = iphoneos; 294 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 295 | SWIFT_VERSION = 4.0; 296 | VALIDATE_PRODUCT = YES; 297 | }; 298 | name = Release; 299 | }; 300 | EFE42DE11ED67F8200F1A49E /* Debug */ = { 301 | isa = XCBuildConfiguration; 302 | buildSettings = { 303 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 304 | CLANG_ENABLE_MODULES = YES; 305 | DEVELOPMENT_TEAM = SCHCN3R38K; 306 | INFOPLIST_FILE = JLYoutubeActivityDemo/Info.plist; 307 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 308 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 309 | PRODUCT_BUNDLE_IDENTIFIER = JLSeries.JLYoutubeActivityDemo; 310 | PRODUCT_NAME = "$(TARGET_NAME)"; 311 | SWIFT_OBJC_BRIDGING_HEADER = ""; 312 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 313 | SWIFT_SWIFT3_OBJC_INFERENCE = On; 314 | SWIFT_VERSION = 4.0; 315 | }; 316 | name = Debug; 317 | }; 318 | EFE42DE21ED67F8200F1A49E /* Release */ = { 319 | isa = XCBuildConfiguration; 320 | buildSettings = { 321 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 322 | CLANG_ENABLE_MODULES = YES; 323 | DEVELOPMENT_TEAM = SCHCN3R38K; 324 | INFOPLIST_FILE = JLYoutubeActivityDemo/Info.plist; 325 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 326 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 327 | PRODUCT_BUNDLE_IDENTIFIER = JLSeries.JLYoutubeActivityDemo; 328 | PRODUCT_NAME = "$(TARGET_NAME)"; 329 | SWIFT_OBJC_BRIDGING_HEADER = ""; 330 | SWIFT_SWIFT3_OBJC_INFERENCE = On; 331 | SWIFT_VERSION = 4.0; 332 | }; 333 | name = Release; 334 | }; 335 | /* End XCBuildConfiguration section */ 336 | 337 | /* Begin XCConfigurationList section */ 338 | EFE42DC91ED67F8200F1A49E /* Build configuration list for PBXProject "JLYoutubeActivityDemo" */ = { 339 | isa = XCConfigurationList; 340 | buildConfigurations = ( 341 | EFE42DDE1ED67F8200F1A49E /* Debug */, 342 | EFE42DDF1ED67F8200F1A49E /* Release */, 343 | ); 344 | defaultConfigurationIsVisible = 0; 345 | defaultConfigurationName = Release; 346 | }; 347 | EFE42DE01ED67F8200F1A49E /* Build configuration list for PBXNativeTarget "JLYoutubeActivityDemo" */ = { 348 | isa = XCConfigurationList; 349 | buildConfigurations = ( 350 | EFE42DE11ED67F8200F1A49E /* Debug */, 351 | EFE42DE21ED67F8200F1A49E /* Release */, 352 | ); 353 | defaultConfigurationIsVisible = 0; 354 | defaultConfigurationName = Release; 355 | }; 356 | /* End XCConfigurationList section */ 357 | }; 358 | rootObject = EFE42DC61ED67F8200F1A49E /* Project object */; 359 | } 360 | -------------------------------------------------------------------------------- /JLYoutubeActivityDemo/JLYoutubeActivityDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /JLYoutubeActivityDemo/JLYoutubeActivityDemo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /JLYoutubeActivityDemo/JLYoutubeActivityDemo/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // JLYoutubeActivityDemo 4 | // 5 | // Created by Woody on 2017. 5. 25.. 6 | // Copyright © 2017년 Woody. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(_ application: UIApplication) { 23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 24 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(_ application: UIApplication) { 28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(_ application: UIApplication) { 33 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(_ application: UIApplication) { 37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 38 | } 39 | 40 | func applicationWillTerminate(_ application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /JLYoutubeActivityDemo/JLYoutubeActivityDemo/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ios-marketing", 45 | "size" : "1024x1024", 46 | "scale" : "1x" 47 | } 48 | ], 49 | "info" : { 50 | "version" : 1, 51 | "author" : "xcode" 52 | } 53 | } -------------------------------------------------------------------------------- /JLYoutubeActivityDemo/JLYoutubeActivityDemo/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /JLYoutubeActivityDemo/JLYoutubeActivityDemo/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /JLYoutubeActivityDemo/JLYoutubeActivityDemo/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 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSApplicationQueriesSchemes 22 | 23 | youtube 24 | 25 | LSRequiresIPhoneOS 26 | 27 | UILaunchStoryboardName 28 | LaunchScreen 29 | UIMainStoryboardFile 30 | Main 31 | UIRequiredDeviceCapabilities 32 | 33 | armv7 34 | 35 | UISupportedInterfaceOrientations 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationLandscapeLeft 39 | UIInterfaceOrientationLandscapeRight 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /JLYoutubeActivityDemo/JLYoutubeActivityDemo/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // JLYoutubeActivityDemo 4 | // 5 | // Created by Woody on 2017. 5. 25.. 6 | // Copyright © 2017년 Woody. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ViewController: UIViewController { 12 | @IBOutlet weak var webView : UIWebView! 13 | 14 | override func viewDidLoad() { 15 | super.viewDidLoad() 16 | 17 | if let url = URL(string: "https://youtu.be/_NMQl74qrR8") { 18 | webView.loadRequest(URLRequest(url: url)) 19 | } 20 | } 21 | 22 | @IBAction func pressedShareButton(_ sender: Any) { 23 | if let url : URL = webView.request?.url! { 24 | let activityViewController = UIActivityViewController(activityItems: [url], applicationActivities: [JLYoutubeActivity()]) 25 | present(activityViewController, animated: true, completion: nil) 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 jangsy7883 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # JLYouTubeActivity 2 | 3 | [![Version](https://img.shields.io/cocoapods/v/JLYoutubeActivity.svg?style=flat)](http://cocoadocs.org/docsets/JLYoutubeActivity) 4 | [![License](https://img.shields.io/cocoapods/l/JLYoutubeActivity.svg?style=flat)](http://cocoadocs.org/docsets/JLYoutubeActivity) 5 | [![Platform](https://img.shields.io/cocoapods/p/JLYoutubeActivity.svg?style=flat)](http://cocoadocs.org/docsets/JLYoutubeActivity) 6 | [![Support](https://img.shields.io/badge/support-iOS%208+-blue.svg?style=flat)](https://www.apple.com/nl/ios/) 7 | 8 | `JLYouTubeActivity` is a `UIActivity` subclass that provides an "YouTube" action to a `UIActivityViewController`. 9 | 10 | ![JLYouTubeActivity screenshot](https://github.com/jangsy7883/JLYouTubeActivity/blob/master/ScreenShorts/1.png?raw=true "JLYouTubeActivity screenshot") 11 | 12 | ## Install 13 | JLYouTubeActivity is available on CocoaPods. Add to your Podfile: 14 | ```ruby 15 | pod 'JLYouTubeActivity' 16 | ``` 17 | and run 18 | ```bash 19 | pod install 20 | ``` 21 | 22 | ## Usage 23 | ```objc 24 | NSURL *URL = [NSURL URLWithString:@"https://youtu.be/_NMQl74qrR8"]; 25 | 26 | JLYoutubeActivity *activity = [[JLYoutubeActivity alloc] init]; 27 | UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:@[URL] applicationActivities::@[activity]]; 28 | ``` 29 | 30 | ## Licence 31 | 32 | The MIT License (MIT) 33 | 34 | Copyright (c) 2016 jangsy7883 35 | 36 | Permission is hereby granted, free of charge, to any person obtaining a copy 37 | of this software and associated documentation files (the "Software"), to deal 38 | in the Software without restriction, including without limitation the rights 39 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 40 | copies of the Software, and to permit persons to whom the Software is 41 | furnished to do so, subject to the following conditions: 42 | 43 | The above copyright notice and this permission notice shall be included in all 44 | copies or substantial portions of the Software. 45 | 46 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 47 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 48 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 49 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 50 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 51 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 52 | SOFTWARE. 53 | -------------------------------------------------------------------------------- /ScreenShorts/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jangsy7883/JLYouTubeActivity/5ce28fc01a92900ab3ae8f93bb1a6d78a4fb1324/ScreenShorts/1.png -------------------------------------------------------------------------------- /ScreenShorts/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jangsy7883/JLYouTubeActivity/5ce28fc01a92900ab3ae8f93bb1a6d78a4fb1324/ScreenShorts/2.png --------------------------------------------------------------------------------