{"id":16684930,"url":"https://github.com/kofktu/pipkit","last_synced_at":"2025-05-16T07:04:45.563Z","repository":{"id":41156312,"uuid":"160793202","full_name":"Kofktu/PIPKit","owner":"Kofktu","description":"Picture in Picture for iOS","archived":false,"fork":false,"pushed_at":"2024-10-22T05:57:53.000Z","size":17490,"stargazers_count":314,"open_issues_count":11,"forks_count":42,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-05-09T07:07:04.745Z","etag":null,"topics":["carthage","cocoapods","pip","swift"],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Kofktu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-12-07T08:16:38.000Z","updated_at":"2025-05-04T09:12:51.000Z","dependencies_parsed_at":"2024-11-16T20:02:25.849Z","dependency_job_id":"85b42b8d-4be5-4673-bd85-5be3463a07e8","html_url":"https://github.com/Kofktu/PIPKit","commit_stats":{"total_commits":69,"total_committers":3,"mean_commits":23.0,"dds":0.2753623188405797,"last_synced_commit":"3afcc572ed63eb495a138d49a41061404ce08ec3"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kofktu%2FPIPKit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kofktu%2FPIPKit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kofktu%2FPIPKit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kofktu%2FPIPKit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Kofktu","download_url":"https://codeload.github.com/Kofktu/PIPKit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254485055,"owners_count":22078767,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["carthage","cocoapods","pip","swift"],"created_at":"2024-10-12T14:45:32.460Z","updated_at":"2025-05-16T07:04:40.550Z","avatar_url":"https://github.com/Kofktu.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PIPKit\n\n![Swift](https://img.shields.io/badge/Swift-5.0-orange.svg)\n[![CocoaPods](http://img.shields.io/cocoapods/v/PIPKit.svg?style=flat)](http://cocoapods.org/?q=name%3APIPKit%20author%3AKofktu)\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n\u003ca href=\"https://swift.org/package-manager/\"\u003e\u003cimg src=\"https://img.shields.io/badge/SPM-supported-DE5C43.svg?style=flat\"\u003e\u003c/a\u003e\n\n- Picture in Picture for iOS (iPhone, iPad)\n\n![pip_default](/Screenshot/default.gif)\n![pip_transition](/Screenshot/transition.gif)\n\n## Requirements\n- iOS 8.0+\n- Swift 5.0\n- Xcode 11\n\n## Installation\n\n#### CocoaPods\nPIPKit is available through [CocoaPods](http://cocoapods.org). To install\nit, simply add the following line to your Podfile:\n\n```ruby\npod 'PIPKit'\n```\n\n#### Carthage\nFor iOS 8+ projects with [Carthage](https://github.com/Carthage/Carthage)\n\n```\ngithub \"Kofktu/PIPKit\"\n```\n\n### Swift Package Manager\n\nThe [Swift Package Manager](https://swift.org/package-manager/) is a tool for automating the distribution of Swift code and is integrated into the `swift` compiler. It is in early development, but Alamofire does support its use on supported platforms.\n\nOnce you have your Swift package set up, adding `PIPKit` as a dependency is as easy as adding it to the `dependencies` value of your `Package.swift`.\n\n```swift\ndependencies: [\n  .package(url: \"https://github.com/Kofktu/PIPKit.git\", .upToNextMajor(from: \"1.0.0\"))\n]\n```\n\n## Usage\n\n#### PIPUsable\n\n```swift\npublic protocol PIPUsable {\n    var initialState: PIPState { get }\n    var initialPosition: PIPPosition { get }\n    var insetsPIPFromSafeArea: Bool { get }\n    var pipEdgeInsets: UIEdgeInsets { get }\n    var pipSize: CGSize { get }\n    var pipShadow: PIPShadow? { get }\n    var pipCorner: PIPCorner? { get }\n    func didChangedState(_ state: PIPState)\n    func didChangePosition(_ position: PIPPosition)\n}\n\n```\n\n#### PIPKit\n\n```swift\nclass PIPKit {\n    var isPIP: Bool\n    var isActive: Bool\n    var visibleViewController: PIPKitViewController?\n\n    class func show(with viewController: PIPKitViewController, completion: (() -\u003e Void)? = nil)\n    class func dismiss(animated: Bool, completion: (() -\u003e Void)? = nil)\n}\n```\n\n#### PIPKitViewController (UIViewController \u0026 PIPUsable)\n```swift\nfunc setNeedsUpdatePIPFrame()\nfunc startPIPMode()\nfunc stopPIPMode()\n```\n\n## At a Glance\n\n#### Show \u0026 Dismiss\n```swift\nclass PIPViewController: UIViewController, PIPUsable {}\n\nlet viewController = PIPViewController()\nPIPKit.show(with: viewController)\nPIPKit.dismiss(animated: true)\n```\n\n#### Update PIPSize\n\n![pip_resize](/Screenshot/resize.gif)\n\n```swift\nclass PIPViewController: UIViewController, PIPUsable {\n    func updatePIPSize() {\n        pipSize = CGSize()\n        pipEdgeInsets = UIEdgeInsets()\n        setNeedsUpdatePIPFrame()\n    }\n}\n```\n\n#### FullScreen \u003c-\u003e PIP Mode\n```swift\nclass PIPViewController: UIViewController, PIPUsable {\n    func fullScreenAndPIPMode() {\n        if PIPKit.isPIP {\n            stopPIPMode()    \n        } else {\n            startPIPMode()\n        }\n    }\n\n    func didChangedState(_ state: PIPState) {}\n}\n```\n\n## AVPIPKitUsable\nUIView that is capable of Picture-in-Picture in iOS (AVKit.framework)\n\n\u003cimg src=https://user-images.githubusercontent.com/1860205/147901957-8716f857-3f7b-4d76-927f-e218d36137b1.PNG width=300\u003e \u003cimg src=https://user-images.githubusercontent.com/1860205/147901962-aa23c82f-aeeb-4e8e-b840-e70397465f6d.PNG width=300\u003e\n\n### Requirements\n- iOS 15 or higher\n- Info.plist - `Audio, AirPlay and Picture in Picture` in `Background Modes`. For more information, see [Apple Documentation](https://developer.apple.com/documentation/avfoundation/media_playback_and_selection/creating_a_basic_video_player_ios_and_tvos/enabling_background_audio)\n\n### At a Glance\n\n```swift\nvar PIPKit.isAVPIPKitSupported: Bool\n```\n\n#### AVPIPKitRenderer\n\n```swift\nprotocol AVPIPKitRenderer {\n    \n    var policy: AVPIPKitRenderPolicy { get }\n    var renderPublisher: AnyPublisher\u003cUIImage, Never\u003e { get }\n    \n    func start()\n    func stop()\n    \n}\n```\n\n#### AVPIPUIKitUsable\n```swift\nclass View: UIView, AVPIPUIKitUsable {\n\n    var pipTargetView: UIView { self } // Return the subview that you want to show.\n    var renderPolicy: AVPIPKitRenderPolicy {\n        // .once - only once render\n        // .preferredFramesPerSecond - render in frames-per-second\n    }\n}\n\nview.startPictureInPicture()\nview.stopPictureInPicture()\n\nclass ViewController: UIViewController, AVPIPUIKitUsable {\n    var pipTargetView: UIView { view } // Return the subview that you want to show.\n\n    func start() {\n        startPictureInPicture()\n    }\n\n    func stop() {\n        stopPictureInPicture()\n    }\n}\n```\n\n## References\n\n- UIPiPDemo (https://github.com/uakihir0/UIPiPDemo)\n\n## Authors\n\nTaeun Kim (kofktu), \u003ckofktu@gmail.com\u003e\n\n## License\n\nPIPKit is available under the ```MIT``` license. See the ```LICENSE``` file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkofktu%2Fpipkit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkofktu%2Fpipkit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkofktu%2Fpipkit/lists"}