├── .gitignore ├── .swift-version ├── .travis.yml ├── CHANGELOG.md ├── Carthage └── PictureInPicture │ ├── PictureInPicture.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ └── contents.xcworkspacedata │ └── xcshareddata │ │ └── xcschemes │ │ └── Carthage.xcscheme │ └── PictureInPicture │ ├── Info.plist │ └── PictureInPicture.h ├── Example ├── PictureInPicture.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ └── contents.xcworkspacedata ├── PictureInPicture.xcworkspace │ └── contents.xcworkspacedata ├── PictureInPicture │ ├── AppDelegate.swift │ ├── Base.lproj │ │ ├── LaunchScreen.xib │ │ └── Main.storyboard │ ├── Images.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Info.plist │ ├── ModalViewController.swift │ ├── NewWindowViewController.swift │ ├── PictureInPictureViewController.swift │ ├── PushViewController.swift │ └── ViewController.swift ├── Podfile └── Podfile.lock ├── Gemfile ├── Gemfile.lock ├── LICENSE ├── PictureInPicture.podspec ├── PictureInPicture ├── Assets │ └── .gitkeep └── Classes │ ├── .gitkeep │ ├── FeedbackGenerator.swift │ ├── PictureInPicture.swift │ ├── PictureInPictureWindow.swift │ ├── UIApplication+setNeedsStatusBarAppearanceUpdate.swift │ └── UIViewController+Extensions.swift ├── README.md ├── README └── Screenshot.gif └── _Pods.xcodeproj /.gitignore: -------------------------------------------------------------------------------- 1 | # OS X 2 | .DS_Store 3 | 4 | # Xcode 5 | build/ 6 | *.pbxuser 7 | !default.pbxuser 8 | *.mode1v3 9 | !default.mode1v3 10 | *.mode2v3 11 | !default.mode2v3 12 | *.perspectivev3 13 | !default.perspectivev3 14 | xcuserdata/ 15 | *.xccheckout 16 | profile 17 | *.moved-aside 18 | DerivedData 19 | *.hmap 20 | *.ipa 21 | 22 | # Bundler 23 | .bundle 24 | 25 | Example/Pods 26 | 27 | Carthage/* 28 | !Carthage/PictureInPicture 29 | *.framework.zip 30 | # We recommend against adding the Pods directory to your .gitignore. However 31 | # you should judge for yourself, the pros and cons are mentioned at: 32 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 33 | # 34 | # Note: if you ignore the Pods directory, make sure to uncomment 35 | # `pod install` in .travis.yml 36 | # 37 | # Pods/ 38 | -------------------------------------------------------------------------------- /.swift-version: -------------------------------------------------------------------------------- 1 | 4.0 -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # references: 2 | # * http://www.objc.io/issue-6/travis-ci.html 3 | # * https://github.com/supermarin/xcpretty#usage 4 | 5 | osx_image: xcode7.3 6 | language: objective-c 7 | # cache: cocoapods 8 | # podfile: Example/Podfile 9 | # before_install: 10 | # - gem install cocoapods # Since Travis is not always on latest version 11 | # - pod install --project-directory=Example 12 | script: 13 | - set -o pipefail && xcodebuild test -workspace Example/PictureInPicture.xcworkspace -scheme PictureInPicture-Example -sdk iphonesimulator9.3 ONLY_ACTIVE_ARCH=NO | xcpretty 14 | - pod lib lint 15 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | ## [0.2.4](https://github.com/malt03/PictureInPicture/tree/0.2.4) (2017-08-08) 4 | [Full Changelog](https://github.com/malt03/PictureInPicture/compare/0.2.3...0.2.4) 5 | 6 | ## [0.2.3](https://github.com/malt03/PictureInPicture/tree/0.2.3) (2017-08-08) 7 | [Full Changelog](https://github.com/malt03/PictureInPicture/compare/0.2.2...0.2.3) 8 | 9 | ## [0.2.2](https://github.com/malt03/PictureInPicture/tree/0.2.2) (2017-07-28) 10 | [Full Changelog](https://github.com/malt03/PictureInPicture/compare/0.2.1...0.2.2) 11 | 12 | ## [0.2.1](https://github.com/malt03/PictureInPicture/tree/0.2.1) (2017-07-28) 13 | [Full Changelog](https://github.com/malt03/PictureInPicture/compare/0.2.0...0.2.1) 14 | 15 | **Closed issues:** 16 | 17 | - I've been looking for a library like this but for objective C [\#1](https://github.com/malt03/PictureInPicture/issues/1) 18 | 19 | ## [0.2.0](https://github.com/malt03/PictureInPicture/tree/0.2.0) (2017-07-27) 20 | [Full Changelog](https://github.com/malt03/PictureInPicture/compare/0.1.14...0.2.0) 21 | 22 | ## [0.1.14](https://github.com/malt03/PictureInPicture/tree/0.1.14) (2017-07-26) 23 | [Full Changelog](https://github.com/malt03/PictureInPicture/compare/0.1.13...0.1.14) 24 | 25 | ## [0.1.13](https://github.com/malt03/PictureInPicture/tree/0.1.13) (2017-07-26) 26 | [Full Changelog](https://github.com/malt03/PictureInPicture/compare/0.1.12...0.1.13) 27 | 28 | ## [0.1.12](https://github.com/malt03/PictureInPicture/tree/0.1.12) (2017-07-25) 29 | [Full Changelog](https://github.com/malt03/PictureInPicture/compare/0.1.11...0.1.12) 30 | 31 | ## [0.1.11](https://github.com/malt03/PictureInPicture/tree/0.1.11) (2017-07-25) 32 | [Full Changelog](https://github.com/malt03/PictureInPicture/compare/0.1.10...0.1.11) 33 | 34 | ## [0.1.10](https://github.com/malt03/PictureInPicture/tree/0.1.10) (2017-07-25) 35 | [Full Changelog](https://github.com/malt03/PictureInPicture/compare/0.1.9...0.1.10) 36 | 37 | ## [0.1.9](https://github.com/malt03/PictureInPicture/tree/0.1.9) (2017-07-20) 38 | [Full Changelog](https://github.com/malt03/PictureInPicture/compare/0.1.8...0.1.9) 39 | 40 | ## [0.1.8](https://github.com/malt03/PictureInPicture/tree/0.1.8) (2017-07-20) 41 | [Full Changelog](https://github.com/malt03/PictureInPicture/compare/0.1.7...0.1.8) 42 | 43 | ## [0.1.7](https://github.com/malt03/PictureInPicture/tree/0.1.7) (2017-07-19) 44 | [Full Changelog](https://github.com/malt03/PictureInPicture/compare/0.1.6...0.1.7) 45 | 46 | ## [0.1.6](https://github.com/malt03/PictureInPicture/tree/0.1.6) (2017-07-19) 47 | [Full Changelog](https://github.com/malt03/PictureInPicture/compare/0.1.5...0.1.6) 48 | 49 | ## [0.1.5](https://github.com/malt03/PictureInPicture/tree/0.1.5) (2017-07-19) 50 | [Full Changelog](https://github.com/malt03/PictureInPicture/compare/0.1.4...0.1.5) 51 | 52 | ## [0.1.4](https://github.com/malt03/PictureInPicture/tree/0.1.4) (2017-07-19) 53 | [Full Changelog](https://github.com/malt03/PictureInPicture/compare/0.1.3...0.1.4) 54 | 55 | ## [0.1.3](https://github.com/malt03/PictureInPicture/tree/0.1.3) (2017-07-19) 56 | [Full Changelog](https://github.com/malt03/PictureInPicture/compare/0.1.2...0.1.3) 57 | 58 | ## [0.1.2](https://github.com/malt03/PictureInPicture/tree/0.1.2) (2017-07-19) 59 | [Full Changelog](https://github.com/malt03/PictureInPicture/compare/0.1.1...0.1.2) 60 | 61 | ## [0.1.1](https://github.com/malt03/PictureInPicture/tree/0.1.1) (2017-06-16) 62 | [Full Changelog](https://github.com/malt03/PictureInPicture/compare/0.1.0...0.1.1) 63 | 64 | ## [0.1.0](https://github.com/malt03/PictureInPicture/tree/0.1.0) (2017-06-16) 65 | 66 | 67 | \* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* -------------------------------------------------------------------------------- /Carthage/PictureInPicture/PictureInPicture.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | ED02DDB51F26C763004599D5 /* UIViewController+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED02DDB41F26C763004599D5 /* UIViewController+Extensions.swift */; }; 11 | ED6CAC3F1F1EFBC400CA3BE2 /* PictureInPicture.h in Headers */ = {isa = PBXBuildFile; fileRef = ED6CAC3D1F1EFBC400CA3BE2 /* PictureInPicture.h */; settings = {ATTRIBUTES = (Public, ); }; }; 12 | ED6CAC4A1F1EFBED00CA3BE2 /* PictureInPicture.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED6CAC461F1EFBED00CA3BE2 /* PictureInPicture.swift */; }; 13 | ED6CACB91F1FCF9500CA3BE2 /* UIApplication+setNeedsStatusBarAppearanceUpdate.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED6CACB81F1FCF9500CA3BE2 /* UIApplication+setNeedsStatusBarAppearanceUpdate.swift */; }; 14 | ED6CACBF1F2080B500CA3BE2 /* PictureInPictureWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED6CACBE1F2080B500CA3BE2 /* PictureInPictureWindow.swift */; }; 15 | ED6CACC11F2080BB00CA3BE2 /* FeedbackGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED6CACC01F2080BB00CA3BE2 /* FeedbackGenerator.swift */; }; 16 | /* End PBXBuildFile section */ 17 | 18 | /* Begin PBXFileReference section */ 19 | ED02DDB41F26C763004599D5 /* UIViewController+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "UIViewController+Extensions.swift"; path = "../../../PictureInPicture/Classes/UIViewController+Extensions.swift"; sourceTree = ""; }; 20 | ED6CAC3A1F1EFBC400CA3BE2 /* PictureInPicture.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = PictureInPicture.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 21 | ED6CAC3D1F1EFBC400CA3BE2 /* PictureInPicture.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PictureInPicture.h; sourceTree = ""; }; 22 | ED6CAC3E1F1EFBC400CA3BE2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 23 | ED6CAC461F1EFBED00CA3BE2 /* PictureInPicture.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = PictureInPicture.swift; path = ../../../PictureInPicture/Classes/PictureInPicture.swift; sourceTree = ""; }; 24 | ED6CACB81F1FCF9500CA3BE2 /* UIApplication+setNeedsStatusBarAppearanceUpdate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "UIApplication+setNeedsStatusBarAppearanceUpdate.swift"; path = "../../../PictureInPicture/Classes/UIApplication+setNeedsStatusBarAppearanceUpdate.swift"; sourceTree = ""; }; 25 | ED6CACBE1F2080B500CA3BE2 /* PictureInPictureWindow.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = PictureInPictureWindow.swift; path = ../../../PictureInPicture/Classes/PictureInPictureWindow.swift; sourceTree = ""; }; 26 | ED6CACC01F2080BB00CA3BE2 /* FeedbackGenerator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = FeedbackGenerator.swift; path = ../../../PictureInPicture/Classes/FeedbackGenerator.swift; sourceTree = ""; }; 27 | /* End PBXFileReference section */ 28 | 29 | /* Begin PBXFrameworksBuildPhase section */ 30 | ED6CAC361F1EFBC400CA3BE2 /* Frameworks */ = { 31 | isa = PBXFrameworksBuildPhase; 32 | buildActionMask = 2147483647; 33 | files = ( 34 | ); 35 | runOnlyForDeploymentPostprocessing = 0; 36 | }; 37 | /* End PBXFrameworksBuildPhase section */ 38 | 39 | /* Begin PBXGroup section */ 40 | ED6CAC301F1EFBC400CA3BE2 = { 41 | isa = PBXGroup; 42 | children = ( 43 | ED6CAC3C1F1EFBC400CA3BE2 /* PictureInPicture */, 44 | ED6CAC3B1F1EFBC400CA3BE2 /* Products */, 45 | ); 46 | sourceTree = ""; 47 | }; 48 | ED6CAC3B1F1EFBC400CA3BE2 /* Products */ = { 49 | isa = PBXGroup; 50 | children = ( 51 | ED6CAC3A1F1EFBC400CA3BE2 /* PictureInPicture.framework */, 52 | ); 53 | name = Products; 54 | sourceTree = ""; 55 | }; 56 | ED6CAC3C1F1EFBC400CA3BE2 /* PictureInPicture */ = { 57 | isa = PBXGroup; 58 | children = ( 59 | ED6CAC3D1F1EFBC400CA3BE2 /* PictureInPicture.h */, 60 | ED6CAC461F1EFBED00CA3BE2 /* PictureInPicture.swift */, 61 | ED6CACBE1F2080B500CA3BE2 /* PictureInPictureWindow.swift */, 62 | ED02DDB41F26C763004599D5 /* UIViewController+Extensions.swift */, 63 | ED6CACB81F1FCF9500CA3BE2 /* UIApplication+setNeedsStatusBarAppearanceUpdate.swift */, 64 | ED6CACC01F2080BB00CA3BE2 /* FeedbackGenerator.swift */, 65 | ED6CAC3E1F1EFBC400CA3BE2 /* Info.plist */, 66 | ); 67 | path = PictureInPicture; 68 | sourceTree = ""; 69 | }; 70 | /* End PBXGroup section */ 71 | 72 | /* Begin PBXHeadersBuildPhase section */ 73 | ED6CAC371F1EFBC400CA3BE2 /* Headers */ = { 74 | isa = PBXHeadersBuildPhase; 75 | buildActionMask = 2147483647; 76 | files = ( 77 | ED6CAC3F1F1EFBC400CA3BE2 /* PictureInPicture.h in Headers */, 78 | ); 79 | runOnlyForDeploymentPostprocessing = 0; 80 | }; 81 | /* End PBXHeadersBuildPhase section */ 82 | 83 | /* Begin PBXNativeTarget section */ 84 | ED6CAC391F1EFBC400CA3BE2 /* PictureInPicture */ = { 85 | isa = PBXNativeTarget; 86 | buildConfigurationList = ED6CAC421F1EFBC400CA3BE2 /* Build configuration list for PBXNativeTarget "PictureInPicture" */; 87 | buildPhases = ( 88 | ED6CAC351F1EFBC400CA3BE2 /* Sources */, 89 | ED6CAC361F1EFBC400CA3BE2 /* Frameworks */, 90 | ED6CAC371F1EFBC400CA3BE2 /* Headers */, 91 | ED6CAC381F1EFBC400CA3BE2 /* Resources */, 92 | ); 93 | buildRules = ( 94 | ); 95 | dependencies = ( 96 | ); 97 | name = PictureInPicture; 98 | productName = PictureInPicture; 99 | productReference = ED6CAC3A1F1EFBC400CA3BE2 /* PictureInPicture.framework */; 100 | productType = "com.apple.product-type.framework"; 101 | }; 102 | /* End PBXNativeTarget section */ 103 | 104 | /* Begin PBXProject section */ 105 | ED6CAC311F1EFBC400CA3BE2 /* Project object */ = { 106 | isa = PBXProject; 107 | attributes = { 108 | LastUpgradeCheck = 1000; 109 | ORGANIZATIONNAME = "Koji Murata"; 110 | TargetAttributes = { 111 | ED6CAC391F1EFBC400CA3BE2 = { 112 | CreatedOnToolsVersion = 8.3.3; 113 | LastSwiftMigration = 0830; 114 | ProvisioningStyle = Automatic; 115 | }; 116 | }; 117 | }; 118 | buildConfigurationList = ED6CAC341F1EFBC400CA3BE2 /* Build configuration list for PBXProject "PictureInPicture" */; 119 | compatibilityVersion = "Xcode 3.2"; 120 | developmentRegion = English; 121 | hasScannedForEncodings = 0; 122 | knownRegions = ( 123 | en, 124 | ); 125 | mainGroup = ED6CAC301F1EFBC400CA3BE2; 126 | productRefGroup = ED6CAC3B1F1EFBC400CA3BE2 /* Products */; 127 | projectDirPath = ""; 128 | projectRoot = ""; 129 | targets = ( 130 | ED6CAC391F1EFBC400CA3BE2 /* PictureInPicture */, 131 | ); 132 | }; 133 | /* End PBXProject section */ 134 | 135 | /* Begin PBXResourcesBuildPhase section */ 136 | ED6CAC381F1EFBC400CA3BE2 /* Resources */ = { 137 | isa = PBXResourcesBuildPhase; 138 | buildActionMask = 2147483647; 139 | files = ( 140 | ); 141 | runOnlyForDeploymentPostprocessing = 0; 142 | }; 143 | /* End PBXResourcesBuildPhase section */ 144 | 145 | /* Begin PBXSourcesBuildPhase section */ 146 | ED6CAC351F1EFBC400CA3BE2 /* Sources */ = { 147 | isa = PBXSourcesBuildPhase; 148 | buildActionMask = 2147483647; 149 | files = ( 150 | ED6CACB91F1FCF9500CA3BE2 /* UIApplication+setNeedsStatusBarAppearanceUpdate.swift in Sources */, 151 | ED6CAC4A1F1EFBED00CA3BE2 /* PictureInPicture.swift in Sources */, 152 | ED02DDB51F26C763004599D5 /* UIViewController+Extensions.swift in Sources */, 153 | ED6CACC11F2080BB00CA3BE2 /* FeedbackGenerator.swift in Sources */, 154 | ED6CACBF1F2080B500CA3BE2 /* PictureInPictureWindow.swift in Sources */, 155 | ); 156 | runOnlyForDeploymentPostprocessing = 0; 157 | }; 158 | /* End PBXSourcesBuildPhase section */ 159 | 160 | /* Begin XCBuildConfiguration section */ 161 | ED6CAC401F1EFBC400CA3BE2 /* Debug */ = { 162 | isa = XCBuildConfiguration; 163 | buildSettings = { 164 | ALWAYS_SEARCH_USER_PATHS = NO; 165 | CLANG_ANALYZER_NONNULL = YES; 166 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 167 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 168 | CLANG_CXX_LIBRARY = "libc++"; 169 | CLANG_ENABLE_MODULES = YES; 170 | CLANG_ENABLE_OBJC_ARC = YES; 171 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 172 | CLANG_WARN_BOOL_CONVERSION = YES; 173 | CLANG_WARN_COMMA = YES; 174 | CLANG_WARN_CONSTANT_CONVERSION = YES; 175 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 176 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 177 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 178 | CLANG_WARN_EMPTY_BODY = YES; 179 | CLANG_WARN_ENUM_CONVERSION = YES; 180 | CLANG_WARN_INFINITE_RECURSION = YES; 181 | CLANG_WARN_INT_CONVERSION = YES; 182 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 183 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 184 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 185 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 186 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 187 | CLANG_WARN_STRICT_PROTOTYPES = YES; 188 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 189 | CLANG_WARN_UNREACHABLE_CODE = YES; 190 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 191 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 192 | COPY_PHASE_STRIP = NO; 193 | CURRENT_PROJECT_VERSION = 1; 194 | DEBUG_INFORMATION_FORMAT = dwarf; 195 | ENABLE_STRICT_OBJC_MSGSEND = YES; 196 | ENABLE_TESTABILITY = YES; 197 | GCC_C_LANGUAGE_STANDARD = gnu99; 198 | GCC_DYNAMIC_NO_PIC = NO; 199 | GCC_NO_COMMON_BLOCKS = YES; 200 | GCC_OPTIMIZATION_LEVEL = 0; 201 | GCC_PREPROCESSOR_DEFINITIONS = ( 202 | "DEBUG=1", 203 | "$(inherited)", 204 | ); 205 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 206 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 207 | GCC_WARN_UNDECLARED_SELECTOR = YES; 208 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 209 | GCC_WARN_UNUSED_FUNCTION = YES; 210 | GCC_WARN_UNUSED_VARIABLE = YES; 211 | IPHONEOS_DEPLOYMENT_TARGET = 10.3; 212 | MTL_ENABLE_DEBUG_INFO = YES; 213 | ONLY_ACTIVE_ARCH = YES; 214 | SDKROOT = iphoneos; 215 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 216 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 217 | SWIFT_VERSION = 4.2; 218 | TARGETED_DEVICE_FAMILY = "1,2"; 219 | VERSIONING_SYSTEM = "apple-generic"; 220 | VERSION_INFO_PREFIX = ""; 221 | }; 222 | name = Debug; 223 | }; 224 | ED6CAC411F1EFBC400CA3BE2 /* Release */ = { 225 | isa = XCBuildConfiguration; 226 | buildSettings = { 227 | ALWAYS_SEARCH_USER_PATHS = NO; 228 | CLANG_ANALYZER_NONNULL = YES; 229 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 230 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 231 | CLANG_CXX_LIBRARY = "libc++"; 232 | CLANG_ENABLE_MODULES = YES; 233 | CLANG_ENABLE_OBJC_ARC = YES; 234 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 235 | CLANG_WARN_BOOL_CONVERSION = YES; 236 | CLANG_WARN_COMMA = YES; 237 | CLANG_WARN_CONSTANT_CONVERSION = YES; 238 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 239 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 240 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 241 | CLANG_WARN_EMPTY_BODY = YES; 242 | CLANG_WARN_ENUM_CONVERSION = YES; 243 | CLANG_WARN_INFINITE_RECURSION = YES; 244 | CLANG_WARN_INT_CONVERSION = YES; 245 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 246 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 247 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 248 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 249 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 250 | CLANG_WARN_STRICT_PROTOTYPES = YES; 251 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 252 | CLANG_WARN_UNREACHABLE_CODE = YES; 253 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 254 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 255 | COPY_PHASE_STRIP = NO; 256 | CURRENT_PROJECT_VERSION = 1; 257 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 258 | ENABLE_NS_ASSERTIONS = NO; 259 | ENABLE_STRICT_OBJC_MSGSEND = YES; 260 | GCC_C_LANGUAGE_STANDARD = gnu99; 261 | GCC_NO_COMMON_BLOCKS = YES; 262 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 263 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 264 | GCC_WARN_UNDECLARED_SELECTOR = YES; 265 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 266 | GCC_WARN_UNUSED_FUNCTION = YES; 267 | GCC_WARN_UNUSED_VARIABLE = YES; 268 | IPHONEOS_DEPLOYMENT_TARGET = 10.3; 269 | MTL_ENABLE_DEBUG_INFO = NO; 270 | SDKROOT = iphoneos; 271 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 272 | SWIFT_VERSION = 4.2; 273 | TARGETED_DEVICE_FAMILY = "1,2"; 274 | VALIDATE_PRODUCT = YES; 275 | VERSIONING_SYSTEM = "apple-generic"; 276 | VERSION_INFO_PREFIX = ""; 277 | }; 278 | name = Release; 279 | }; 280 | ED6CAC431F1EFBC400CA3BE2 /* Debug */ = { 281 | isa = XCBuildConfiguration; 282 | buildSettings = { 283 | CLANG_ENABLE_MODULES = YES; 284 | CODE_SIGN_IDENTITY = ""; 285 | DEFINES_MODULE = YES; 286 | DYLIB_COMPATIBILITY_VERSION = 1; 287 | DYLIB_CURRENT_VERSION = 1; 288 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 289 | INFOPLIST_FILE = PictureInPicture/Info.plist; 290 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 291 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 292 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 293 | PRODUCT_BUNDLE_IDENTIFIER = com.dena.PictureInPicture; 294 | PRODUCT_NAME = "$(TARGET_NAME)"; 295 | SKIP_INSTALL = YES; 296 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 297 | SWIFT_VERSION = 4.2; 298 | }; 299 | name = Debug; 300 | }; 301 | ED6CAC441F1EFBC400CA3BE2 /* Release */ = { 302 | isa = XCBuildConfiguration; 303 | buildSettings = { 304 | CLANG_ENABLE_MODULES = YES; 305 | CODE_SIGN_IDENTITY = ""; 306 | DEFINES_MODULE = YES; 307 | DYLIB_COMPATIBILITY_VERSION = 1; 308 | DYLIB_CURRENT_VERSION = 1; 309 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 310 | INFOPLIST_FILE = PictureInPicture/Info.plist; 311 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 312 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 313 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 314 | PRODUCT_BUNDLE_IDENTIFIER = com.dena.PictureInPicture; 315 | PRODUCT_NAME = "$(TARGET_NAME)"; 316 | SKIP_INSTALL = YES; 317 | SWIFT_VERSION = 4.2; 318 | }; 319 | name = Release; 320 | }; 321 | /* End XCBuildConfiguration section */ 322 | 323 | /* Begin XCConfigurationList section */ 324 | ED6CAC341F1EFBC400CA3BE2 /* Build configuration list for PBXProject "PictureInPicture" */ = { 325 | isa = XCConfigurationList; 326 | buildConfigurations = ( 327 | ED6CAC401F1EFBC400CA3BE2 /* Debug */, 328 | ED6CAC411F1EFBC400CA3BE2 /* Release */, 329 | ); 330 | defaultConfigurationIsVisible = 0; 331 | defaultConfigurationName = Release; 332 | }; 333 | ED6CAC421F1EFBC400CA3BE2 /* Build configuration list for PBXNativeTarget "PictureInPicture" */ = { 334 | isa = XCConfigurationList; 335 | buildConfigurations = ( 336 | ED6CAC431F1EFBC400CA3BE2 /* Debug */, 337 | ED6CAC441F1EFBC400CA3BE2 /* Release */, 338 | ); 339 | defaultConfigurationIsVisible = 0; 340 | defaultConfigurationName = Release; 341 | }; 342 | /* End XCConfigurationList section */ 343 | }; 344 | rootObject = ED6CAC311F1EFBC400CA3BE2 /* Project object */; 345 | } 346 | -------------------------------------------------------------------------------- /Carthage/PictureInPicture/PictureInPicture.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Carthage/PictureInPicture/PictureInPicture.xcodeproj/xcshareddata/xcschemes/Carthage.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 34 | 35 | 45 | 46 | 52 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 70 | 71 | 72 | 73 | 75 | 76 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /Carthage/PictureInPicture/PictureInPicture/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 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | NSPrincipalClass 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Carthage/PictureInPicture/PictureInPicture/PictureInPicture.h: -------------------------------------------------------------------------------- 1 | // 2 | // PictureInPicture.h 3 | // PictureInPicture 4 | // 5 | // Created by Koji Murata on 2017/07/19. 6 | // Copyright © 2017年 Koji Murata. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for PictureInPicture. 12 | FOUNDATION_EXPORT double PictureInPictureVersionNumber; 13 | 14 | //! Project version string for PictureInPicture. 15 | FOUNDATION_EXPORT const unsigned char PictureInPictureVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | 19 | 20 | -------------------------------------------------------------------------------- /Example/PictureInPicture.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 607FACD61AFB9204008FA782 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACD51AFB9204008FA782 /* AppDelegate.swift */; }; 11 | 607FACD81AFB9204008FA782 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACD71AFB9204008FA782 /* ViewController.swift */; }; 12 | 607FACDB1AFB9204008FA782 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 607FACD91AFB9204008FA782 /* Main.storyboard */; }; 13 | 607FACDD1AFB9204008FA782 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 607FACDC1AFB9204008FA782 /* Images.xcassets */; }; 14 | 607FACE01AFB9204008FA782 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 607FACDE1AFB9204008FA782 /* LaunchScreen.xib */; }; 15 | 9A023E28354E376AC4832FFA /* Pods_PictureInPicture_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D91AF708F077009BACA7F01F /* Pods_PictureInPicture_Example.framework */; }; 16 | ED02DDB11F2653D2004599D5 /* ModalViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED02DDB01F2653D2004599D5 /* ModalViewController.swift */; }; 17 | ED02DDB31F26C50E004599D5 /* PushViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED02DDB21F26C50E004599D5 /* PushViewController.swift */; }; 18 | ED6CAC291F1DD42900CA3BE2 /* PictureInPictureViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED6CAC281F1DD42900CA3BE2 /* PictureInPictureViewController.swift */; }; 19 | ED6CAC2B1F1DFA8500CA3BE2 /* NewWindowViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED6CAC2A1F1DFA8500CA3BE2 /* NewWindowViewController.swift */; }; 20 | /* End PBXBuildFile section */ 21 | 22 | /* Begin PBXFileReference section */ 23 | 0BBD74D6811723D18FA0EDA8 /* Pods-PictureInPicture_Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PictureInPicture_Tests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-PictureInPicture_Tests/Pods-PictureInPicture_Tests.debug.xcconfig"; sourceTree = ""; }; 24 | 33172829F01DC6FD6CF37D7F /* Pods-PictureInPicture_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PictureInPicture_Example.release.xcconfig"; path = "Pods/Target Support Files/Pods-PictureInPicture_Example/Pods-PictureInPicture_Example.release.xcconfig"; sourceTree = ""; }; 25 | 491757418407B8E46573C4B6 /* Pods-PictureInPicture_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PictureInPicture_Tests.release.xcconfig"; path = "Pods/Target Support Files/Pods-PictureInPicture_Tests/Pods-PictureInPicture_Tests.release.xcconfig"; sourceTree = ""; }; 26 | 607FACD01AFB9204008FA782 /* PictureInPicture_Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PictureInPicture_Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; 27 | 607FACD41AFB9204008FA782 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 28 | 607FACD51AFB9204008FA782 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 29 | 607FACD71AFB9204008FA782 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 30 | 607FACDA1AFB9204008FA782 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 31 | 607FACDC1AFB9204008FA782 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 32 | 607FACDF1AFB9204008FA782 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 33 | BCE1B29A454A558CC4B634FB /* PictureInPicture.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = PictureInPicture.podspec; path = ../PictureInPicture.podspec; sourceTree = ""; }; 34 | D7BE635C8EF391B207724EC3 /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = ""; }; 35 | D91AF708F077009BACA7F01F /* Pods_PictureInPicture_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_PictureInPicture_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 36 | E6ADB58CEEECCFA151B509E1 /* Pods_PictureInPicture_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_PictureInPicture_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 37 | ED02DDB01F2653D2004599D5 /* ModalViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ModalViewController.swift; sourceTree = ""; }; 38 | ED02DDB21F26C50E004599D5 /* PushViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PushViewController.swift; sourceTree = ""; }; 39 | ED6CAC281F1DD42900CA3BE2 /* PictureInPictureViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PictureInPictureViewController.swift; sourceTree = ""; }; 40 | ED6CAC2A1F1DFA8500CA3BE2 /* NewWindowViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NewWindowViewController.swift; sourceTree = ""; }; 41 | FA8B54E2DCC3EC3A09045C6E /* Pods-PictureInPicture_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PictureInPicture_Example.debug.xcconfig"; path = "Pods/Target Support Files/Pods-PictureInPicture_Example/Pods-PictureInPicture_Example.debug.xcconfig"; sourceTree = ""; }; 42 | FBC4F9E6C340776BCA072F2B /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = ""; }; 43 | /* End PBXFileReference section */ 44 | 45 | /* Begin PBXFrameworksBuildPhase section */ 46 | 607FACCD1AFB9204008FA782 /* Frameworks */ = { 47 | isa = PBXFrameworksBuildPhase; 48 | buildActionMask = 2147483647; 49 | files = ( 50 | 9A023E28354E376AC4832FFA /* Pods_PictureInPicture_Example.framework in Frameworks */, 51 | ); 52 | runOnlyForDeploymentPostprocessing = 0; 53 | }; 54 | /* End PBXFrameworksBuildPhase section */ 55 | 56 | /* Begin PBXGroup section */ 57 | 5D0BE12EC10A3E16D7EFCFF6 /* Pods */ = { 58 | isa = PBXGroup; 59 | children = ( 60 | FA8B54E2DCC3EC3A09045C6E /* Pods-PictureInPicture_Example.debug.xcconfig */, 61 | 33172829F01DC6FD6CF37D7F /* Pods-PictureInPicture_Example.release.xcconfig */, 62 | 0BBD74D6811723D18FA0EDA8 /* Pods-PictureInPicture_Tests.debug.xcconfig */, 63 | 491757418407B8E46573C4B6 /* Pods-PictureInPicture_Tests.release.xcconfig */, 64 | ); 65 | name = Pods; 66 | sourceTree = ""; 67 | }; 68 | 607FACC71AFB9204008FA782 = { 69 | isa = PBXGroup; 70 | children = ( 71 | 607FACF51AFB993E008FA782 /* Podspec Metadata */, 72 | 607FACD21AFB9204008FA782 /* Example for PictureInPicture */, 73 | 607FACD11AFB9204008FA782 /* Products */, 74 | 5D0BE12EC10A3E16D7EFCFF6 /* Pods */, 75 | 83DCAE5DE9E3E5BBD472A34A /* Frameworks */, 76 | ); 77 | sourceTree = ""; 78 | }; 79 | 607FACD11AFB9204008FA782 /* Products */ = { 80 | isa = PBXGroup; 81 | children = ( 82 | 607FACD01AFB9204008FA782 /* PictureInPicture_Example.app */, 83 | ); 84 | name = Products; 85 | sourceTree = ""; 86 | }; 87 | 607FACD21AFB9204008FA782 /* Example for PictureInPicture */ = { 88 | isa = PBXGroup; 89 | children = ( 90 | 607FACD51AFB9204008FA782 /* AppDelegate.swift */, 91 | 607FACD71AFB9204008FA782 /* ViewController.swift */, 92 | ED6CAC281F1DD42900CA3BE2 /* PictureInPictureViewController.swift */, 93 | ED6CAC2A1F1DFA8500CA3BE2 /* NewWindowViewController.swift */, 94 | ED02DDB01F2653D2004599D5 /* ModalViewController.swift */, 95 | ED02DDB21F26C50E004599D5 /* PushViewController.swift */, 96 | 607FACD91AFB9204008FA782 /* Main.storyboard */, 97 | 607FACDC1AFB9204008FA782 /* Images.xcassets */, 98 | 607FACDE1AFB9204008FA782 /* LaunchScreen.xib */, 99 | 607FACD31AFB9204008FA782 /* Supporting Files */, 100 | ); 101 | name = "Example for PictureInPicture"; 102 | path = PictureInPicture; 103 | sourceTree = ""; 104 | }; 105 | 607FACD31AFB9204008FA782 /* Supporting Files */ = { 106 | isa = PBXGroup; 107 | children = ( 108 | 607FACD41AFB9204008FA782 /* Info.plist */, 109 | ); 110 | name = "Supporting Files"; 111 | sourceTree = ""; 112 | }; 113 | 607FACF51AFB993E008FA782 /* Podspec Metadata */ = { 114 | isa = PBXGroup; 115 | children = ( 116 | BCE1B29A454A558CC4B634FB /* PictureInPicture.podspec */, 117 | D7BE635C8EF391B207724EC3 /* README.md */, 118 | FBC4F9E6C340776BCA072F2B /* LICENSE */, 119 | ); 120 | name = "Podspec Metadata"; 121 | sourceTree = ""; 122 | }; 123 | 83DCAE5DE9E3E5BBD472A34A /* Frameworks */ = { 124 | isa = PBXGroup; 125 | children = ( 126 | D91AF708F077009BACA7F01F /* Pods_PictureInPicture_Example.framework */, 127 | E6ADB58CEEECCFA151B509E1 /* Pods_PictureInPicture_Tests.framework */, 128 | ); 129 | name = Frameworks; 130 | sourceTree = ""; 131 | }; 132 | /* End PBXGroup section */ 133 | 134 | /* Begin PBXNativeTarget section */ 135 | 607FACCF1AFB9204008FA782 /* PictureInPicture_Example */ = { 136 | isa = PBXNativeTarget; 137 | buildConfigurationList = 607FACEF1AFB9204008FA782 /* Build configuration list for PBXNativeTarget "PictureInPicture_Example" */; 138 | buildPhases = ( 139 | 55DA8498F430892EFB885A4D /* [CP] Check Pods Manifest.lock */, 140 | 607FACCC1AFB9204008FA782 /* Sources */, 141 | 607FACCD1AFB9204008FA782 /* Frameworks */, 142 | 607FACCE1AFB9204008FA782 /* Resources */, 143 | 1DA1ABF991C9CDD0F5080CCB /* [CP] Embed Pods Frameworks */, 144 | 6FD9EEC8CA4095E8843961DF /* [CP] Copy Pods Resources */, 145 | ); 146 | buildRules = ( 147 | ); 148 | dependencies = ( 149 | ); 150 | name = PictureInPicture_Example; 151 | productName = PictureInPicture; 152 | productReference = 607FACD01AFB9204008FA782 /* PictureInPicture_Example.app */; 153 | productType = "com.apple.product-type.application"; 154 | }; 155 | /* End PBXNativeTarget section */ 156 | 157 | /* Begin PBXProject section */ 158 | 607FACC81AFB9204008FA782 /* Project object */ = { 159 | isa = PBXProject; 160 | attributes = { 161 | LastSwiftUpdateCheck = 0720; 162 | LastUpgradeCheck = 1000; 163 | ORGANIZATIONNAME = CocoaPods; 164 | TargetAttributes = { 165 | 607FACCF1AFB9204008FA782 = { 166 | CreatedOnToolsVersion = 6.3.1; 167 | DevelopmentTeam = 582LEGWZJK; 168 | LastSwiftMigration = 1000; 169 | ProvisioningStyle = Manual; 170 | }; 171 | }; 172 | }; 173 | buildConfigurationList = 607FACCB1AFB9204008FA782 /* Build configuration list for PBXProject "PictureInPicture" */; 174 | compatibilityVersion = "Xcode 3.2"; 175 | developmentRegion = English; 176 | hasScannedForEncodings = 0; 177 | knownRegions = ( 178 | en, 179 | Base, 180 | ); 181 | mainGroup = 607FACC71AFB9204008FA782; 182 | productRefGroup = 607FACD11AFB9204008FA782 /* Products */; 183 | projectDirPath = ""; 184 | projectRoot = ""; 185 | targets = ( 186 | 607FACCF1AFB9204008FA782 /* PictureInPicture_Example */, 187 | ); 188 | }; 189 | /* End PBXProject section */ 190 | 191 | /* Begin PBXResourcesBuildPhase section */ 192 | 607FACCE1AFB9204008FA782 /* Resources */ = { 193 | isa = PBXResourcesBuildPhase; 194 | buildActionMask = 2147483647; 195 | files = ( 196 | 607FACDB1AFB9204008FA782 /* Main.storyboard in Resources */, 197 | 607FACE01AFB9204008FA782 /* LaunchScreen.xib in Resources */, 198 | 607FACDD1AFB9204008FA782 /* Images.xcassets in Resources */, 199 | ); 200 | runOnlyForDeploymentPostprocessing = 0; 201 | }; 202 | /* End PBXResourcesBuildPhase section */ 203 | 204 | /* Begin PBXShellScriptBuildPhase section */ 205 | 1DA1ABF991C9CDD0F5080CCB /* [CP] Embed Pods Frameworks */ = { 206 | isa = PBXShellScriptBuildPhase; 207 | buildActionMask = 2147483647; 208 | files = ( 209 | ); 210 | inputPaths = ( 211 | ); 212 | name = "[CP] Embed Pods Frameworks"; 213 | outputPaths = ( 214 | ); 215 | runOnlyForDeploymentPostprocessing = 0; 216 | shellPath = /bin/sh; 217 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-PictureInPicture_Example/Pods-PictureInPicture_Example-frameworks.sh\"\n"; 218 | showEnvVarsInLog = 0; 219 | }; 220 | 55DA8498F430892EFB885A4D /* [CP] Check Pods Manifest.lock */ = { 221 | isa = PBXShellScriptBuildPhase; 222 | buildActionMask = 2147483647; 223 | files = ( 224 | ); 225 | inputPaths = ( 226 | ); 227 | name = "[CP] Check Pods Manifest.lock"; 228 | outputPaths = ( 229 | ); 230 | runOnlyForDeploymentPostprocessing = 0; 231 | shellPath = /bin/sh; 232 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; 233 | showEnvVarsInLog = 0; 234 | }; 235 | 6FD9EEC8CA4095E8843961DF /* [CP] Copy Pods Resources */ = { 236 | isa = PBXShellScriptBuildPhase; 237 | buildActionMask = 2147483647; 238 | files = ( 239 | ); 240 | inputPaths = ( 241 | ); 242 | name = "[CP] Copy Pods Resources"; 243 | outputPaths = ( 244 | ); 245 | runOnlyForDeploymentPostprocessing = 0; 246 | shellPath = /bin/sh; 247 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-PictureInPicture_Example/Pods-PictureInPicture_Example-resources.sh\"\n"; 248 | showEnvVarsInLog = 0; 249 | }; 250 | /* End PBXShellScriptBuildPhase section */ 251 | 252 | /* Begin PBXSourcesBuildPhase section */ 253 | 607FACCC1AFB9204008FA782 /* Sources */ = { 254 | isa = PBXSourcesBuildPhase; 255 | buildActionMask = 2147483647; 256 | files = ( 257 | 607FACD81AFB9204008FA782 /* ViewController.swift in Sources */, 258 | ED02DDB11F2653D2004599D5 /* ModalViewController.swift in Sources */, 259 | ED02DDB31F26C50E004599D5 /* PushViewController.swift in Sources */, 260 | ED6CAC2B1F1DFA8500CA3BE2 /* NewWindowViewController.swift in Sources */, 261 | 607FACD61AFB9204008FA782 /* AppDelegate.swift in Sources */, 262 | ED6CAC291F1DD42900CA3BE2 /* PictureInPictureViewController.swift in Sources */, 263 | ); 264 | runOnlyForDeploymentPostprocessing = 0; 265 | }; 266 | /* End PBXSourcesBuildPhase section */ 267 | 268 | /* Begin PBXVariantGroup section */ 269 | 607FACD91AFB9204008FA782 /* Main.storyboard */ = { 270 | isa = PBXVariantGroup; 271 | children = ( 272 | 607FACDA1AFB9204008FA782 /* Base */, 273 | ); 274 | name = Main.storyboard; 275 | sourceTree = ""; 276 | }; 277 | 607FACDE1AFB9204008FA782 /* LaunchScreen.xib */ = { 278 | isa = PBXVariantGroup; 279 | children = ( 280 | 607FACDF1AFB9204008FA782 /* Base */, 281 | ); 282 | name = LaunchScreen.xib; 283 | sourceTree = ""; 284 | }; 285 | /* End PBXVariantGroup section */ 286 | 287 | /* Begin XCBuildConfiguration section */ 288 | 607FACED1AFB9204008FA782 /* Debug */ = { 289 | isa = XCBuildConfiguration; 290 | buildSettings = { 291 | ALWAYS_SEARCH_USER_PATHS = NO; 292 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 293 | CLANG_CXX_LIBRARY = "libc++"; 294 | CLANG_ENABLE_MODULES = YES; 295 | CLANG_ENABLE_OBJC_ARC = YES; 296 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 297 | CLANG_WARN_BOOL_CONVERSION = YES; 298 | CLANG_WARN_COMMA = YES; 299 | CLANG_WARN_CONSTANT_CONVERSION = YES; 300 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 301 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 302 | CLANG_WARN_EMPTY_BODY = YES; 303 | CLANG_WARN_ENUM_CONVERSION = YES; 304 | CLANG_WARN_INFINITE_RECURSION = YES; 305 | CLANG_WARN_INT_CONVERSION = YES; 306 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 307 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 308 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 309 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 310 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 311 | CLANG_WARN_STRICT_PROTOTYPES = YES; 312 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 313 | CLANG_WARN_UNREACHABLE_CODE = YES; 314 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 315 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 316 | COPY_PHASE_STRIP = NO; 317 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 318 | ENABLE_STRICT_OBJC_MSGSEND = YES; 319 | ENABLE_TESTABILITY = YES; 320 | GCC_C_LANGUAGE_STANDARD = gnu99; 321 | GCC_DYNAMIC_NO_PIC = NO; 322 | GCC_NO_COMMON_BLOCKS = YES; 323 | GCC_OPTIMIZATION_LEVEL = 0; 324 | GCC_PREPROCESSOR_DEFINITIONS = ( 325 | "DEBUG=1", 326 | "$(inherited)", 327 | ); 328 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 329 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 330 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 331 | GCC_WARN_UNDECLARED_SELECTOR = YES; 332 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 333 | GCC_WARN_UNUSED_FUNCTION = YES; 334 | GCC_WARN_UNUSED_VARIABLE = YES; 335 | IPHONEOS_DEPLOYMENT_TARGET = 8.3; 336 | MTL_ENABLE_DEBUG_INFO = YES; 337 | ONLY_ACTIVE_ARCH = YES; 338 | SDKROOT = iphoneos; 339 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 340 | }; 341 | name = Debug; 342 | }; 343 | 607FACEE1AFB9204008FA782 /* Release */ = { 344 | isa = XCBuildConfiguration; 345 | buildSettings = { 346 | ALWAYS_SEARCH_USER_PATHS = NO; 347 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 348 | CLANG_CXX_LIBRARY = "libc++"; 349 | CLANG_ENABLE_MODULES = YES; 350 | CLANG_ENABLE_OBJC_ARC = YES; 351 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 352 | CLANG_WARN_BOOL_CONVERSION = YES; 353 | CLANG_WARN_COMMA = YES; 354 | CLANG_WARN_CONSTANT_CONVERSION = YES; 355 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 356 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 357 | CLANG_WARN_EMPTY_BODY = YES; 358 | CLANG_WARN_ENUM_CONVERSION = YES; 359 | CLANG_WARN_INFINITE_RECURSION = YES; 360 | CLANG_WARN_INT_CONVERSION = YES; 361 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 362 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 363 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 364 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 365 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 366 | CLANG_WARN_STRICT_PROTOTYPES = YES; 367 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 368 | CLANG_WARN_UNREACHABLE_CODE = YES; 369 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 370 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 371 | COPY_PHASE_STRIP = NO; 372 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 373 | ENABLE_NS_ASSERTIONS = NO; 374 | ENABLE_STRICT_OBJC_MSGSEND = YES; 375 | GCC_C_LANGUAGE_STANDARD = gnu99; 376 | GCC_NO_COMMON_BLOCKS = YES; 377 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 378 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 379 | GCC_WARN_UNDECLARED_SELECTOR = YES; 380 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 381 | GCC_WARN_UNUSED_FUNCTION = YES; 382 | GCC_WARN_UNUSED_VARIABLE = YES; 383 | IPHONEOS_DEPLOYMENT_TARGET = 8.3; 384 | MTL_ENABLE_DEBUG_INFO = NO; 385 | SDKROOT = iphoneos; 386 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 387 | VALIDATE_PRODUCT = YES; 388 | }; 389 | name = Release; 390 | }; 391 | 607FACF01AFB9204008FA782 /* Debug */ = { 392 | isa = XCBuildConfiguration; 393 | baseConfigurationReference = FA8B54E2DCC3EC3A09045C6E /* Pods-PictureInPicture_Example.debug.xcconfig */; 394 | buildSettings = { 395 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 396 | DEVELOPMENT_TEAM = 582LEGWZJK; 397 | INFOPLIST_FILE = PictureInPicture/Info.plist; 398 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 399 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 400 | MODULE_NAME = ExampleApp; 401 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)"; 402 | PRODUCT_NAME = "$(TARGET_NAME)"; 403 | PROVISIONING_PROFILE = "4a683f7e-1cb6-4e53-8d93-7a452181cef6"; 404 | PROVISIONING_PROFILE_SPECIFIER = "ent-*"; 405 | SWIFT_VERSION = 4.2; 406 | }; 407 | name = Debug; 408 | }; 409 | 607FACF11AFB9204008FA782 /* Release */ = { 410 | isa = XCBuildConfiguration; 411 | baseConfigurationReference = 33172829F01DC6FD6CF37D7F /* Pods-PictureInPicture_Example.release.xcconfig */; 412 | buildSettings = { 413 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 414 | DEVELOPMENT_TEAM = ""; 415 | INFOPLIST_FILE = PictureInPicture/Info.plist; 416 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 417 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 418 | MODULE_NAME = ExampleApp; 419 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)"; 420 | PRODUCT_NAME = "$(TARGET_NAME)"; 421 | PROVISIONING_PROFILE_SPECIFIER = ""; 422 | SWIFT_VERSION = 4.2; 423 | }; 424 | name = Release; 425 | }; 426 | /* End XCBuildConfiguration section */ 427 | 428 | /* Begin XCConfigurationList section */ 429 | 607FACCB1AFB9204008FA782 /* Build configuration list for PBXProject "PictureInPicture" */ = { 430 | isa = XCConfigurationList; 431 | buildConfigurations = ( 432 | 607FACED1AFB9204008FA782 /* Debug */, 433 | 607FACEE1AFB9204008FA782 /* Release */, 434 | ); 435 | defaultConfigurationIsVisible = 0; 436 | defaultConfigurationName = Release; 437 | }; 438 | 607FACEF1AFB9204008FA782 /* Build configuration list for PBXNativeTarget "PictureInPicture_Example" */ = { 439 | isa = XCConfigurationList; 440 | buildConfigurations = ( 441 | 607FACF01AFB9204008FA782 /* Debug */, 442 | 607FACF11AFB9204008FA782 /* Release */, 443 | ); 444 | defaultConfigurationIsVisible = 0; 445 | defaultConfigurationName = Release; 446 | }; 447 | /* End XCConfigurationList section */ 448 | }; 449 | rootObject = 607FACC81AFB9204008FA782 /* Project object */; 450 | } 451 | -------------------------------------------------------------------------------- /Example/PictureInPicture.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Example/PictureInPicture.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Example/PictureInPicture/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // PictureInPicture 4 | // 5 | // Created by Koji Murata on 07/17/2017. 6 | // Copyright (c) 2017 Koji Murata. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import PictureInPicture 11 | 12 | @UIApplicationMain 13 | class AppDelegate: UIResponder, UIApplicationDelegate { 14 | 15 | var window: UIWindow? 16 | 17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 18 | let shadowConfig = PictureInPicture.ShadowConfig(color: .black, offset: .zero, radius: 10, opacity: 1) 19 | PictureInPicture.configure(movable: true, scale: 0.3, margin: 10, defaultEdge: .right, shadowConfig: shadowConfig) 20 | return true 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Example/PictureInPicture/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /Example/PictureInPicture/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 | 33 | 40 | 47 | 54 | 61 | 68 | 69 | 70 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 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 | 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 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 221 | 230 | 236 | 245 | 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 | 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 | 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 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | -------------------------------------------------------------------------------- /Example/PictureInPicture/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Example/PictureInPicture/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 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeRight 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /Example/PictureInPicture/ModalViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ModalViewController.swift 3 | // PictureInPicture 4 | // 5 | // Created by Koji Murata on 2017/07/25. 6 | // Copyright © 2017年 CocoaPods. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | final class ModalViewController: UIViewController { 12 | @IBAction private func dismiss() { 13 | dismiss(animated: true, completion: nil) 14 | } 15 | 16 | override func viewWillDisappear(_ animated: Bool) { 17 | super.viewWillDisappear(animated) 18 | print("modal willDisappear") 19 | } 20 | 21 | override func viewDidDisappear(_ animated: Bool) { 22 | super.viewDidDisappear(animated) 23 | print("modal didDisappear") 24 | } 25 | 26 | deinit { 27 | print("modal deinitted") 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Example/PictureInPicture/NewWindowViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // NewWindowViewController.swift 3 | // PictureInPicture 4 | // 5 | // Created by Koji Murata on 2017/07/18. 6 | // Copyright © 2017年 CocoaPods. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | final class NewWindowViewController: UIViewController { 12 | private static var window: UIWindow? 13 | 14 | static func present() { 15 | let w = UIWindow(frame: UIScreen.main.bounds) 16 | w.rootViewController = UIStoryboard(name: "Main", bundle: .main).instantiateViewController(withIdentifier: "NewWindow") 17 | w.makeKeyAndVisible() 18 | window = w 19 | } 20 | 21 | @IBAction func dismiss() { 22 | NewWindowViewController.window = nil 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Example/PictureInPicture/PictureInPictureViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // PictureInPictureViewController.swift 3 | // PictureInPicture 4 | // 5 | // Created by Koji Murata on 2017/07/18. 6 | // Copyright © 2017年 CocoaPods. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import PictureInPicture 11 | 12 | final class PictureInPictureViewController: UIViewController, UITableViewDataSource { 13 | private static var instanceNumber = 0 14 | @IBOutlet weak var instanceNumberLabel: UILabel! { 15 | didSet { 16 | instanceNumberLabel.text = "\(PictureInPictureViewController.instanceNumber)" 17 | PictureInPictureViewController.instanceNumber += 1 18 | } 19 | } 20 | 21 | @IBAction private func dismiss() { 22 | PictureInPicture.shared.dismiss(animation: true) 23 | } 24 | 25 | @IBAction private func makeSmaller() { 26 | PictureInPicture.shared.makeSmaller() 27 | } 28 | 29 | func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 30 | return 20 31 | } 32 | 33 | func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 34 | let cell = tableView.dequeueReusableCell(withIdentifier: "default", for: indexPath) 35 | cell.textLabel?.text = "\(indexPath.row)" 36 | return cell 37 | } 38 | 39 | override var preferredStatusBarStyle: UIStatusBarStyle { 40 | return .lightContent 41 | } 42 | 43 | override func viewWillDisappear(_ animated: Bool) { 44 | super.viewWillDisappear(animated) 45 | print("willDisappear") 46 | } 47 | 48 | override func viewDidDisappear(_ animated: Bool) { 49 | super.viewDidDisappear(animated) 50 | print("didDisappear") 51 | } 52 | 53 | deinit { 54 | print("deinitted") 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /Example/PictureInPicture/PushViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // PushViewController.swift 3 | // PictureInPicture 4 | // 5 | // Created by Koji Murata on 2017/07/25. 6 | // Copyright © 2017年 CocoaPods. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | final class PushViewController: UIViewController { 12 | @IBAction private func back() { 13 | _ = navigationController?.popViewController(animated: true) 14 | } 15 | 16 | override func viewWillDisappear(_ animated: Bool) { 17 | super.viewWillDisappear(animated) 18 | print("push willDisappear") 19 | } 20 | 21 | override func viewDidDisappear(_ animated: Bool) { 22 | super.viewDidDisappear(animated) 23 | print("push didDisappear") 24 | } 25 | 26 | deinit { 27 | print("push deinitted") 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Example/PictureInPicture/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // PictureInPicture 4 | // 5 | // Created by Koji Murata on 07/17/2017. 6 | // Copyright (c) 2017 Koji Murata. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import PictureInPicture 11 | 12 | final class ViewController: UIViewController { 13 | private static var instanceNumber = 0 14 | @IBOutlet weak var instanceNumberLabel: UILabel! { 15 | didSet { 16 | instanceNumberLabel.text = "\(ViewController.instanceNumber)" 17 | ViewController.instanceNumber += 1 18 | } 19 | } 20 | 21 | @IBAction func present() { 22 | PictureInPicture.shared.present(with: UIStoryboard(name: "Main", bundle: .main).instantiateViewController(withIdentifier: "PiP")) 23 | } 24 | 25 | @IBAction func presentWithoutMakingLarger() { 26 | PictureInPicture.shared.present(with: UIStoryboard(name: "Main", bundle: .main).instantiateViewController(withIdentifier: "PiP"), makeLargerIfNeeded: false) 27 | } 28 | 29 | @IBAction func dismiss() { 30 | PictureInPicture.shared.dismiss(animation: true) 31 | } 32 | 33 | @IBAction func changeWindow() { 34 | NewWindowViewController.present() 35 | } 36 | 37 | @IBAction func changeRootViewController() { 38 | UIApplication.shared.keyWindow?.rootViewController = UIStoryboard(name: "Main", bundle: .main).instantiateInitialViewController() 39 | } 40 | 41 | @IBAction func printPresented() { 42 | guard let vc = PictureInPicture.shared.presentedViewController else { 43 | print("nil") 44 | return 45 | } 46 | print(vc) 47 | } 48 | 49 | override func viewWillAppear(_ animated: Bool) { 50 | super.viewWillAppear(animated) 51 | observeNotifications() 52 | } 53 | 54 | override func viewWillDisappear(_ animated: Bool) { 55 | super.viewWillDisappear(animated) 56 | NotificationCenter.default.removeObserver(self) 57 | } 58 | 59 | override var preferredStatusBarStyle: UIStatusBarStyle { 60 | return .default 61 | } 62 | } 63 | 64 | // Notifications 65 | extension ViewController { 66 | fileprivate func observeNotifications() { 67 | NotificationCenter.default.addObserver(self, selector: #selector(pictureInPictureMadeSmaller), name: .PictureInPictureMadeSmaller, object: nil) 68 | NotificationCenter.default.addObserver(self, selector: #selector(pictureInPictureMadeLarger), name: .PictureInPictureMadeLarger, object: nil) 69 | NotificationCenter.default.addObserver(self, selector: #selector(pictureInPictureMoved(_:)), name: .PictureInPictureMoved, object: nil) 70 | NotificationCenter.default.addObserver(self, selector: #selector(pictureInPictureDismissed), name: .PictureInPictureDismissed, object: nil) 71 | NotificationCenter.default.addObserver(self, selector: #selector(pictureInPictureDidBeginMakingSmaller), name: .PictureInPictureDidBeginMakingSmaller, object: nil) 72 | NotificationCenter.default.addObserver(self, selector: #selector(pictureInPictureDidBeginMakingLarger), name: .PictureInPictureDidBeginMakingLarger, object: nil) 73 | } 74 | 75 | @objc private func pictureInPictureMadeSmaller() { 76 | print("pictureInPictureMadeSmaller") 77 | } 78 | 79 | @objc private func pictureInPictureMadeLarger() { 80 | print("pictureInPictureMadeLarger") 81 | } 82 | 83 | @objc private func pictureInPictureMoved(_ notification: Notification) { 84 | let userInfo = notification.userInfo! 85 | let oldCorner = userInfo[PictureInPictureOldCornerUserInfoKey] as! PictureInPicture.Corner 86 | let newCorner = userInfo[PictureInPictureNewCornerUserInfoKey] as! PictureInPicture.Corner 87 | print("pictureInPictureMoved(old: \(oldCorner), new: \(newCorner))") 88 | } 89 | 90 | @objc private func pictureInPictureDismissed() { 91 | print("pictureInPictureDismissed") 92 | } 93 | 94 | @objc private func pictureInPictureDidBeginMakingSmaller() { 95 | print("pictureInPictureDidBeginMakingSmaller") 96 | } 97 | 98 | @objc private func pictureInPictureDidBeginMakingLarger() { 99 | print("pictureInPictureDidBeginMakingLarger") 100 | } 101 | } 102 | 103 | extension ViewController: UITableViewDataSource { 104 | func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 105 | return 20 106 | } 107 | 108 | func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 109 | let cell = tableView.dequeueReusableCell(withIdentifier: "default", for: indexPath) 110 | cell.textLabel?.text = "\(indexPath.row)" 111 | return cell 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /Example/Podfile: -------------------------------------------------------------------------------- 1 | use_frameworks! 2 | 3 | target 'PictureInPicture_Example' do 4 | pod 'PictureInPicture', :path => '../' 5 | end 6 | -------------------------------------------------------------------------------- /Example/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - PictureInPicture (0.2.2) 3 | 4 | DEPENDENCIES: 5 | - PictureInPicture (from `../`) 6 | 7 | EXTERNAL SOURCES: 8 | PictureInPicture: 9 | :path: "../" 10 | 11 | SPEC CHECKSUMS: 12 | PictureInPicture: 1daae7e1dab1ee6fd2364e458b35e90dde4eada2 13 | 14 | PODFILE CHECKSUM: a975284e0031450c8003cced1715e9d0930887cf 15 | 16 | COCOAPODS: 1.2.1 17 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | source 'https://rubygems.org' 3 | 4 | gem 'cocoapods' 5 | gem 'github_changelog_generator' 6 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: https://rubygems.org/ 3 | specs: 4 | CFPropertyList (2.3.5) 5 | activesupport (4.2.9) 6 | i18n (~> 0.7) 7 | minitest (~> 5.1) 8 | thread_safe (~> 0.3, >= 0.3.4) 9 | tzinfo (~> 1.1) 10 | addressable (2.5.1) 11 | public_suffix (~> 2.0, >= 2.0.2) 12 | claide (1.0.2) 13 | cocoapods (1.3.1) 14 | activesupport (>= 4.0.2, < 5) 15 | claide (>= 1.0.2, < 2.0) 16 | cocoapods-core (= 1.3.1) 17 | cocoapods-deintegrate (>= 1.0.1, < 2.0) 18 | cocoapods-downloader (>= 1.1.3, < 2.0) 19 | cocoapods-plugins (>= 1.0.0, < 2.0) 20 | cocoapods-search (>= 1.0.0, < 2.0) 21 | cocoapods-stats (>= 1.0.0, < 2.0) 22 | cocoapods-trunk (>= 1.2.0, < 2.0) 23 | cocoapods-try (>= 1.1.0, < 2.0) 24 | colored2 (~> 3.1) 25 | escape (~> 0.0.4) 26 | fourflusher (~> 2.0.1) 27 | gh_inspector (~> 1.0) 28 | molinillo (~> 0.5.7) 29 | nap (~> 1.0) 30 | ruby-macho (~> 1.1) 31 | xcodeproj (>= 1.5.1, < 2.0) 32 | cocoapods-core (1.3.1) 33 | activesupport (>= 4.0.2, < 6) 34 | fuzzy_match (~> 2.0.4) 35 | nap (~> 1.0) 36 | cocoapods-deintegrate (1.0.1) 37 | cocoapods-downloader (1.1.3) 38 | cocoapods-plugins (1.0.0) 39 | nap 40 | cocoapods-search (1.0.0) 41 | cocoapods-stats (1.0.0) 42 | cocoapods-trunk (1.2.0) 43 | nap (>= 0.8, < 2.0) 44 | netrc (= 0.7.8) 45 | cocoapods-try (1.1.0) 46 | colored2 (3.1.2) 47 | escape (0.0.4) 48 | faraday (0.12.2) 49 | multipart-post (>= 1.2, < 3) 50 | faraday-http-cache (2.0.0) 51 | faraday (~> 0.8) 52 | fourflusher (2.0.1) 53 | fuzzy_match (2.0.4) 54 | gh_inspector (1.0.3) 55 | github_changelog_generator (1.14.3) 56 | activesupport 57 | faraday-http-cache 58 | multi_json 59 | octokit (~> 4.6) 60 | rainbow (>= 2.1) 61 | rake (>= 10.0) 62 | retriable (~> 2.1) 63 | i18n (0.8.6) 64 | minitest (5.10.3) 65 | molinillo (0.5.7) 66 | multi_json (1.12.1) 67 | multipart-post (2.0.0) 68 | nanaimo (0.2.3) 69 | nap (1.1.0) 70 | netrc (0.7.8) 71 | octokit (4.7.0) 72 | sawyer (~> 0.8.0, >= 0.5.3) 73 | public_suffix (2.0.5) 74 | rainbow (2.2.2) 75 | rake 76 | rake (12.0.0) 77 | retriable (2.1.0) 78 | ruby-macho (1.1.0) 79 | sawyer (0.8.1) 80 | addressable (>= 2.3.5, < 2.6) 81 | faraday (~> 0.8, < 1.0) 82 | thread_safe (0.3.6) 83 | tzinfo (1.2.3) 84 | thread_safe (~> 0.1) 85 | xcodeproj (1.5.1) 86 | CFPropertyList (~> 2.3.3) 87 | claide (>= 1.0.2, < 2.0) 88 | colored2 (~> 3.1) 89 | nanaimo (~> 0.2.3) 90 | 91 | PLATFORMS 92 | ruby 93 | 94 | DEPENDENCIES 95 | cocoapods 96 | github_changelog_generator 97 | 98 | BUNDLED WITH 99 | 1.15.3 100 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2017 Koji Murata 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /PictureInPicture.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # Be sure to run `pod lib lint PictureInPicture.podspec' to ensure this is a 3 | # valid spec before submitting. 4 | # 5 | # Any lines starting with a # are optional, but their use is encouraged 6 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html 7 | # 8 | 9 | Pod::Spec.new do |s| 10 | s.name = 'PictureInPicture' 11 | s.version = '0.3.0' 12 | s.summary = 'Picture in Picture.' 13 | 14 | s.description = <<-DESC 15 | Picture in Picture with your ViewController. 16 | DESC 17 | 18 | s.homepage = 'https://github.com/malt03/PictureInPicture' 19 | s.license = { :type => 'MIT', :file => 'LICENSE' } 20 | s.author = { 'Koji Murata' => 'malt.koji@gmail.com' } 21 | s.source = { :git => 'https://github.com/malt03/PictureInPicture.git', :tag => s.version.to_s } 22 | 23 | s.ios.deployment_target = '8.0' 24 | 25 | s.source_files = 'PictureInPicture/Classes/**/*' 26 | end 27 | -------------------------------------------------------------------------------- /PictureInPicture/Assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/malt03/PictureInPicture/49a63fa7ec44c2dc53d31bf89ef2bd8d2b8ca0cc/PictureInPicture/Assets/.gitkeep -------------------------------------------------------------------------------- /PictureInPicture/Classes/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/malt03/PictureInPicture/49a63fa7ec44c2dc53d31bf89ef2bd8d2b8ca0cc/PictureInPicture/Classes/.gitkeep -------------------------------------------------------------------------------- /PictureInPicture/Classes/FeedbackGenerator.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FeedbackGenerator.swift 3 | // Pods 4 | // 5 | // Created by Koji Murata on 2017/07/20. 6 | // 7 | // 8 | 9 | import UIKit 10 | 11 | final class FeedbackGenerator { 12 | static let shared = FeedbackGenerator() 13 | 14 | private let generatorWrapper: NSObject? 15 | 16 | @available(iOS 10.0, *) 17 | private var generator: UIImpactFeedbackGenerator { 18 | return generatorWrapper as! UIImpactFeedbackGenerator 19 | } 20 | 21 | private init() { 22 | if #available(iOS 10.0, *) { 23 | generatorWrapper = UIImpactFeedbackGenerator(style: .light) 24 | } else { 25 | generatorWrapper = nil 26 | } 27 | } 28 | 29 | func prepare() { 30 | if #available(iOS 10.0, *) { 31 | generator.prepare() 32 | } 33 | } 34 | 35 | func occurred() { 36 | if #available(iOS 10.0, *) { 37 | generator.impactOccurred() 38 | generator.prepare() 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /PictureInPicture/Classes/PictureInPicture.swift: -------------------------------------------------------------------------------- 1 | // 2 | // PictureInPicture.swift 3 | // Pods 4 | // 5 | // Created by Koji Murata on 2017/07/17. 6 | // 7 | // 8 | 9 | import Foundation 10 | 11 | extension Notification.Name { 12 | public static let PictureInPictureMadeSmaller = Notification.Name(rawValue: "PictureInPictureMadeSmaller") 13 | public static let PictureInPictureMadeLarger = Notification.Name(rawValue: "PictureInPictureMadeLarger") 14 | public static let PictureInPictureDidBeginMakingSmaller = Notification.Name(rawValue: "PictureInPictureDidBeginMakingSmaller") 15 | public static let PictureInPictureDidBeginMakingLarger = Notification.Name(rawValue: "PictureInPictureDidBeginMakingLarger") 16 | public static let PictureInPictureMoved = Notification.Name(rawValue: "PictureInPictureMoved") 17 | public static let PictureInPictureDismissed = Notification.Name(rawValue: "PictureInPictureDismissed") 18 | } 19 | 20 | public let PictureInPictureOldCornerUserInfoKey = "PictureInPictureOldCornerUserInfoKey" 21 | public let PictureInPictureNewCornerUserInfoKey = "PictureInPictureNewCornerUserInfoKey" 22 | public let UIWindowLevelPictureInPicture = UIWindow.Level.normal + 1 23 | 24 | public final class PictureInPicture { 25 | public struct ShadowConfig { 26 | let color: UIColor 27 | let offset: CGSize 28 | let radius: CGFloat 29 | let opacity: Float 30 | 31 | public init(color: UIColor = .black, offset: CGSize = .zero, radius: CGFloat = 5, opacity: Float = 0.5) { 32 | self.color = color 33 | self.offset = offset 34 | self.radius = radius 35 | self.opacity = opacity 36 | } 37 | 38 | public static var `default`: ShadowConfig { 39 | return ShadowConfig() 40 | } 41 | } 42 | 43 | public static func configure(movable: Bool = true, 44 | scale: CGFloat = 0.2, 45 | margin: CGFloat = 8, 46 | defaultEdge: HorizontalEdge = .right, 47 | shadowConfig: ShadowConfig = .default) { 48 | self.movable = movable 49 | self.scale = scale 50 | self.margin = margin 51 | self.defaultEdge = defaultEdge 52 | self.shadowConfig = shadowConfig 53 | } 54 | 55 | private(set) static var movable = true 56 | private(set) static var scale = CGFloat(0.2) 57 | private(set) static var margin = CGFloat(8) 58 | private(set) static var shadowConfig = ShadowConfig.default 59 | private static var defaultEdge = HorizontalEdge.right 60 | 61 | static var defaultCorner: Corner { 62 | return Corner(.bottom, defaultEdge) 63 | } 64 | 65 | public static let shared = PictureInPicture() 66 | 67 | public func present(with viewController: UIViewController, makeLargerIfNeeded: Bool = true) { 68 | windowCreateIfNeeded.present(with: viewController, makeLargerIfNeeded: makeLargerIfNeeded) 69 | } 70 | 71 | public func makeLarger() { 72 | window?.applyLarge() 73 | } 74 | 75 | public func makeSmaller() { 76 | window?.applySmall() 77 | } 78 | 79 | public func dismiss(animation: Bool = true) { 80 | window?.dismiss(animation: animation) 81 | window = nil 82 | } 83 | 84 | public var presentedViewController: UIViewController? { 85 | return window?.rootViewController 86 | } 87 | 88 | public var currentCorner: Corner { 89 | return window?.currentCorner ?? PictureInPicture.defaultCorner 90 | } 91 | 92 | private init() { 93 | prepareNotification() 94 | } 95 | 96 | private var windowCreateIfNeeded: PictureInPictureWindow { 97 | if let w = window { return w } 98 | let w = PictureInPictureWindow { 99 | self.keyWindow?.makeKeyAndVisible() 100 | self.window = nil 101 | } 102 | window = w 103 | return w 104 | } 105 | private(set) var window: PictureInPictureWindow? 106 | private var keyWindow = UIApplication.shared.keyWindow 107 | 108 | private func prepareNotification() { 109 | NotificationCenter.default.addObserver(self, selector: #selector(windowDidBecomeKey), name: UIWindow.didBecomeKeyNotification, object: nil) 110 | NotificationCenter.default.addObserver(self, selector: #selector(madeLarger), name: .PictureInPictureMadeLarger, object: nil) 111 | NotificationCenter.default.addObserver(self, selector: #selector(didBeginMakingSmaller), name: .PictureInPictureDidBeginMakingSmaller, object: nil) 112 | } 113 | 114 | @objc private func windowDidBecomeKey() { 115 | if window == UIApplication.shared.keyWindow { return } 116 | keyWindow = UIApplication.shared.keyWindow 117 | } 118 | 119 | @objc private func madeLarger() { 120 | window?.makeKeyAndVisible() 121 | } 122 | 123 | @objc private func didBeginMakingSmaller() { 124 | keyWindow?.makeKeyAndVisible() 125 | } 126 | 127 | public enum HorizontalEdge { 128 | case left 129 | case right 130 | } 131 | 132 | public enum VerticalEdge { 133 | case top 134 | case bottom 135 | } 136 | 137 | public enum Corner { 138 | case topLeft 139 | case topRight 140 | case bottomLeft 141 | case bottomRight 142 | 143 | public var verticalEdge: VerticalEdge { 144 | switch self { 145 | case .topLeft, .topRight: return .top 146 | case .bottomLeft, .bottomRight: return .bottom 147 | } 148 | } 149 | 150 | public var horizontalEdge: HorizontalEdge { 151 | switch self { 152 | case .topLeft, .bottomLeft: return .left 153 | case .topRight, .bottomRight: return .right 154 | } 155 | } 156 | 157 | public init(_ verticalEdge: VerticalEdge, _ horizontalEdge: HorizontalEdge) { 158 | switch verticalEdge { 159 | case .top: 160 | switch horizontalEdge { 161 | case .left: self = .topLeft 162 | case .right: self = .topRight 163 | } 164 | case .bottom: 165 | switch horizontalEdge { 166 | case .left: self = .bottomLeft 167 | case .right: self = .bottomRight 168 | } 169 | } 170 | } 171 | } 172 | } 173 | -------------------------------------------------------------------------------- /PictureInPicture/Classes/PictureInPictureWindow.swift: -------------------------------------------------------------------------------- 1 | // 2 | // PictureInPictureView.swift 3 | // Pods 4 | // 5 | // Created by Koji Murata on 2017/07/17. 6 | // 7 | // 8 | 9 | import UIKit 10 | 11 | final class PictureInPictureWindow: UIWindow { 12 | private var animationDuration: TimeInterval { return 0.2 } 13 | private var beforePresenting = true 14 | 15 | private let userInterfaceShutoutView = UIView() 16 | 17 | func present(with viewController: UIViewController, makeLargerIfNeeded: Bool) { 18 | let handler = { 19 | self.rootViewController = viewController 20 | 21 | if self.beforePresenting { 22 | self.beforePresenting = false 23 | self.bounds = UIScreen.main.bounds 24 | self.frame.origin.y = UIScreen.main.bounds.height 25 | UIView.animate(withDuration: self.animationDuration, delay: 0, options: .curveEaseOut, animations: { 26 | self.frame.origin.y = 0 27 | }, completion: nil) 28 | self.makeKeyAndVisible() 29 | } else if makeLargerIfNeeded { 30 | self.applyLarge() 31 | } 32 | } 33 | if let rootViewController = rootViewController { 34 | rootViewController.dismissPresentedViewControllers(completion: handler) 35 | } else { 36 | handler() 37 | } 38 | } 39 | 40 | func dismiss(animation: Bool) { 41 | if animation { 42 | if isLargeState { 43 | UIView.animate(withDuration: animationDuration, animations: { 44 | self.frame.origin.y = UIScreen.main.bounds.height 45 | }, completion: { _ in 46 | self.rootViewController?.dismissPresentedViewControllers { 47 | self.disposeHandler() 48 | NotificationCenter.default.post(name: .PictureInPictureDismissed, object: nil) 49 | } 50 | }) 51 | } else { 52 | UIView.animate(withDuration: animationDuration, animations: { 53 | self.alpha = 0 54 | }, completion: { _ in 55 | self.rootViewController?.dismissPresentedViewControllers { 56 | self.disposeHandler() 57 | NotificationCenter.default.post(name: .PictureInPictureDismissed, object: nil) 58 | } 59 | }) 60 | } 61 | } else { 62 | self.rootViewController?.dismissPresentedViewControllers { 63 | self.disposeHandler() 64 | NotificationCenter.default.post(name: .PictureInPictureDismissed, object: nil) 65 | } 66 | } 67 | } 68 | 69 | var shadowEnabled = false { 70 | didSet { 71 | if shadowEnabled { 72 | layer.shadowColor = UIColor.black.cgColor 73 | layer.shadowRadius = 5 74 | layer.shadowOpacity = 0.5 75 | } else { 76 | layer.shadowColor = UIColor.clear.cgColor 77 | } 78 | } 79 | } 80 | 81 | private var disposeHandler: (() -> Void) 82 | 83 | init(disposeHandler: @escaping (() -> Void)) { 84 | self.disposeHandler = disposeHandler 85 | 86 | super.init(frame: UIScreen.main.bounds) 87 | 88 | prepareNotifications() 89 | addGestureRecognizers() 90 | 91 | FeedbackGenerator.shared.prepare() 92 | 93 | layer.shadowColor = PictureInPicture.shadowConfig.color.cgColor 94 | layer.shadowOffset = PictureInPicture.shadowConfig.offset 95 | layer.shadowRadius = PictureInPicture.shadowConfig.radius 96 | layer.shadowOpacity = PictureInPicture.shadowConfig.opacity 97 | 98 | windowLevel = UIWindowLevelPictureInPicture 99 | 100 | userInterfaceShutoutView.frame = UIScreen.main.bounds 101 | userInterfaceShutoutView.backgroundColor = .clear 102 | } 103 | 104 | required init?(coder aDecoder: NSCoder) { 105 | disposeHandler = {} 106 | super.init(coder: aDecoder) 107 | } 108 | 109 | private let panGestureRecognizer = UIPanGestureRecognizer() 110 | private let tapGestureRecognizer = UITapGestureRecognizer() 111 | private(set) var currentCorner = PictureInPicture.defaultCorner 112 | 113 | private func addGestureRecognizers() { 114 | panGestureRecognizer.addTarget(self, action: #selector(panned(_:))) 115 | panGestureRecognizer.maximumNumberOfTouches = 1 116 | panGestureRecognizer.delegate = self 117 | tapGestureRecognizer.addTarget(self, action: #selector(tapped)) 118 | addGestureRecognizer(panGestureRecognizer) 119 | addGestureRecognizer(tapGestureRecognizer) 120 | tapGestureRecognizer.isEnabled = false 121 | } 122 | 123 | @objc private func tapped() { 124 | applyLarge() 125 | } 126 | 127 | func applyLarge() { 128 | if isLargeState { return } 129 | currentCorner = PictureInPicture.defaultCorner 130 | NotificationCenter.default.post(name: .PictureInPictureDidBeginMakingLarger, object: nil) 131 | UIView.animate(withDuration: animationDuration, delay: 0, options: .curveEaseOut, animations: { 132 | self.applyTransform(rate: 0) 133 | }, completion: { _ in 134 | NotificationCenter.default.post(name: .PictureInPictureMadeLarger, object: nil) 135 | }) 136 | isLargeState = true 137 | } 138 | 139 | func applySmall() { 140 | if !isLargeState { return } 141 | NotificationCenter.default.post(name: .PictureInPictureDidBeginMakingSmaller, object: nil) 142 | UIView.animate(withDuration: animationDuration, delay: 0, options: .curveEaseOut, animations: { 143 | self.applyTransform(rate: 1) 144 | }, completion: { _ in 145 | NotificationCenter.default.post(name: .PictureInPictureMadeSmaller, object: nil) 146 | }) 147 | isLargeState = false 148 | } 149 | 150 | @objc private func panned(_ sender: UIPanGestureRecognizer) { 151 | switch sender.state { 152 | case .began: 153 | isPanning = true 154 | let velocity = sender.velocity(in: mainWindow) 155 | isPanVectorVertical = abs(velocity.x) < abs(velocity.y) 156 | panChanged(sender) 157 | case .changed: 158 | panChanged(sender) 159 | case .cancelled, .ended: 160 | isPanning = false 161 | panEnded(sender) 162 | default: 163 | break 164 | } 165 | } 166 | 167 | private(set) var isLargeState = true { 168 | didSet { 169 | if isLargeState { 170 | userInterfaceShutoutView.removeFromSuperview() 171 | } else { 172 | addSubview(userInterfaceShutoutView) 173 | } 174 | tapGestureRecognizer.isEnabled = !isLargeState 175 | rootViewController?.setNeedsUpdateConstraints() 176 | } 177 | } 178 | 179 | private var isPanVectorVertical = true 180 | private var isPanning = false 181 | 182 | private var mainWindow: UIWindow { 183 | return UIApplication.shared.delegate!.window!! 184 | } 185 | 186 | private var lastRate = CGFloat(0) 187 | 188 | private func panChanged(_ sender: UIPanGestureRecognizer) { 189 | if isLargeState || !PictureInPicture.movable { 190 | if isPanVectorVertical || isLargeState { 191 | FeedbackGenerator.shared.prepare() 192 | let translation = sender.translation(in: mainWindow).y 193 | let location = sender.location(in: mainWindow).y 194 | let beginningLocation = location - translation 195 | 196 | let rate: CGFloat 197 | 198 | if isLargeState { 199 | rate = min(1, max(0, translation / (locationWhenSmall(y: beginningLocation) - beginningLocation))) 200 | } else { 201 | rate = 1 - min(1, max(0, translation / (locationWhenLarge(y: beginningLocation) - beginningLocation))) 202 | } 203 | 204 | if rate != 1 && lastRate == 1 { NotificationCenter.default.post(name: .PictureInPictureDidBeginMakingLarger, object: nil) } 205 | if rate != 0 && lastRate == 0 { NotificationCenter.default.post(name: .PictureInPictureDidBeginMakingSmaller, object: nil) } 206 | if rate == 0 && lastRate != 0 { NotificationCenter.default.post(name: .PictureInPictureMadeLarger, object: nil) } 207 | if rate == 1 && lastRate != 1 { NotificationCenter.default.post(name: .PictureInPictureMadeSmaller, object: nil) } 208 | applyTransform(rate: rate) 209 | } else { 210 | applyTransform(translate: CGPoint(x: sender.translation(in: mainWindow).x, y: 0)) 211 | } 212 | } else { 213 | applyTransform(corner: currentCorner, translate: sender.translation(in: mainWindow)) 214 | } 215 | } 216 | 217 | private func panEnded(_ sender: UIPanGestureRecognizer) { 218 | if isLargeState || !PictureInPicture.movable { 219 | if isPanVectorVertical || isLargeState { 220 | let translation = sender.translation(in: mainWindow).y 221 | let location = sender.location(in: mainWindow).y 222 | let beginningLocation = location - translation 223 | let endLocation = isLargeState ? locationWhenSmall(y: beginningLocation) : locationWhenLarge(y: beginningLocation) 224 | let velocity = sender.velocity(in: mainWindow).y 225 | 226 | let isApply = (location + velocity * 0.1 - beginningLocation) / (endLocation - beginningLocation) > 0.5 227 | let isToSmall = isLargeState == isApply 228 | 229 | let v: CGFloat 230 | if isApply { 231 | v = velocity / (endLocation - location) 232 | } else { 233 | v = velocity / (beginningLocation - location) 234 | } 235 | 236 | if lastRate != 0 && lastRate != 1 { 237 | FeedbackGenerator.shared.occurred() 238 | 239 | if isToSmall { 240 | UIView.animate(withDuration: animationDuration, delay: 0, usingSpringWithDamping: 0.7, initialSpringVelocity: v, options: .curveEaseIn, animations: { 241 | self.applyTransform(rate: 1) 242 | }, completion: { _ in 243 | NotificationCenter.default.post(name: .PictureInPictureMadeSmaller, object: nil) 244 | }) 245 | } else { 246 | UIView.animate(withDuration: animationDuration, delay: 0, usingSpringWithDamping: 10, initialSpringVelocity: v, options: .curveEaseIn, animations: { 247 | self.applyTransform(rate: 0) 248 | }, completion: { _ in 249 | NotificationCenter.default.post(name: .PictureInPictureMadeLarger, object: nil) 250 | }) 251 | } 252 | } 253 | isLargeState = !isToSmall 254 | } else { 255 | let location = sender.location(in: mainWindow).x 256 | let velocity = sender.velocity(in: mainWindow).x 257 | let locationInFeature = CGPoint(x: location + velocity * 0.2, y: 0) 258 | 259 | if UIScreen.main.bounds.contains(locationInFeature) { 260 | UIView.animate(withDuration: animationDuration, animations: { 261 | self.applyTransform() 262 | }) 263 | } else { 264 | disposeHandler() 265 | let translate = sender.translation(in: mainWindow).x 266 | UIView.animate(withDuration: 1, delay: 0, usingSpringWithDamping: 1, initialSpringVelocity: 1, options: .curveLinear, animations: { 267 | let translateInFeature = CGPoint(x: translate + velocity, y: 0) 268 | self.applyTransform(translate: translateInFeature) 269 | }, completion: { _ in 270 | self.dismiss(animation: false) 271 | }) 272 | } 273 | } 274 | } else { 275 | let location = sender.location(in: mainWindow) 276 | let velocity = sender.velocity(in: mainWindow) 277 | let locationInFeature = CGPoint(x: location.x + velocity.x * 0.05, y: location.y + velocity.y * 0.05) 278 | 279 | if UIScreen.main.bounds.contains(locationInFeature) { 280 | let oldCorner = currentCorner 281 | let v: PictureInPicture.VerticalEdge = locationInFeature.y < UIScreen.main.bounds.height / 2 ? .top : .bottom 282 | let h: PictureInPicture.HorizontalEdge = locationInFeature.x < UIScreen.main.bounds.width / 2 ? .left : .right 283 | currentCorner = PictureInPicture.Corner(v, h) 284 | let newCorner = currentCorner 285 | UIView.animate(withDuration: animationDuration, animations: { 286 | self.applyTransform(corner: self.currentCorner) 287 | }, completion: { _ in 288 | NotificationCenter.default.post(name: .PictureInPictureMoved, object: nil, userInfo: [ 289 | PictureInPictureOldCornerUserInfoKey: oldCorner, 290 | PictureInPictureNewCornerUserInfoKey: newCorner, 291 | ]) 292 | }) 293 | } else { 294 | disposeHandler() 295 | let translate = sender.translation(in: mainWindow) 296 | UIView.animate(withDuration: 0.1, delay: 0, usingSpringWithDamping: 1, initialSpringVelocity: 0.1, options: .curveLinear, animations: { 297 | let translateInFeature = CGPoint(x: translate.x + velocity.x * 0.1, y: translate.y + velocity.y * 0.1) 298 | self.applyTransform(corner: self.currentCorner, translate: translateInFeature) 299 | }, completion: { _ in 300 | self.dismiss(animation: false) 301 | }) 302 | } 303 | } 304 | } 305 | 306 | private var centerEdgeDistance: CGFloat { return 0.5 - PictureInPicture.scale / 2 } 307 | private func locationWhenSmall(y: CGFloat) -> CGFloat { return UIScreen.main.bounds.height - (bounds.height - y) * PictureInPicture.scale - PictureInPicture.margin } 308 | private func locationWhenLarge(y: CGFloat) -> CGFloat { return bounds.height + (PictureInPicture.margin + y - UIScreen.main.bounds.height) / PictureInPicture.scale } 309 | 310 | private func applyTransform(rate: CGFloat = 1, corner: PictureInPicture.Corner = PictureInPicture.defaultCorner, translate: CGPoint = .zero) { 311 | let x: CGFloat 312 | let y: CGFloat 313 | switch corner.horizontalEdge { 314 | case .left: x = rate * (-UIScreen.main.bounds.width * centerEdgeDistance + PictureInPicture.margin) 315 | case .right: x = rate * (UIScreen.main.bounds.width * centerEdgeDistance - PictureInPicture.margin) 316 | } 317 | 318 | switch corner.verticalEdge { 319 | case .top: 320 | let top: CGFloat 321 | if #available(iOS 11.0, *) { 322 | top = mainWindow.safeAreaInsets.top 323 | } else { 324 | top = UIApplication.shared.statusBarFrame.height 325 | } 326 | y = rate * (-UIScreen.main.bounds.height * centerEdgeDistance + PictureInPicture.margin + top) 327 | case .bottom: 328 | let bottom: CGFloat 329 | if #available(iOS 11.0, *) { 330 | bottom = mainWindow.safeAreaInsets.bottom 331 | } else { 332 | bottom = 0 333 | } 334 | y = rate * (UIScreen.main.bounds.height * centerEdgeDistance - PictureInPicture.margin - bottom) 335 | } 336 | center = CGPoint(x: x + translate.x + UIScreen.main.bounds.width / 2, y: y + translate.y + UIScreen.main.bounds.height / 2) 337 | let applyScale = 1 - (1 - PictureInPicture.scale) * rate 338 | transform = CGAffineTransform(scaleX: applyScale, y: applyScale) 339 | lastRate = rate 340 | } 341 | 342 | override var transform: CGAffineTransform { 343 | get { return super.transform } 344 | set { 345 | let oldValue = super.transform 346 | super.transform = newValue 347 | if oldValue.isIdentity != newValue.isIdentity { 348 | bounds.size.height = newValue.isIdentity ? UIScreen.main.bounds.height : UIScreen.main.bounds.height - .leastNonzeroMagnitude 349 | UIApplication.shared.setNeedsStatusBarAppearanceUpdate() 350 | } 351 | } 352 | } 353 | 354 | private func prepareNotifications() { 355 | NotificationCenter.default.addObserver(self, selector: #selector(orientationDidChange), name: UIApplication.didChangeStatusBarOrientationNotification, object: nil) 356 | NotificationCenter.default.addObserver(self, selector: #selector(willChangeStatusBarFrame(_:)), name: UIApplication.willChangeStatusBarFrameNotification, object: nil) 357 | } 358 | 359 | @objc private func orientationDidChange() { 360 | if !isLargeState { 361 | layer.masksToBounds = true 362 | DispatchQueue.main.asyncAfter(deadline: .now() + 0.35) { 363 | self.layer.masksToBounds = false 364 | } 365 | } 366 | 367 | if #available(iOS 11.0, *) { 368 | } else { 369 | bounds = UIScreen.main.bounds 370 | } 371 | applyTransform(rate: isLargeState ? 0 : 1, corner: currentCorner, translate: .zero) 372 | } 373 | 374 | @objc private func willChangeStatusBarFrame(_ notification: Notification) { 375 | if currentCorner.verticalEdge == .bottom || isLargeState || isPanning { return } 376 | UIView.animate(withDuration: 0.35) { 377 | self.applyTransform(corner: self.currentCorner) 378 | } 379 | } 380 | } 381 | 382 | extension PictureInPictureWindow: UIGestureRecognizerDelegate { 383 | override func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool { 384 | if !isLargeState { return true } 385 | guard let panGestureRecognizer = gestureRecognizer as? UIPanGestureRecognizer else { return true } 386 | let velocity = panGestureRecognizer.velocity(in: self) 387 | return abs(velocity.x) < abs(velocity.y) 388 | } 389 | } 390 | -------------------------------------------------------------------------------- /PictureInPicture/Classes/UIApplication+setNeedsStatusBarAppearanceUpdate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIApplication+setNeedsStatusBarAppearanceUpdate.swift 3 | // Pods 4 | // 5 | // Created by Koji Murata on 2017/07/20. 6 | // 7 | // 8 | 9 | import UIKit 10 | 11 | extension UIApplication { 12 | func setNeedsStatusBarAppearanceUpdate() { 13 | windows.forEach { $0.rootViewController?.setNeedsStatusBarAppearanceUpdate() } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /PictureInPicture/Classes/UIViewController+Extensions.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIViewController+Extensions.swift 3 | // Pods 4 | // 5 | // Created by Koji Murata on 2017/07/19. 6 | // 7 | // 8 | 9 | import UIKit 10 | 11 | extension UIViewController { 12 | func setNeedsUpdateConstraints() { 13 | children.forEach { $0.setNeedsUpdateConstraints() } 14 | view.setNeedsUpdateConstraints() 15 | } 16 | 17 | func dismissPresentedViewControllers(completion: @escaping () -> Void) { 18 | if let vc = presentedViewController { 19 | vc.dismissWithPresentedViewController(completion: completion) 20 | } else { 21 | completion() 22 | } 23 | } 24 | 25 | private func dismissWithPresentedViewController(completion: @escaping () -> Void) { 26 | if let vc = presentedViewController { 27 | vc.dismissWithPresentedViewController { 28 | self.dismiss(animated: false, completion: completion) 29 | } 30 | } else { 31 | dismiss(animated: false, completion: completion) 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PictureInPicture 2 | 3 | [![Platform](https://img.shields.io/cocoapods/p/PictureInPicture.svg?style=flat)](http://cocoapods.org/pods/PictureInPicture) 4 | ![Language](https://img.shields.io/badge/language-Swift%204.0-orange.svg) 5 | [![CocoaPods](https://img.shields.io/cocoapods/v/PictureInPicture.svg?style=flat)](http://cocoapods.org/pods/PictureInPicture) 6 | [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) 7 | ![License](https://img.shields.io/github/license/malt03/PictureInPicture.svg?style=flat) 8 | 9 | ![ScreenShot](https://raw.githubusercontent.com/malt03/PictureInPicture/master/README/Screenshot.gif) 10 | 11 | ## Usage 12 | ### Configure 13 | If you want to change from default value. 14 | 15 | ```swift 16 | let shadowConfig = PictureInPicture.ShadowConfig(color: .black, offset: .zero, radius: 10, opacity: 1) 17 | PictureInPicture.configure(movable: true, 18 | scale: 0.3, 19 | margin: 10, 20 | defaultEdge: .left, 21 | shadowConfig: shadowConfig) 22 | ``` 23 | 24 | #### Default Config 25 | ```swift 26 | PictureInPicture.configure(movable: true, 27 | scale: 0.2, 28 | margin: 8, 29 | defaultEdge: .right, 30 | shadowConfig: .default) 31 | ``` 32 | 33 | #### Default Shadow Config 34 | ```swift 35 | ShadowConfig(color: .black, offset: .zero, radius: 5, opacity: 0.5) 36 | ``` 37 | 38 | ### Main Functions 39 | ```swift 40 | PictureInPicture.shared.present(with: viewController) // Present 41 | PictureInPicture.shared.dismiss() // Dismiss 42 | PictureInPicture.shared.makeSmaller() // Make Smaller 43 | PictureInPicture.shared.makeLarger() // Make Larger 44 | PictureInPicture.shared.presentedViewController // Get presented ViewController 45 | ``` 46 | 47 | ### Notifications 48 | - PictureInPictureMadeSmaller 49 | - PictureInPictureMadeLarger 50 | - PictureInPictureDidBeginMakingSmaller 51 | - PictureInPictureDidBeginMakingLarger 52 | - PictureInPictureMoved 53 | - PictureInPictureOldCornerUserInfoKey # PictureInPicture.Corner 54 | - PictureInPictureNewCornerUserInfoKey # PictureInPicture.Corner 55 | - PictureInPictureDismissed 56 | 57 | ### Other Constants 58 | - UIWindowLevelPictureInPicture 59 | 60 | ## Installation 61 | 62 | ### Via CocoaPods 63 | ```ruby 64 | pod "PictureInPicture" 65 | ``` 66 | 67 | ### Via Carthage 68 | ```ruby 69 | github "malt03/PictureInPicture" 70 | ``` 71 | 72 | ## Author 73 | 74 | Koji Murata, malt.koji@gmail.com 75 | 76 | ## License 77 | 78 | PictureInPicture is available under the MIT license. See the LICENSE file for more info. 79 | -------------------------------------------------------------------------------- /README/Screenshot.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/malt03/PictureInPicture/49a63fa7ec44c2dc53d31bf89ef2bd8d2b8ca0cc/README/Screenshot.gif -------------------------------------------------------------------------------- /_Pods.xcodeproj: -------------------------------------------------------------------------------- 1 | Example/Pods/Pods.xcodeproj --------------------------------------------------------------------------------