-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEAT] Updated Project for Swift 5 & Pod support
- Loading branch information
Showing
29 changed files
with
2,278 additions
and
1,830 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
# | ||
# Be sure to run `pod spec lint DraggableFloatingViewController.podspec' to ensure this is a | ||
# valid spec and to remove all comments including this before submitting the spec. | ||
# | ||
# To learn more about Podspec attributes see http://docs.cocoapods.org/specification.html | ||
# To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/ | ||
# | ||
|
||
Pod::Spec.new do |s| | ||
|
||
# ――― Spec Metadata ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # | ||
# | ||
# These will help people to find your library, and whilst it | ||
# can feel like a chore to fill in it's definitely to your advantage. The | ||
# summary should be tweet-length, and the description more in depth. | ||
# | ||
|
||
s.name = "DraggableFloatingViewController" | ||
# s.version = "v1.0" | ||
s.summary = "A short description of DraggableFloatingViewController." | ||
|
||
s.description = <<-DESC | ||
A longer description of DraggableFloatingViewController in Markdown format. | ||
* Think: Why did you write this? What is the focus? What does it do? | ||
* CocoaPods will be using this to generate tags, and improve search results. | ||
* Try to keep it short, snappy and to the point. | ||
* Finally, don't worry about the indent, CocoaPods strips it! | ||
DESC | ||
|
||
s.homepage = "http://github.com/entotsu/DraggableFloatingViewController" | ||
# s.screenshots = "www.example.com/screenshots_1.gif", "www.example.com/screenshots_2.gif" | ||
|
||
|
||
# ――― Spec License ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # | ||
# | ||
# Licensing your code is important. See http://choosealicense.com for more info. | ||
# CocoaPods will detect a license file if there is a named LICENSE* | ||
# Popular ones are 'MIT', 'BSD' and 'Apache License, Version 2.0'. | ||
# | ||
|
||
s.license = "MIT (example)" | ||
# s.license = { :type => "MIT", :file => "FILE_LICENSE" } | ||
|
||
|
||
# ――― Author Metadata ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # | ||
# | ||
# Specify the authors of the library, with email addresses. Email addresses | ||
# of the authors are extracted from the SCM log. E.g. $ git log. CocoaPods also | ||
# accepts just a name if you'd rather not provide an email address. | ||
# | ||
# Specify a social_media_url where others can refer to, for example a twitter | ||
# profile URL. | ||
# | ||
|
||
s.author = { "Sandeep Mukherjee" => "[email protected]" } | ||
# Or just: s.author = "Sandeep Mukherjee" | ||
# s.authors = { "Sandeep Mukherjee" => "[email protected]" } | ||
# s.social_media_url = "http://github.com/vizllx" | ||
|
||
# ――― Platform Specifics ――――――――――――――――――――――――――――――――――――――――――――――――――――――― # | ||
# | ||
# If this Pod runs only on iOS or OS X, then specify the platform and | ||
# the deployment target. You can optionally include the target after the platform. | ||
# | ||
|
||
# s.platform = :ios | ||
s.platform = :ios, "6.0" | ||
|
||
# When using multiple platforms | ||
# s.ios.deployment_target = "5.0" | ||
# s.osx.deployment_target = "10.7" | ||
|
||
|
||
s.source = { :git => "http://github.com/entotsu/DraggableFloatingViewController.git", :tag => "v1.0" } | ||
s.source_files = "Classes", "YouTubeDraggableVideo/Source/*.{h,m}" | ||
# s.exclude_files = "Classes/Exclude" | ||
|
||
# s.public_header_files = "Classes/**/*.h" | ||
|
||
|
||
# ――― Resources ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # | ||
# | ||
# A list of resources included with the Pod. These are copied into the | ||
# target bundle with a build phase script. Anything else will be cleaned. | ||
# You can preserve files from being cleaned, please don't preserve | ||
# non-essential files like tests, examples and documentation. | ||
# | ||
|
||
# s.resource = "icon.png" | ||
# s.resources = "Resources/*.png" | ||
|
||
# s.preserve_paths = "FilesToSave", "MoreFilesToSave" | ||
|
||
|
||
# ――― Project Linking ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # | ||
# | ||
# Link your library with frameworks, or libraries. Libraries do not include | ||
# the lib prefix of their name. | ||
# | ||
|
||
# s.framework = "SomeFramework" | ||
# s.frameworks = "SomeFramework", "AnotherFramework" | ||
|
||
# s.library = "iconv" | ||
# s.libraries = "iconv", "xml2" | ||
|
||
|
||
# ――― Project Settings ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # | ||
# | ||
# If your library depends on compiler flags you can set them in the xcconfig hash | ||
# where they will only apply to your library. If you depend on other Podspecs | ||
# you can include multiple dependencies to ensure it works. | ||
|
||
# s.requires_arc = true | ||
|
||
# s.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" } | ||
# s.dependency "JSONKit", "~> 1.4" | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,179 @@ | ||
# DraggableYoutubeFloatingVideo | ||
|
||
DraggableYoutubeFloatingVideo allows you to play videos on a floating mini window at the bottom of your screen from sites like YouTube, Vimeo & Facebook or custom video url , yes you have to specify URL for that. | ||
|
||
Usage | ||
----- | ||
Initialize from a storyboard id programmatically. Set the video URL , then you're pretty much good to go! Check out the demo app to see how it can be used. | ||
|
||
# DraggableFloatingViewController | ||
|
||
### Like YouTube app | ||
|
||
DraggableFloatingViewController allows you to play videos on a floating mini window at the bottom of your screen from sites like YouTube, Vimeo & Facebook or custom video , yes you have to prepare your video view for that. | ||
|
||
|
||
How it works | ||
------------ | ||
This demo app will animate the view just like Youtube mobile app, while tapping on video a UIView pops up from right corner of the screen and the view can be dragged to right corner through Pan Gesture and more features are there as Youtube iOS app | ||
The view will animate the view just like Youtube mobile app, while tapping on video a UIView pops up from right corner of the screen and the view can be dragged to right corner through Pan Gesture and more features are there as Youtube iOS app | ||
|
||
|
||
Screenshot | ||
------------ | ||
![Output sample](https://github.com/entotsu/DraggableFloatingViewController/raw/master/Screenshot2.gif) | ||
|
||
|
||
|
||
# Usage | ||
|
||
|
||
## extend this class | ||
|
||
#### set your video view in "viewDidLoad" of subclass | ||
|
||
```swift | ||
override func viewDidLoad() { | ||
|
||
self.setupViewsWithVideoView(yourMoivePlayer.view, //UIView | ||
videoViewHeight: yourPlayerHeight, //CGFloat | ||
minimizeButton: yourButton //UIButton | ||
) | ||
|
||
// add your view to bodyView | ||
self.bodyView.addSubview(yourView) | ||
} | ||
``` | ||
|
||
## in parent view controller | ||
|
||
### show | ||
|
||
```swift | ||
func showSecondController() { | ||
removeDraggableFloatingViewController() | ||
self.videoViewController = VideoDetailViewController() | ||
self.videoViewController.delegate = self | ||
self.videoViewController.showVideoViewControllerOnParentVC(self) | ||
} | ||
``` | ||
|
||
|
||
### dismiss | ||
|
||
```swift | ||
func removeDraggableFloatingViewController() { | ||
if self.videoViewController != nil { | ||
self.videoViewController.removeAllViews() | ||
self.videoViewController = nil | ||
} | ||
} | ||
``` | ||
|
||
|
||
|
||
|
||
-------------------------------------------------- | ||
|
||
|
||
# Please edit "info.plist" | ||
To disable swipe down gesture of Notification Center, you need to edit "info.plist" to hide status bar. | ||
http://stackoverflow.com/questions/18059703/cannot-hide-status-bar-in-ios7 | ||
![editInfoPlist](http://i.stack.imgur.com/dM32P.png "editInfoPlist") | ||
|
||
|
||
-------------------------------------------------- | ||
|
||
-------------------------------------------------- | ||
|
||
-------------------------------------------------- | ||
# please override if you want | ||
```swift | ||
override func didExpand() { | ||
showVideoControl() | ||
} | ||
override func didMinimize() { | ||
hideVideoControl() | ||
} | ||
``` | ||
|
||
------------------------------------------------------- | ||
|
||
## Please see demo app | ||
If you want to use this, you have to check this demo app. | ||
|
||
|
||
<!-- | ||
## Minimam example Classes | ||
### Minimam subclass | ||
```swift | ||
class VideoDetailViewController: DraggableFloatingViewController { | ||
var moviePlayer: MPMoviePlayerController! | ||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
// prepare your video player | ||
moviePlayer = MPMoviePlayerController() | ||
// prepare your closing button | ||
let foldBtn = UIButton() | ||
foldBtn.frame = CGRect(x: 0, y: 0, width: 44, height: 44) | ||
foldBtn.setImage(UIImage(named: "DownArrow"), forState: UIControlState.Normal) | ||
// please call this in "viewDidLoad" | ||
self.setupViewsWithVideoView(moviePlayer.view, | ||
videoViewHeight: 160, | ||
foldButton: foldBtn | ||
); | ||
// you can add sub views on bodyView | ||
let testView = UILabel() | ||
testView.frame = CGRect(x: 20, y: 20, width: 100, height: 40) | ||
testView.text = "test view" | ||
self.bodyView.addSubview(testView) | ||
} | ||
// please override if you want | ||
override func didExpand() { | ||
showVideoControl() | ||
} | ||
override func didMinimize() { | ||
hideVideoControl() | ||
} | ||
} | ||
``` | ||
### Minimam parent view controller | ||
```swift | ||
class FirstViewController: UIViewController , DraggableFloatingViewControllerDelegate { | ||
var videoViewController: VideoDetailViewController! | ||
![Output sample](https://github.com/vizllx/DraggableYoutubeFloatingVideo/raw/master/Screenshot.gif) | ||
@IBAction func onTapButton(sender: AnyObject) { | ||
self.showSecondController() | ||
} | ||
override func viewWillDisappear(animated: Bool) { | ||
// when go to fullscreen, this is also called | ||
if !self.videoViewController.isFullScreen() { | ||
removeDraggableFloatingViewController() | ||
} | ||
} | ||
[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/vizllx/draggableyoutubefloatingvideo/trend.png)](https://bitdeli.com/free "Bitdeli Badge") | ||
func showSecondController() { | ||
removeDraggableFloatingViewController() | ||
self.videoViewController = VideoDetailViewController() | ||
self.videoViewController.delegate = self | ||
self.videoViewController.showVideoViewControllerOnParentVC(self) | ||
} | ||
// DraggableFloatingViewControllerDelegate | ||
func removeDraggableFloatingViewController() { | ||
if self.videoViewController != nil { | ||
self.videoViewController.removeAllViews() | ||
self.videoViewController = nil | ||
} | ||
} | ||
} | ||
``` | ||
--> |
Oops, something went wrong.