├── .gitignore
├── .travis.yml
├── Example
├── Podfile
├── Podfile.lock
├── Pods
│ ├── Local Podspecs
│ │ └── SZAVPlayer.podspec.json
│ ├── Manifest.lock
│ ├── Pods.xcodeproj
│ │ ├── project.pbxproj
│ │ ├── project.xcworkspace
│ │ │ ├── contents.xcworkspacedata
│ │ │ └── xcshareddata
│ │ │ │ └── IDEWorkspaceChecks.plist
│ │ └── xcshareddata
│ │ │ └── xcschemes
│ │ │ └── SZAVPlayer.xcscheme
│ ├── SZAVPlayer
│ │ ├── LICENSE
│ │ ├── README.md
│ │ └── Sources
│ │ │ └── Classes
│ │ │ ├── Model
│ │ │ ├── SZAVPlayerConfig.swift
│ │ │ ├── SZAVPlayerContentInfo.swift
│ │ │ ├── SZAVPlayerError.swift
│ │ │ ├── SZAVPlayerLocalFileInfo.swift
│ │ │ ├── SZAVPlayerSeekItem.swift
│ │ │ └── SZBaseModel.swift
│ │ │ ├── Request
│ │ │ ├── SZAVPlayerDataLoader.swift
│ │ │ ├── SZAVPlayerItemRequest.swift
│ │ │ └── SZAVPlayerRequestOperation.swift
│ │ │ ├── SZAVPlayer.swift
│ │ │ ├── SZAVPlayerAssetLoader.swift
│ │ │ ├── Storage
│ │ │ ├── SZAVPlayerCache.swift
│ │ │ ├── SZAVPlayerDatabase.swift
│ │ │ ├── SZAVPlayerFileSystem.swift
│ │ │ └── SZDatabase.swift
│ │ │ └── Utils
│ │ │ └── SZLog.swift
│ ├── SnapKit
│ │ ├── LICENSE
│ │ ├── README.md
│ │ └── Source
│ │ │ ├── Constraint.swift
│ │ │ ├── ConstraintAttributes.swift
│ │ │ ├── ConstraintConfig.swift
│ │ │ ├── ConstraintConstantTarget.swift
│ │ │ ├── ConstraintDSL.swift
│ │ │ ├── ConstraintDescription.swift
│ │ │ ├── ConstraintDirectionalInsetTarget.swift
│ │ │ ├── ConstraintDirectionalInsets.swift
│ │ │ ├── ConstraintInsetTarget.swift
│ │ │ ├── ConstraintInsets.swift
│ │ │ ├── ConstraintItem.swift
│ │ │ ├── ConstraintLayoutGuide+Extensions.swift
│ │ │ ├── ConstraintLayoutGuide.swift
│ │ │ ├── ConstraintLayoutGuideDSL.swift
│ │ │ ├── ConstraintLayoutSupport.swift
│ │ │ ├── ConstraintLayoutSupportDSL.swift
│ │ │ ├── ConstraintMaker.swift
│ │ │ ├── ConstraintMakerEditable.swift
│ │ │ ├── ConstraintMakerExtendable.swift
│ │ │ ├── ConstraintMakerFinalizable.swift
│ │ │ ├── ConstraintMakerPriortizable.swift
│ │ │ ├── ConstraintMakerRelatable.swift
│ │ │ ├── ConstraintMultiplierTarget.swift
│ │ │ ├── ConstraintOffsetTarget.swift
│ │ │ ├── ConstraintPriority.swift
│ │ │ ├── ConstraintPriorityTarget.swift
│ │ │ ├── ConstraintRelatableTarget.swift
│ │ │ ├── ConstraintRelation.swift
│ │ │ ├── ConstraintView+Extensions.swift
│ │ │ ├── ConstraintView.swift
│ │ │ ├── ConstraintViewDSL.swift
│ │ │ ├── Debugging.swift
│ │ │ ├── LayoutConstraint.swift
│ │ │ ├── LayoutConstraintItem.swift
│ │ │ ├── Typealiases.swift
│ │ │ └── UILayoutSupport+Extensions.swift
│ └── Target Support Files
│ │ ├── Pods-SZAVPlayer_Example
│ │ ├── Pods-SZAVPlayer_Example-Info.plist
│ │ ├── Pods-SZAVPlayer_Example-acknowledgements.markdown
│ │ ├── Pods-SZAVPlayer_Example-acknowledgements.plist
│ │ ├── Pods-SZAVPlayer_Example-dummy.m
│ │ ├── Pods-SZAVPlayer_Example-frameworks.sh
│ │ ├── Pods-SZAVPlayer_Example-umbrella.h
│ │ ├── Pods-SZAVPlayer_Example.debug.xcconfig
│ │ ├── Pods-SZAVPlayer_Example.modulemap
│ │ └── Pods-SZAVPlayer_Example.release.xcconfig
│ │ ├── Pods-SZAVPlayer_Tests
│ │ ├── Pods-SZAVPlayer_Tests-Info.plist
│ │ ├── Pods-SZAVPlayer_Tests-acknowledgements.markdown
│ │ ├── Pods-SZAVPlayer_Tests-acknowledgements.plist
│ │ ├── Pods-SZAVPlayer_Tests-dummy.m
│ │ ├── Pods-SZAVPlayer_Tests-umbrella.h
│ │ ├── Pods-SZAVPlayer_Tests.debug.xcconfig
│ │ ├── Pods-SZAVPlayer_Tests.modulemap
│ │ └── Pods-SZAVPlayer_Tests.release.xcconfig
│ │ ├── SZAVPlayer
│ │ ├── SZAVPlayer-Info.plist
│ │ ├── SZAVPlayer-dummy.m
│ │ ├── SZAVPlayer-prefix.pch
│ │ ├── SZAVPlayer-umbrella.h
│ │ ├── SZAVPlayer.debug.xcconfig
│ │ ├── SZAVPlayer.modulemap
│ │ ├── SZAVPlayer.release.xcconfig
│ │ └── SZAVPlayer.xcconfig
│ │ └── SnapKit
│ │ ├── SnapKit-Info.plist
│ │ ├── SnapKit-dummy.m
│ │ ├── SnapKit-prefix.pch
│ │ ├── SnapKit-umbrella.h
│ │ ├── SnapKit.debug.xcconfig
│ │ ├── SnapKit.modulemap
│ │ ├── SnapKit.release.xcconfig
│ │ └── SnapKit.xcconfig
├── SZAVPlayer.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ │ └── IDEWorkspaceChecks.plist
│ └── xcshareddata
│ │ └── xcschemes
│ │ └── SZAVPlayer-Example.xcscheme
├── SZAVPlayer.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcshareddata
│ │ ├── IDEWorkspaceChecks.plist
│ │ └── WorkspaceSettings.xcsettings
├── SZAVPlayer
│ ├── AppDelegate.swift
│ ├── AudioView
│ │ ├── AudioPlayerProgressView.swift
│ │ ├── AudioPlayerSlider.swift
│ │ ├── AudioViewController.swift
│ │ └── FakeAudio.swift
│ ├── Base.lproj
│ │ ├── LaunchScreen.xib
│ │ └── Main.storyboard
│ ├── Images.xcassets
│ │ ├── AppIcon.appiconset
│ │ │ └── Contents.json
│ │ ├── Contents.json
│ │ ├── next.imageset
│ │ │ ├── Contents.json
│ │ │ └── next@2x.png
│ │ ├── pause.imageset
│ │ │ ├── Contents.json
│ │ │ └── pause@2x.png
│ │ ├── play.imageset
│ │ │ ├── Contents.json
│ │ │ └── play@2x.png
│ │ └── previous.imageset
│ │ │ ├── Contents.json
│ │ │ └── previous@2x.png
│ ├── Info.plist
│ ├── ListenerCenter
│ │ ├── ListenerCenter.swift
│ │ ├── ListenerNode.swift
│ │ └── ListenerProtocol.swift
│ ├── VideoView
│ │ ├── FakeVideo.swift
│ │ └── VideoViewController.swift
│ └── ViewController.swift
└── Tests
│ ├── Info.plist
│ └── Tests.swift
├── LICENSE
├── MainFlow.jpg
├── Package.swift
├── README.md
├── README_cn.md
├── SZAVPlayer.podspec
├── Sources
├── Assets
│ └── .gitkeep
├── Classes
│ ├── .gitkeep
│ ├── Model
│ │ ├── SZAVPlayerConfig.swift
│ │ ├── SZAVPlayerContentInfo.swift
│ │ ├── SZAVPlayerError.swift
│ │ ├── SZAVPlayerLocalFileInfo.swift
│ │ ├── SZAVPlayerSeekItem.swift
│ │ └── SZBaseModel.swift
│ ├── Request
│ │ ├── SZAVPlayerDataLoader.swift
│ │ ├── SZAVPlayerDataLoaderOperation.swift
│ │ ├── SZAVPlayerItemRequest.swift
│ │ └── SZAVPlayerRequestOperation.swift
│ ├── SZAVPlayer.swift
│ ├── SZAVPlayerAssetLoader.swift
│ ├── Storage
│ │ ├── SZAVPlayerCache.swift
│ │ ├── SZAVPlayerDatabase.swift
│ │ ├── SZAVPlayerFileSystem.swift
│ │ └── SZDatabase.swift
│ └── Utils
│ │ └── SZLog.swift
└── PrivacyInfo.xcprivacy
├── Tests
├── LinuxMain.swift
└── SZAVPlayerTests
│ ├── SZAVPlayerTests.swift
│ └── XCTestManifests.swift
└── _Pods.xcodeproj
/.gitignore:
--------------------------------------------------------------------------------
1 | # OS X
2 | .DS_Store
3 |
4 | # Xcode
5 | build/
6 | .build/
7 | *.pbxuser
8 | !default.pbxuser
9 | *.mode1v3
10 | !default.mode1v3
11 | *.mode2v3
12 | !default.mode2v3
13 | *.perspectivev3
14 | !default.perspectivev3
15 | xcuserdata/
16 | *.xccheckout
17 | profile
18 | *.moved-aside
19 | DerivedData
20 | *.hmap
21 | *.ipa
22 |
23 | # Bundler
24 | .bundle
25 |
26 | # Add this line if you want to avoid checking in source code from Carthage dependencies.
27 | # Carthage/Checkouts
28 |
29 | Carthage/Build
30 |
31 | # We recommend against adding the Pods directory to your .gitignore. However
32 | # you should judge for yourself, the pros and cons are mentioned at:
33 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control
34 | #
35 | # Note: if you ignore the Pods directory, make sure to uncomment
36 | # `pod install` in .travis.yml
37 | #
38 | # Pods/
39 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | # references:
2 | # * https://www.objc.io/issues/6-build-tools/travis-ci/
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 -enableCodeCoverage YES -workspace Example/SZAVPlayer.xcworkspace -scheme SZAVPlayer-Example -sdk iphonesimulator9.3 ONLY_ACTIVE_ARCH=NO | xcpretty
14 | - pod lib lint
15 |
--------------------------------------------------------------------------------
/Example/Podfile:
--------------------------------------------------------------------------------
1 | use_frameworks!
2 |
3 | install! 'cocoapods', :disable_input_output_paths => true
4 |
5 | target 'SZAVPlayer_Example' do
6 | pod 'SZAVPlayer', :path => '../'
7 |
8 | pod 'SnapKit'
9 |
10 | target 'SZAVPlayer_Tests' do
11 | inherit! :search_paths
12 |
13 |
14 | end
15 | end
16 |
--------------------------------------------------------------------------------
/Example/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - SnapKit (5.0.1)
3 | - SZAVPlayer (1.2.0)
4 |
5 | DEPENDENCIES:
6 | - SnapKit
7 | - SZAVPlayer (from `../`)
8 |
9 | SPEC REPOS:
10 | trunk:
11 | - SnapKit
12 |
13 | EXTERNAL SOURCES:
14 | SZAVPlayer:
15 | :path: "../"
16 |
17 | SPEC CHECKSUMS:
18 | SnapKit: 97b92857e3df3a0c71833cce143274bf6ef8e5eb
19 | SZAVPlayer: 22509e3f379401eaeb1ffcd9d2a8c0063470df03
20 |
21 | PODFILE CHECKSUM: 474ca31b1fd0446e12cf70da2d54e0b4622e3259
22 |
23 | COCOAPODS: 1.9.3
24 |
--------------------------------------------------------------------------------
/Example/Pods/Local Podspecs/SZAVPlayer.podspec.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "SZAVPlayer",
3 | "version": "1.2.0",
4 | "summary": "Swift AVPlayer, based on AVAssetResourceLoaderDelegate, support cache.",
5 | "description": "SZAVPlayer is a lightweight audio player library, based on AVPlayer, pure-Swift. Video playing will be supported later.",
6 | "homepage": "https://github.com/eroscai/SZAVPlayer",
7 | "license": {
8 | "type": "MIT",
9 | "file": "LICENSE"
10 | },
11 | "authors": {
12 | "eroscai": "csz0102@gmail.com"
13 | },
14 | "source": {
15 | "git": "https://github.com/eroscai/SZAVPlayer.git",
16 | "tag": "1.2.0"
17 | },
18 | "platforms": {
19 | "ios": "10.0"
20 | },
21 | "swift_versions": "5.0",
22 | "source_files": "Sources/Classes/**/*",
23 | "frameworks": [
24 | "UIKit",
25 | "CoreServices",
26 | "AVFoundation"
27 | ],
28 | "swift_version": "5.0"
29 | }
30 |
--------------------------------------------------------------------------------
/Example/Pods/Manifest.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - SnapKit (5.0.1)
3 | - SZAVPlayer (1.2.0)
4 |
5 | DEPENDENCIES:
6 | - SnapKit
7 | - SZAVPlayer (from `../`)
8 |
9 | SPEC REPOS:
10 | trunk:
11 | - SnapKit
12 |
13 | EXTERNAL SOURCES:
14 | SZAVPlayer:
15 | :path: "../"
16 |
17 | SPEC CHECKSUMS:
18 | SnapKit: 97b92857e3df3a0c71833cce143274bf6ef8e5eb
19 | SZAVPlayer: 22509e3f379401eaeb1ffcd9d2a8c0063470df03
20 |
21 | PODFILE CHECKSUM: 474ca31b1fd0446e12cf70da2d54e0b4622e3259
22 |
23 | COCOAPODS: 1.9.3
24 |
--------------------------------------------------------------------------------
/Example/Pods/Pods.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
--------------------------------------------------------------------------------
/Example/Pods/Pods.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Example/Pods/Pods.xcodeproj/xcshareddata/xcschemes/SZAVPlayer.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
43 |
44 |
50 |
51 |
53 |
54 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/Example/Pods/SZAVPlayer/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2019 eroscai
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 |
--------------------------------------------------------------------------------
/Example/Pods/SZAVPlayer/Sources/Classes/Model/SZAVPlayerConfig.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SZAVPlayerConfig.swift
3 | // SZAVPlayer
4 | //
5 | // Created by CaiSanze on 2020/1/6.
6 | //
7 |
8 | import UIKit
9 | import AVKit
10 |
11 | public struct SZAVPlayerConfig {
12 |
13 | public var urlStr: String // The URL value for playing.
14 | public var uniqueID: String? // The uniqueID to identify wether they are the same audio. If set to nil will use urlStr to create one.
15 | public var isVideo: Bool // Is video or not.
16 | public var isVideoOutputEnabled: Bool // Output video image function enabled or not.
17 | public var timeObserverInterval: Float64 = 1 // TimeObserver interval, default value is 1s.
18 | public var isLocalURL: Bool = false
19 | public var videoGravity: AVLayerVideoGravity = .resizeAspect
20 |
21 | public init(urlStr: String, uniqueID: String?, isVideo: Bool = false, isVideoOutputEnabled: Bool = false) {
22 | self.urlStr = urlStr
23 | self.uniqueID = uniqueID
24 | self.isVideo = isVideo
25 | self.isVideoOutputEnabled = isVideoOutputEnabled
26 | }
27 |
28 | public static var `default`: SZAVPlayerConfig {
29 | return SZAVPlayerConfig(urlStr: "fakeURL.com", uniqueID: nil)
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/Example/Pods/SZAVPlayer/Sources/Classes/Model/SZAVPlayerContentInfo.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SZAVPlayerContentInfo.swift
3 | // SZAVPlayer
4 | //
5 | // Created by CaiSanze on 2019/12/6.
6 | //
7 |
8 | import UIKit
9 |
10 | public struct SZAVPlayerContentInfo: SZBaseModel {
11 |
12 | static let tableName: String = "SZAVPlayerContentInfo"
13 |
14 | var uniqueID: String
15 | var mimeType: String
16 | var contentLength: Int64
17 | var updated: Int64 = 0
18 | var isByteRangeAccessSupported: Bool = false
19 |
20 | static func isNotExpired(updated: Int64) -> Bool {
21 | let expiredTimeInterval = 3600
22 | return Int64(Date().timeIntervalSince1970) - updated <= expiredTimeInterval
23 | }
24 |
25 | }
26 |
27 | extension SZAVPlayerContentInfo: Decodable {
28 |
29 | public init(from decoder: Decoder) throws {
30 | let values = try decoder.container(keyedBy: CodingKeys.self)
31 |
32 | uniqueID = try values.decode(String.self, forKey: .uniqueID)
33 | mimeType = try values.decode(String.self, forKey: .mimeType)
34 | contentLength = try values.decode(Int64.self, forKey: .contentLength)
35 | updated = try values.decode(Int64.self, forKey: .updated)
36 |
37 | let rangeAccessSupportedValue = try values.decode(Int.self, forKey: .isByteRangeAccessSupported)
38 | isByteRangeAccessSupported = rangeAccessSupportedValue == 1 ? true : false
39 | }
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/Example/Pods/SZAVPlayer/Sources/Classes/Model/SZAVPlayerError.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SZAVPlayerError.swift
3 | // SZAVPlayer
4 | //
5 | // Created by CaiSanze on 2019/12/10.
6 | //
7 |
8 | import Foundation
9 |
10 | public enum SZAVPlayerError: Error {
11 | case localFileNotExist
12 | }
13 |
--------------------------------------------------------------------------------
/Example/Pods/SZAVPlayer/Sources/Classes/Model/SZAVPlayerLocalFileInfo.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SZAVPlayerLocalFileInfo.swift
3 | // SZAVPlayer
4 | //
5 | // Created by CaiSanze on 2019/12/6.
6 | //
7 |
8 | import UIKit
9 |
10 | public struct SZAVPlayerLocalFileInfo: SZBaseModel {
11 |
12 | static var tableName: String = "SZAVPlayerLocalFileInfo"
13 |
14 | var uniqueID: String
15 | var startOffset: Int64
16 | var loadedByteLength: Int64
17 | var localFileName: String
18 | var updated: Int64 = 0
19 |
20 | static func newFileName(uniqueID: String) -> String {
21 | let timeInterval = Int64(Date().timeIntervalSince1970 * 1000)
22 |
23 | return "\(timeInterval)"
24 | }
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/Example/Pods/SZAVPlayer/Sources/Classes/Model/SZAVPlayerSeekItem.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SZAVPlayerSeekItem.swift
3 | // SZAVPlayer
4 | //
5 | // Created by CaiSanze on 2019/12/23.
6 | //
7 |
8 | import Foundation
9 |
10 | struct SZAVPlayerSeekItem {
11 |
12 | var time: Float64
13 | var autoPlay: Bool
14 | var completion: SZAVPlayer.SeekCompletion?
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/Example/Pods/SZAVPlayer/Sources/Classes/Model/SZBaseModel.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SZBaseModel.swift
3 | // SZAVPlayer
4 | //
5 | // Created by CaiSanze on 2019/12/13.
6 | //
7 |
8 | import UIKit
9 |
10 | protocol SZBaseModel: Codable {
11 | static var tableName: String { get }
12 | static func deserialize(data: Any) -> Self?
13 | }
14 |
15 | extension SZBaseModel {
16 |
17 | static func deserialize(data: Any) -> Self? {
18 | do {
19 | let jsonData = try JSONSerialization.data(withJSONObject: data, options: [])
20 | let info = try JSONDecoder().decode(Self.self, from: jsonData)
21 | return info
22 | } catch {
23 | SZLogError("\(error)")
24 | }
25 |
26 | return nil
27 | }
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/Example/Pods/SZAVPlayer/Sources/Classes/Request/SZAVPlayerItemRequest.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SZAVPlayerItemRequest.swift
3 | // SZAVPlayer
4 | //
5 | // Created by CaiSanze on 2019/11/28.
6 | //
7 | //
8 |
9 | import Foundation
10 | import AVFoundation
11 |
12 | protocol SZAVPlayerRequest: AnyObject {
13 |
14 | var resourceUrl: URL { get }
15 | var loadingRequest: AVAssetResourceLoadingRequest { get }
16 |
17 | func cancel()
18 |
19 | }
20 |
21 | class SZAVPlayerContentInfoRequest: SZAVPlayerRequest {
22 |
23 | let resourceUrl: URL
24 | let loadingRequest: AVAssetResourceLoadingRequest
25 | let infoRequest: AVAssetResourceLoadingContentInformationRequest
26 | let task: URLSessionTask
27 |
28 | init(resourceUrl: URL,
29 | loadingRequest: AVAssetResourceLoadingRequest,
30 | infoRequest: AVAssetResourceLoadingContentInformationRequest,
31 | task: URLSessionTask)
32 | {
33 | self.resourceUrl = resourceUrl
34 | self.loadingRequest = loadingRequest
35 | self.infoRequest = infoRequest
36 | self.task = task
37 | }
38 |
39 | func cancel() {
40 | task.cancel()
41 | if !loadingRequest.isCancelled && !loadingRequest.isFinished {
42 | loadingRequest.finishLoading()
43 | }
44 | }
45 |
46 | }
47 |
48 | class SZAVPlayerDataRequest: SZAVPlayerRequest {
49 |
50 | let resourceUrl: URL
51 | let loadingRequest: AVAssetResourceLoadingRequest
52 | let dataRequest: AVAssetResourceLoadingDataRequest
53 | let loader: SZAVPlayerDataLoader
54 | let range: SZAVPlayerRange
55 |
56 | init(resourceUrl: URL,
57 | loadingRequest: AVAssetResourceLoadingRequest,
58 | dataRequest: AVAssetResourceLoadingDataRequest,
59 | loader: SZAVPlayerDataLoader,
60 | range: SZAVPlayerRange)
61 | {
62 | self.resourceUrl = resourceUrl
63 | self.loadingRequest = loadingRequest
64 | self.dataRequest = dataRequest
65 | self.loader = loader
66 | self.range = range
67 | }
68 |
69 | func cancel() {
70 | loader.cancel()
71 | if !loadingRequest.isCancelled && !loadingRequest.isFinished {
72 | loadingRequest.finishLoading()
73 | }
74 | }
75 |
76 | }
77 |
78 | class SZAVPlayerLocalFileRequest: SZAVPlayerRequest {
79 |
80 | let resourceUrl: URL
81 | let loadingRequest: AVAssetResourceLoadingRequest
82 | let dataRequest: AVAssetResourceLoadingDataRequest
83 |
84 | init(resourceUrl: URL,
85 | loadingRequest: AVAssetResourceLoadingRequest,
86 | dataRequest: AVAssetResourceLoadingDataRequest)
87 | {
88 | self.resourceUrl = resourceUrl
89 | self.loadingRequest = loadingRequest
90 | self.dataRequest = dataRequest
91 | }
92 |
93 | func cancel() {
94 | if !loadingRequest.isCancelled && !loadingRequest.isFinished {
95 | loadingRequest.finishLoading()
96 | }
97 | }
98 |
99 | }
100 |
--------------------------------------------------------------------------------
/Example/Pods/SZAVPlayer/Sources/Classes/Request/SZAVPlayerRequestOperation.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SZAVPlayerRequestOperation.swift
3 | // SZAVPlayer
4 | //
5 | // Created by CaiSanze on 2019/12/6.
6 | //
7 | //
8 |
9 | import Foundation
10 |
11 | public protocol SZAVPlayerRequestOperationDelegate: AnyObject {
12 | func requestOperationWillStart(_ operation: SZAVPlayerRequestOperation)
13 | func requestOperation(_ operation: SZAVPlayerRequestOperation, didReceive data: Data)
14 | func requestOperation(_ operation: SZAVPlayerRequestOperation, didCompleteWithError error: Error?)
15 | }
16 |
17 | public class SZAVPlayerRequestOperation: Operation {
18 |
19 | public typealias CompletionHandler = () -> Void
20 | public weak var delegate: SZAVPlayerRequestOperationDelegate?
21 | private(set) public var startOffset: Int64 = 0
22 |
23 | private let performQueue: DispatchQueue
24 | private var requestCompletion: CompletionHandler?
25 | private lazy var session: URLSession = createSession()
26 | private var task: URLSessionDataTask?
27 |
28 | private var _finished: Bool = false
29 | private var _executing: Bool = false
30 |
31 | public init(url: URL, range: SZAVPlayerRange?) {
32 | self.performQueue = DispatchQueue(label: "com.SZAVPlayer.RequestOperation", qos: .background)
33 | super.init()
34 |
35 | task = dataRequest(url: url, range: range)
36 | }
37 |
38 | private func work(completion: @escaping CompletionHandler) {
39 | requestCompletion = completion
40 | delegate?.requestOperationWillStart(self)
41 | task?.resume()
42 | }
43 |
44 | // MARK: Operation Requirements
45 |
46 | override public func start() {
47 | guard !isCancelled else {return}
48 | markAsRunning()
49 | performQueue.async {
50 | self.work {
51 | DispatchQueue.main.async {
52 | guard !self.isCancelled else {return}
53 | self.markAsFinished()
54 | }
55 | }
56 | }
57 | }
58 |
59 | override public func cancel() {
60 | task?.cancel()
61 | }
62 |
63 | override open var isFinished: Bool {
64 | get { return _finished }
65 | set { _finished = newValue }
66 | }
67 |
68 | override open var isExecuting: Bool {
69 | get { return _executing }
70 | set { _executing = newValue }
71 | }
72 |
73 | override open var isAsynchronous: Bool {
74 | return true
75 | }
76 |
77 | }
78 |
79 | // MARK: - Private
80 |
81 | extension SZAVPlayerRequestOperation {
82 |
83 | private func markAsRunning() {
84 | willChangeValue(for: .isExecuting)
85 | _executing = true
86 | didChangeValue(for: .isExecuting)
87 | }
88 |
89 | private func markAsFinished() {
90 | willChangeValue(for: .isExecuting)
91 | willChangeValue(for: .isFinished)
92 | _executing = false
93 | _finished = true
94 | didChangeValue(for: .isExecuting)
95 | didChangeValue(for: .isFinished)
96 | }
97 |
98 | private func willChangeValue(for key: OperationChangeKey) {
99 | self.willChangeValue(forKey: key.rawValue)
100 | }
101 |
102 | private func didChangeValue(for key: OperationChangeKey) {
103 | self.didChangeValue(forKey: key.rawValue)
104 | }
105 |
106 | private enum OperationChangeKey: String {
107 | case isFinished
108 | case isExecuting
109 | }
110 |
111 | }
112 |
113 | // MARK: - URLSessionDelegate
114 |
115 | extension SZAVPlayerRequestOperation: URLSessionDataDelegate {
116 |
117 | public func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didReceive data: Data) {
118 | delegate?.requestOperation(self, didReceive: data)
119 | }
120 |
121 | public func urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError error: Error?) {
122 | delegate?.requestOperation(self, didCompleteWithError: error)
123 |
124 | if let completion = requestCompletion {
125 | completion()
126 | }
127 | }
128 |
129 | }
130 |
131 | // MARK: - Getter
132 |
133 | extension SZAVPlayerRequestOperation {
134 |
135 | private func dataRequest(url: URL, range: SZAVPlayerRange? = nil) -> URLSessionDataTask {
136 | var request = URLRequest(url: url)
137 | if let range = range {
138 | let rangeHeader = "bytes=\(range.lowerBound)-\(range.upperBound)"
139 | request.setValue(rangeHeader, forHTTPHeaderField: "Range")
140 | startOffset = range.lowerBound
141 | }
142 |
143 | return session.dataTask(with: request)
144 | }
145 |
146 | private func createSession() -> URLSession {
147 | let configuration = URLSessionConfiguration.default
148 | configuration.requestCachePolicy = .reloadIgnoringLocalCacheData
149 | let session = URLSession(configuration: configuration, delegate: self, delegateQueue: nil)
150 |
151 | return session
152 | }
153 |
154 | }
155 |
--------------------------------------------------------------------------------
/Example/Pods/SZAVPlayer/Sources/Classes/Storage/SZAVPlayerCache.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SZAVPlayerCache.swift
3 | //
4 | // Created by CaiSanze on 2019/11/27.
5 | //
6 |
7 | import UIKit
8 |
9 | public class SZAVPlayerCache: NSObject {
10 |
11 | public static let shared: SZAVPlayerCache = SZAVPlayerCache()
12 |
13 | private var maxCacheSize: Int64 = 0
14 |
15 | override init() {
16 | super.init()
17 |
18 | setup(maxCacheSize: 100)
19 | trimCache()
20 | }
21 |
22 | /// Setup
23 | /// - Parameter maxCacheSize: Unit: MB
24 | public func setup(maxCacheSize: Int64) {
25 | self.maxCacheSize = maxCacheSize
26 | SZAVPlayerFileSystem.createCacheDirectory()
27 | }
28 |
29 | public func save(uniqueID: String, mediaData: Data, startOffset: Int64) {
30 | let newFileName = SZAVPlayerLocalFileInfo.newFileName(uniqueID: uniqueID)
31 | let localFilePath = SZAVPlayerFileSystem.localFilePath(fileName: newFileName)
32 | if SZAVPlayerFileSystem.write(data: mediaData, url: localFilePath) {
33 | let fileInfo = SZAVPlayerLocalFileInfo(uniqueID: uniqueID,
34 | startOffset: startOffset,
35 | loadedByteLength: Int64(mediaData.count),
36 | localFileName: newFileName)
37 | SZAVPlayerDatabase.shared.update(fileInfo: fileInfo)
38 | }
39 |
40 | trimCache()
41 | }
42 |
43 | public func cleanCache() {
44 | SZAVPlayerDatabase.shared.cleanData()
45 | SZAVPlayerFileSystem.cleanCachedFiles()
46 | }
47 |
48 | public func isFullyCached(uniqueID: String) -> Bool {
49 | let info = SZAVPlayerDatabase.shared.contentInfo(uniqueID: uniqueID)
50 | let localFileInfos = SZAVPlayerDatabase.shared.localFileInfos(uniqueID: uniqueID)
51 | guard let contentInfo = info, contentInfo.contentLength > 0,
52 | localFileInfos.count > 0 else
53 | {
54 | return false
55 | }
56 |
57 | var startOffset = Int64(0)
58 | let endOffset = contentInfo.contentLength
59 | for fileInfo in localFileInfos {
60 | if SZAVPlayerDataLoader.isOutOfRange(startOffset: startOffset, endOffset: endOffset, fileInfo: fileInfo) {
61 | break
62 | }
63 |
64 | let localFileStartOffset = fileInfo.startOffset
65 | if startOffset >= localFileStartOffset {
66 | let localFileStartOffset = max(0, startOffset - fileInfo.startOffset)
67 | let localFileUsefulLength = min(fileInfo.loadedByteLength - localFileStartOffset, endOffset)
68 | startOffset = startOffset + localFileUsefulLength
69 | } else {
70 | break
71 | }
72 | }
73 |
74 | let isFullyCached = startOffset >= endOffset
75 | return isFullyCached
76 | }
77 |
78 | public func trimCache() {
79 | DispatchQueue.global(qos: .background).async {
80 | let directory = SZAVPlayerFileSystem.cacheDirectory
81 | let allFiles: [URL] = SZAVPlayerFileSystem.allFiles(path: directory)
82 | var totalFileSize: Int64 = 0
83 | for file in allFiles {
84 | if let attributes = SZAVPlayerFileSystem.attributes(url: file.path),
85 | let fileSize = attributes[FileAttributeKey.size] as? Int64
86 | {
87 | totalFileSize += fileSize
88 | }
89 | }
90 |
91 | totalFileSize /= 1024 * 1024
92 | if totalFileSize >= self.maxCacheSize {
93 | SZAVPlayerDatabase.shared.trimData()
94 | }
95 | }
96 | }
97 |
98 | }
99 |
100 | // MARK: - Getter
101 |
102 | extension SZAVPlayerCache {
103 |
104 | public static func dataExist(uniqueID: String) -> Bool {
105 | return SZAVPlayerFileSystem.isExist(url: fileURL(uniqueID: uniqueID))
106 | }
107 |
108 | private static func fileURL(uniqueID: String) -> URL {
109 | return SZAVPlayerFileSystem.cacheDirectory.appendingPathComponent(uniqueID)
110 | }
111 |
112 | }
113 |
--------------------------------------------------------------------------------
/Example/Pods/SZAVPlayer/Sources/Classes/Utils/SZLog.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SZLog.swift
3 | //
4 | // Created by CaiSanze on 2019/11/27.
5 | //
6 |
7 | import UIKit
8 |
9 | #if DEBUG
10 | private let shouldLog: Bool = true
11 | #else
12 | private let shouldLog: Bool = false
13 | #endif
14 |
15 | @inlinable
16 | public func SZLogError(_ message: @autoclosure () -> String,
17 | file: StaticString = #file,
18 | function: StaticString = #function,
19 | line: UInt = #line)
20 | {
21 | SZLog.log(message(), type: .error, file: file, function: function, line: line)
22 | }
23 |
24 | @inlinable
25 | public func SZLogWarn(_ message: @autoclosure () -> String,
26 | file: StaticString = #file,
27 | function: StaticString = #function,
28 | line: UInt = #line)
29 | {
30 | SZLog.log(message(), type: .warning, file: file, function: function, line: line)
31 | }
32 |
33 | @inlinable
34 | public func SZLogInfo(_ message: @autoclosure () -> String,
35 | file: StaticString = #file,
36 | function: StaticString = #function,
37 | line: UInt = #line)
38 | {
39 | SZLog.log(message(), type: .info, file: file, function: function, line: line)
40 | }
41 |
42 | @inlinable
43 | public func SZLogDebug(_ message: @autoclosure () -> String,
44 | file: StaticString = #file,
45 | function: StaticString = #function,
46 | line: UInt = #line)
47 | {
48 | SZLog.log(message(), type: .debug, file: file, function: function, line: line)
49 | }
50 |
51 | @inlinable
52 | public func SZLogVerbose(_ message: @autoclosure () -> String,
53 | file: StaticString = #file,
54 | function: StaticString = #function,
55 | line: UInt = #line)
56 | {
57 | SZLog.log(message(), type: .verbose, file: file, function: function, line: line)
58 | }
59 |
60 | public class SZLog {
61 | public enum logType {
62 | case error
63 | case warning
64 | case info
65 | case debug
66 | case verbose
67 | }
68 |
69 | public static func log(_ message: @autoclosure () -> String,
70 | type: logType,
71 | file: StaticString,
72 | function: StaticString,
73 | line: UInt)
74 | {
75 | guard shouldLog else { return }
76 |
77 | let fileName = String(describing: file).lastPathComponent
78 | let formattedMsg = String(format: "file:%@ func:%@ line:%d msg:---%@", fileName, String(describing: function), line, message())
79 | SZLogFormatter.shared.log(message: formattedMsg, type: type)
80 | }
81 |
82 | }
83 |
84 | private extension String {
85 |
86 | var fileURL: URL {
87 | return URL(fileURLWithPath: self)
88 | }
89 |
90 | var pathExtension: String {
91 | return fileURL.pathExtension
92 | }
93 |
94 | var lastPathComponent: String {
95 | return fileURL.lastPathComponent
96 | }
97 |
98 | }
99 |
100 | class SZLogFormatter: NSObject {
101 |
102 | static let shared = SZLogFormatter()
103 | let dateFormatter: DateFormatter
104 |
105 | override init() {
106 | dateFormatter = DateFormatter()
107 | dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss:SSS"
108 | super.init()
109 | }
110 |
111 | func log(message logMessage: String, type: SZLog.logType) {
112 | var logLevelStr: String
113 | switch type {
114 | case .error:
115 | logLevelStr = "‼️ Error"
116 | case .warning:
117 | logLevelStr = "⚠️ Warning"
118 | case .info:
119 | logLevelStr = "ℹ️ Info"
120 | case .debug:
121 | logLevelStr = "✅ Debug"
122 | case .verbose:
123 | logLevelStr = "⚪ Verbose"
124 | }
125 |
126 | let dateStr = dateFormatter.string(from: Date())
127 | let finalMessage = String(format: "%@ | %@ %@", logLevelStr, dateStr, logMessage)
128 | print(finalMessage)
129 | }
130 | }
131 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
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 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | SnapKit is a DSL to make Auto Layout easy on both iOS and OS X.
4 |
5 | [](https://travis-ci.org/SnapKit/SnapKit)
6 | [](https://github.com/SnapKit/SnapKit)
7 | [](https://cocoapods.org/pods/SnapKit)
8 | [](https://github.com/Carthage/Carthage)
9 |
10 | #### ⚠️ **To use with Swift 4.x please ensure you are using >= 4.0.0** ⚠️
11 | #### ⚠️ **To use with Swift 5.x please ensure you are using >= 5.0.0** ⚠️
12 |
13 | ## Contents
14 |
15 | - [Requirements](#requirements)
16 | - [Migration Guides](#migration-guides)
17 | - [Communication](#communication)
18 | - [Installation](#installation)
19 | - [Usage](#usage)
20 | - [Credits](#credits)
21 | - [License](#license)
22 |
23 | ## Requirements
24 |
25 | - iOS 10.0+ / Mac OS X 10.12+ / tvOS 10.0+
26 | - Xcode 10.0+
27 | - Swift 4.0+
28 |
29 | ## Communication
30 |
31 | - If you **need help**, use [Stack Overflow](http://stackoverflow.com/questions/tagged/snapkit). (Tag 'snapkit')
32 | - If you'd like to **ask a general question**, use [Stack Overflow](http://stackoverflow.com/questions/tagged/snapkit).
33 | - If you **found a bug**, open an issue.
34 | - If you **have a feature request**, open an issue.
35 | - If you **want to contribute**, submit a pull request.
36 |
37 |
38 | ## Installation
39 |
40 | ### CocoaPods
41 |
42 | [CocoaPods](http://cocoapods.org) is a dependency manager for Cocoa projects. You can install it with the following command:
43 |
44 | ```bash
45 | $ gem install cocoapods
46 | ```
47 |
48 | > CocoaPods 1.1.0+ is required to build SnapKit 4.0.0+.
49 |
50 | To integrate SnapKit into your Xcode project using CocoaPods, specify it in your `Podfile`:
51 |
52 | ```ruby
53 | source 'https://github.com/CocoaPods/Specs.git'
54 | platform :ios, '10.0'
55 | use_frameworks!
56 |
57 | target '' do
58 | pod 'SnapKit', '~> 5.0.0'
59 | end
60 | ```
61 |
62 | Then, run the following command:
63 |
64 | ```bash
65 | $ pod install
66 | ```
67 |
68 | ### Carthage
69 |
70 | [Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.
71 |
72 | You can install Carthage with [Homebrew](http://brew.sh/) using the following command:
73 |
74 | ```bash
75 | $ brew update
76 | $ brew install carthage
77 | ```
78 |
79 | To integrate SnapKit into your Xcode project using Carthage, specify it in your `Cartfile`:
80 |
81 | ```ogdl
82 | github "SnapKit/SnapKit" ~> 5.0.0
83 | ```
84 |
85 | Run `carthage update` to build the framework and drag the built `SnapKit.framework` into your Xcode project.
86 |
87 | ### Manually
88 |
89 | If you prefer not to use either of the aforementioned dependency managers, you can integrate SnapKit into your project manually.
90 |
91 | ---
92 |
93 | ## Usage
94 |
95 | ### Quick Start
96 |
97 | ```swift
98 | import SnapKit
99 |
100 | class MyViewController: UIViewController {
101 |
102 | lazy var box = UIView()
103 |
104 | override func viewDidLoad() {
105 | super.viewDidLoad()
106 |
107 | self.view.addSubview(box)
108 | box.snp.makeConstraints { (make) -> Void in
109 | make.width.height.equalTo(50)
110 | make.center.equalTo(self.view)
111 | }
112 | }
113 |
114 | }
115 | ```
116 |
117 | ### Playground
118 | You can try SnapKit in Playground.
119 |
120 | **Note:**
121 |
122 | > To try SnapKit in playground, open `SnapKit.xcworkspace` and build SnapKit.framework for any simulator first.
123 |
124 | ### Resources
125 |
126 | - [Documentation](http://snapkit.io/docs/)
127 | - [F.A.Q.](http://snapkit.io/faq/)
128 |
129 | ## Credits
130 |
131 | - Robert Payne ([@robertjpayne](https://twitter.com/robertjpayne))
132 | - Many other contributors
133 |
134 | ## License
135 |
136 | SnapKit is released under the MIT license. See LICENSE for details.
137 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/Source/ConstraintConfig.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SnapKit
3 | //
4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | // copies of the Software, and to permit persons to whom the Software is
11 | // furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in
14 | // all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | // THE SOFTWARE.
23 |
24 | #if os(iOS) || os(tvOS)
25 | import UIKit
26 | public typealias ConstraintInterfaceLayoutDirection = UIUserInterfaceLayoutDirection
27 | #else
28 | import AppKit
29 | public typealias ConstraintInterfaceLayoutDirection = NSUserInterfaceLayoutDirection
30 | #endif
31 |
32 |
33 | public struct ConstraintConfig {
34 |
35 | public static var interfaceLayoutDirection: ConstraintInterfaceLayoutDirection = .leftToRight
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/Source/ConstraintDescription.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SnapKit
3 | //
4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | // copies of the Software, and to permit persons to whom the Software is
11 | // furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in
14 | // all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | // THE SOFTWARE.
23 |
24 | #if os(iOS) || os(tvOS)
25 | import UIKit
26 | #else
27 | import AppKit
28 | #endif
29 |
30 |
31 | public class ConstraintDescription {
32 |
33 | internal let item: LayoutConstraintItem
34 | internal var attributes: ConstraintAttributes
35 | internal var relation: ConstraintRelation? = nil
36 | internal var sourceLocation: (String, UInt)? = nil
37 | internal var label: String? = nil
38 | internal var related: ConstraintItem? = nil
39 | internal var multiplier: ConstraintMultiplierTarget = 1.0
40 | internal var constant: ConstraintConstantTarget = 0.0
41 | internal var priority: ConstraintPriorityTarget = 1000.0
42 | internal lazy var constraint: Constraint? = {
43 | guard let relation = self.relation,
44 | let related = self.related,
45 | let sourceLocation = self.sourceLocation else {
46 | return nil
47 | }
48 | let from = ConstraintItem(target: self.item, attributes: self.attributes)
49 |
50 | return Constraint(
51 | from: from,
52 | to: related,
53 | relation: relation,
54 | sourceLocation: sourceLocation,
55 | label: self.label,
56 | multiplier: self.multiplier,
57 | constant: self.constant,
58 | priority: self.priority
59 | )
60 | }()
61 |
62 | // MARK: Initialization
63 |
64 | internal init(item: LayoutConstraintItem, attributes: ConstraintAttributes) {
65 | self.item = item
66 | self.attributes = attributes
67 | }
68 |
69 | }
70 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/Source/ConstraintDirectionalInsetTarget.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SnapKit
3 | //
4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | // copies of the Software, and to permit persons to whom the Software is
11 | // furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in
14 | // all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | // THE SOFTWARE.
23 |
24 | #if os(iOS) || os(tvOS)
25 | import UIKit
26 | #else
27 | import AppKit
28 | #endif
29 |
30 | #if os(iOS) || os(tvOS)
31 | public protocol ConstraintDirectionalInsetTarget: ConstraintConstantTarget {
32 | }
33 |
34 | @available(iOS 11.0, tvOS 11.0, *)
35 | extension ConstraintDirectionalInsets: ConstraintDirectionalInsetTarget {
36 | }
37 |
38 | extension ConstraintDirectionalInsetTarget {
39 |
40 | @available(iOS 11.0, tvOS 11.0, *)
41 | internal var constraintDirectionalInsetTargetValue: ConstraintDirectionalInsets {
42 | if let amount = self as? ConstraintDirectionalInsets {
43 | return amount
44 | } else {
45 | return ConstraintDirectionalInsets(top: 0, leading: 0, bottom: 0, trailing: 0)
46 | }
47 | }
48 | }
49 | #endif
50 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/Source/ConstraintDirectionalInsets.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SnapKit
3 | //
4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | // copies of the Software, and to permit persons to whom the Software is
11 | // furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in
14 | // all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | // THE SOFTWARE.
23 |
24 | #if os(iOS) || os(tvOS)
25 | import UIKit
26 | #else
27 | import AppKit
28 | #endif
29 |
30 |
31 | #if os(iOS) || os(tvOS)
32 | @available(iOS 11.0, tvOS 11.0, *)
33 | public typealias ConstraintDirectionalInsets = NSDirectionalEdgeInsets
34 | #endif
35 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/Source/ConstraintInsetTarget.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SnapKit
3 | //
4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | // copies of the Software, and to permit persons to whom the Software is
11 | // furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in
14 | // all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | // THE SOFTWARE.
23 |
24 | #if os(iOS) || os(tvOS)
25 | import UIKit
26 | #else
27 | import AppKit
28 | #endif
29 |
30 |
31 | public protocol ConstraintInsetTarget: ConstraintConstantTarget {
32 | }
33 |
34 | extension Int: ConstraintInsetTarget {
35 | }
36 |
37 | extension UInt: ConstraintInsetTarget {
38 | }
39 |
40 | extension Float: ConstraintInsetTarget {
41 | }
42 |
43 | extension Double: ConstraintInsetTarget {
44 | }
45 |
46 | extension CGFloat: ConstraintInsetTarget {
47 | }
48 |
49 | extension ConstraintInsets: ConstraintInsetTarget {
50 | }
51 |
52 | extension ConstraintInsetTarget {
53 |
54 | internal var constraintInsetTargetValue: ConstraintInsets {
55 | if let amount = self as? ConstraintInsets {
56 | return amount
57 | } else if let amount = self as? Float {
58 | return ConstraintInsets(top: CGFloat(amount), left: CGFloat(amount), bottom: CGFloat(amount), right: CGFloat(amount))
59 | } else if let amount = self as? Double {
60 | return ConstraintInsets(top: CGFloat(amount), left: CGFloat(amount), bottom: CGFloat(amount), right: CGFloat(amount))
61 | } else if let amount = self as? CGFloat {
62 | return ConstraintInsets(top: amount, left: amount, bottom: amount, right: amount)
63 | } else if let amount = self as? Int {
64 | return ConstraintInsets(top: CGFloat(amount), left: CGFloat(amount), bottom: CGFloat(amount), right: CGFloat(amount))
65 | } else if let amount = self as? UInt {
66 | return ConstraintInsets(top: CGFloat(amount), left: CGFloat(amount), bottom: CGFloat(amount), right: CGFloat(amount))
67 | } else {
68 | return ConstraintInsets(top: 0, left: 0, bottom: 0, right: 0)
69 | }
70 | }
71 |
72 | }
73 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/Source/ConstraintInsets.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SnapKit
3 | //
4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | // copies of the Software, and to permit persons to whom the Software is
11 | // furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in
14 | // all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | // THE SOFTWARE.
23 |
24 | #if os(iOS) || os(tvOS)
25 | import UIKit
26 | #else
27 | import AppKit
28 | #endif
29 |
30 |
31 | #if os(iOS) || os(tvOS)
32 | public typealias ConstraintInsets = UIEdgeInsets
33 | #else
34 | public typealias ConstraintInsets = NSEdgeInsets
35 | #endif
36 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/Source/ConstraintItem.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SnapKit
3 | //
4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | // copies of the Software, and to permit persons to whom the Software is
11 | // furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in
14 | // all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | // THE SOFTWARE.
23 |
24 | #if os(iOS) || os(tvOS)
25 | import UIKit
26 | #else
27 | import AppKit
28 | #endif
29 |
30 |
31 | public final class ConstraintItem {
32 |
33 | internal weak var target: AnyObject?
34 | internal let attributes: ConstraintAttributes
35 |
36 | internal init(target: AnyObject?, attributes: ConstraintAttributes) {
37 | self.target = target
38 | self.attributes = attributes
39 | }
40 |
41 | internal var layoutConstraintItem: LayoutConstraintItem? {
42 | return self.target as? LayoutConstraintItem
43 | }
44 |
45 | }
46 |
47 | public func ==(lhs: ConstraintItem, rhs: ConstraintItem) -> Bool {
48 | // pointer equality
49 | guard lhs !== rhs else {
50 | return true
51 | }
52 |
53 | // must both have valid targets and identical attributes
54 | guard let target1 = lhs.target,
55 | let target2 = rhs.target,
56 | target1 === target2 && lhs.attributes == rhs.attributes else {
57 | return false
58 | }
59 |
60 | return true
61 | }
62 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/Source/ConstraintLayoutGuide+Extensions.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SnapKit
3 | //
4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | // copies of the Software, and to permit persons to whom the Software is
11 | // furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in
14 | // all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | // THE SOFTWARE.
23 |
24 | #if os(iOS) || os(tvOS)
25 | import UIKit
26 | #endif
27 |
28 |
29 | @available(iOS 9.0, OSX 10.11, *)
30 | public extension ConstraintLayoutGuide {
31 |
32 | var snp: ConstraintLayoutGuideDSL {
33 | return ConstraintLayoutGuideDSL(guide: self)
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/Source/ConstraintLayoutGuide.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SnapKit
3 | //
4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | // copies of the Software, and to permit persons to whom the Software is
11 | // furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in
14 | // all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | // THE SOFTWARE.
23 |
24 | #if os(iOS) || os(tvOS)
25 | import UIKit
26 | #else
27 | import AppKit
28 | #endif
29 |
30 |
31 | #if os(iOS) || os(tvOS)
32 | @available(iOS 9.0, *)
33 | public typealias ConstraintLayoutGuide = UILayoutGuide
34 | #else
35 | @available(OSX 10.11, *)
36 | public typealias ConstraintLayoutGuide = NSLayoutGuide
37 | #endif
38 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/Source/ConstraintLayoutGuideDSL.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SnapKit
3 | //
4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | // copies of the Software, and to permit persons to whom the Software is
11 | // furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in
14 | // all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | // THE SOFTWARE.
23 |
24 | #if os(iOS) || os(tvOS)
25 | import UIKit
26 | #else
27 | import AppKit
28 | #endif
29 |
30 |
31 | @available(iOS 9.0, OSX 10.11, *)
32 | public struct ConstraintLayoutGuideDSL: ConstraintAttributesDSL {
33 |
34 | @discardableResult
35 | public func prepareConstraints(_ closure: (_ make: ConstraintMaker) -> Void) -> [Constraint] {
36 | return ConstraintMaker.prepareConstraints(item: self.guide, closure: closure)
37 | }
38 |
39 | public func makeConstraints(_ closure: (_ make: ConstraintMaker) -> Void) {
40 | ConstraintMaker.makeConstraints(item: self.guide, closure: closure)
41 | }
42 |
43 | public func remakeConstraints(_ closure: (_ make: ConstraintMaker) -> Void) {
44 | ConstraintMaker.remakeConstraints(item: self.guide, closure: closure)
45 | }
46 |
47 | public func updateConstraints(_ closure: (_ make: ConstraintMaker) -> Void) {
48 | ConstraintMaker.updateConstraints(item: self.guide, closure: closure)
49 | }
50 |
51 | public func removeConstraints() {
52 | ConstraintMaker.removeConstraints(item: self.guide)
53 | }
54 |
55 | public var target: AnyObject? {
56 | return self.guide
57 | }
58 |
59 | internal let guide: ConstraintLayoutGuide
60 |
61 | internal init(guide: ConstraintLayoutGuide) {
62 | self.guide = guide
63 |
64 | }
65 |
66 | }
67 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/Source/ConstraintLayoutSupport.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SnapKit
3 | //
4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | // copies of the Software, and to permit persons to whom the Software is
11 | // furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in
14 | // all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | // THE SOFTWARE.
23 |
24 | #if os(iOS) || os(tvOS)
25 | import UIKit
26 | #else
27 | import AppKit
28 | #endif
29 |
30 |
31 | #if os(iOS) || os(tvOS)
32 | @available(iOS 8.0, *)
33 | public typealias ConstraintLayoutSupport = UILayoutSupport
34 | #else
35 | public class ConstraintLayoutSupport {}
36 | #endif
37 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/Source/ConstraintLayoutSupportDSL.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SnapKit
3 | //
4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | // copies of the Software, and to permit persons to whom the Software is
11 | // furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in
14 | // all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | // THE SOFTWARE.
23 |
24 | #if os(iOS) || os(tvOS)
25 | import UIKit
26 | #else
27 | import AppKit
28 | #endif
29 |
30 |
31 | @available(iOS 8.0, *)
32 | public struct ConstraintLayoutSupportDSL: ConstraintDSL {
33 |
34 | public var target: AnyObject? {
35 | return self.support
36 | }
37 |
38 | internal let support: ConstraintLayoutSupport
39 |
40 | internal init(support: ConstraintLayoutSupport) {
41 | self.support = support
42 |
43 | }
44 |
45 | public var top: ConstraintItem {
46 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.top)
47 | }
48 |
49 | public var bottom: ConstraintItem {
50 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.bottom)
51 | }
52 |
53 | public var height: ConstraintItem {
54 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.height)
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/Source/ConstraintMakerEditable.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SnapKit
3 | //
4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | // copies of the Software, and to permit persons to whom the Software is
11 | // furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in
14 | // all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | // THE SOFTWARE.
23 |
24 | #if os(iOS) || os(tvOS)
25 | import UIKit
26 | #else
27 | import AppKit
28 | #endif
29 |
30 |
31 | public class ConstraintMakerEditable: ConstraintMakerPriortizable {
32 |
33 | @discardableResult
34 | public func multipliedBy(_ amount: ConstraintMultiplierTarget) -> ConstraintMakerEditable {
35 | self.description.multiplier = amount
36 | return self
37 | }
38 |
39 | @discardableResult
40 | public func dividedBy(_ amount: ConstraintMultiplierTarget) -> ConstraintMakerEditable {
41 | return self.multipliedBy(1.0 / amount.constraintMultiplierTargetValue)
42 | }
43 |
44 | @discardableResult
45 | public func offset(_ amount: ConstraintOffsetTarget) -> ConstraintMakerEditable {
46 | self.description.constant = amount.constraintOffsetTargetValue
47 | return self
48 | }
49 |
50 | @discardableResult
51 | public func inset(_ amount: ConstraintInsetTarget) -> ConstraintMakerEditable {
52 | self.description.constant = amount.constraintInsetTargetValue
53 | return self
54 | }
55 |
56 | #if os(iOS) || os(tvOS)
57 | @discardableResult
58 | @available(iOS 11.0, tvOS 11.0, *)
59 | public func inset(_ amount: ConstraintDirectionalInsetTarget) -> ConstraintMakerEditable {
60 | self.description.constant = amount.constraintDirectionalInsetTargetValue
61 | return self
62 | }
63 | #endif
64 | }
65 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/Source/ConstraintMakerExtendable.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SnapKit
3 | //
4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | // copies of the Software, and to permit persons to whom the Software is
11 | // furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in
14 | // all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | // THE SOFTWARE.
23 |
24 | #if os(iOS) || os(tvOS)
25 | import UIKit
26 | #else
27 | import AppKit
28 | #endif
29 |
30 |
31 | public class ConstraintMakerExtendable: ConstraintMakerRelatable {
32 |
33 | public var left: ConstraintMakerExtendable {
34 | self.description.attributes += .left
35 | return self
36 | }
37 |
38 | public var top: ConstraintMakerExtendable {
39 | self.description.attributes += .top
40 | return self
41 | }
42 |
43 | public var bottom: ConstraintMakerExtendable {
44 | self.description.attributes += .bottom
45 | return self
46 | }
47 |
48 | public var right: ConstraintMakerExtendable {
49 | self.description.attributes += .right
50 | return self
51 | }
52 |
53 | public var leading: ConstraintMakerExtendable {
54 | self.description.attributes += .leading
55 | return self
56 | }
57 |
58 | public var trailing: ConstraintMakerExtendable {
59 | self.description.attributes += .trailing
60 | return self
61 | }
62 |
63 | public var width: ConstraintMakerExtendable {
64 | self.description.attributes += .width
65 | return self
66 | }
67 |
68 | public var height: ConstraintMakerExtendable {
69 | self.description.attributes += .height
70 | return self
71 | }
72 |
73 | public var centerX: ConstraintMakerExtendable {
74 | self.description.attributes += .centerX
75 | return self
76 | }
77 |
78 | public var centerY: ConstraintMakerExtendable {
79 | self.description.attributes += .centerY
80 | return self
81 | }
82 |
83 | @available(*, deprecated, message:"Use lastBaseline instead")
84 | public var baseline: ConstraintMakerExtendable {
85 | self.description.attributes += .lastBaseline
86 | return self
87 | }
88 |
89 | public var lastBaseline: ConstraintMakerExtendable {
90 | self.description.attributes += .lastBaseline
91 | return self
92 | }
93 |
94 | @available(iOS 8.0, OSX 10.11, *)
95 | public var firstBaseline: ConstraintMakerExtendable {
96 | self.description.attributes += .firstBaseline
97 | return self
98 | }
99 |
100 | @available(iOS 8.0, *)
101 | public var leftMargin: ConstraintMakerExtendable {
102 | self.description.attributes += .leftMargin
103 | return self
104 | }
105 |
106 | @available(iOS 8.0, *)
107 | public var rightMargin: ConstraintMakerExtendable {
108 | self.description.attributes += .rightMargin
109 | return self
110 | }
111 |
112 | @available(iOS 8.0, *)
113 | public var topMargin: ConstraintMakerExtendable {
114 | self.description.attributes += .topMargin
115 | return self
116 | }
117 |
118 | @available(iOS 8.0, *)
119 | public var bottomMargin: ConstraintMakerExtendable {
120 | self.description.attributes += .bottomMargin
121 | return self
122 | }
123 |
124 | @available(iOS 8.0, *)
125 | public var leadingMargin: ConstraintMakerExtendable {
126 | self.description.attributes += .leadingMargin
127 | return self
128 | }
129 |
130 | @available(iOS 8.0, *)
131 | public var trailingMargin: ConstraintMakerExtendable {
132 | self.description.attributes += .trailingMargin
133 | return self
134 | }
135 |
136 | @available(iOS 8.0, *)
137 | public var centerXWithinMargins: ConstraintMakerExtendable {
138 | self.description.attributes += .centerXWithinMargins
139 | return self
140 | }
141 |
142 | @available(iOS 8.0, *)
143 | public var centerYWithinMargins: ConstraintMakerExtendable {
144 | self.description.attributes += .centerYWithinMargins
145 | return self
146 | }
147 |
148 | public var edges: ConstraintMakerExtendable {
149 | self.description.attributes += .edges
150 | return self
151 | }
152 | public var directionalEdges: ConstraintMakerExtendable {
153 | self.description.attributes += .directionalEdges
154 | return self
155 | }
156 | public var size: ConstraintMakerExtendable {
157 | self.description.attributes += .size
158 | return self
159 | }
160 |
161 | @available(iOS 8.0, *)
162 | public var margins: ConstraintMakerExtendable {
163 | self.description.attributes += .margins
164 | return self
165 | }
166 |
167 | @available(iOS 8.0, *)
168 | public var directionalMargins: ConstraintMakerExtendable {
169 | self.description.attributes += .directionalMargins
170 | return self
171 | }
172 |
173 | @available(iOS 8.0, *)
174 | public var centerWithinMargins: ConstraintMakerExtendable {
175 | self.description.attributes += .centerWithinMargins
176 | return self
177 | }
178 |
179 | }
180 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/Source/ConstraintMakerFinalizable.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SnapKit
3 | //
4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | // copies of the Software, and to permit persons to whom the Software is
11 | // furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in
14 | // all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | // THE SOFTWARE.
23 |
24 | #if os(iOS) || os(tvOS)
25 | import UIKit
26 | #else
27 | import AppKit
28 | #endif
29 |
30 |
31 | public class ConstraintMakerFinalizable {
32 |
33 | internal let description: ConstraintDescription
34 |
35 | internal init(_ description: ConstraintDescription) {
36 | self.description = description
37 | }
38 |
39 | @discardableResult
40 | public func labeled(_ label: String) -> ConstraintMakerFinalizable {
41 | self.description.label = label
42 | return self
43 | }
44 |
45 | public var constraint: Constraint {
46 | return self.description.constraint!
47 | }
48 |
49 | }
50 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/Source/ConstraintMakerPriortizable.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SnapKit
3 | //
4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | // copies of the Software, and to permit persons to whom the Software is
11 | // furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in
14 | // all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | // THE SOFTWARE.
23 |
24 | #if os(iOS) || os(tvOS)
25 | import UIKit
26 | #else
27 | import AppKit
28 | #endif
29 |
30 |
31 | public class ConstraintMakerPriortizable: ConstraintMakerFinalizable {
32 |
33 | @discardableResult
34 | public func priority(_ amount: ConstraintPriority) -> ConstraintMakerFinalizable {
35 | self.description.priority = amount.value
36 | return self
37 | }
38 |
39 | @discardableResult
40 | public func priority(_ amount: ConstraintPriorityTarget) -> ConstraintMakerFinalizable {
41 | self.description.priority = amount
42 | return self
43 | }
44 |
45 | @available(*, deprecated, message:"Use priority(.required) instead.")
46 | @discardableResult
47 | public func priorityRequired() -> ConstraintMakerFinalizable {
48 | return self.priority(.required)
49 | }
50 |
51 | @available(*, deprecated, message:"Use priority(.high) instead.")
52 | @discardableResult
53 | public func priorityHigh() -> ConstraintMakerFinalizable {
54 | return self.priority(.high)
55 | }
56 |
57 | @available(*, deprecated, message:"Use priority(.medium) instead.")
58 | @discardableResult
59 | public func priorityMedium() -> ConstraintMakerFinalizable {
60 | return self.priority(.medium)
61 | }
62 |
63 | @available(*, deprecated, message:"Use priority(.low) instead.")
64 | @discardableResult
65 | public func priorityLow() -> ConstraintMakerFinalizable {
66 | return self.priority(.low)
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/Source/ConstraintMakerRelatable.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SnapKit
3 | //
4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | // copies of the Software, and to permit persons to whom the Software is
11 | // furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in
14 | // all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | // THE SOFTWARE.
23 |
24 | #if os(iOS) || os(tvOS)
25 | import UIKit
26 | #else
27 | import AppKit
28 | #endif
29 |
30 |
31 | public class ConstraintMakerRelatable {
32 |
33 | internal let description: ConstraintDescription
34 |
35 | internal init(_ description: ConstraintDescription) {
36 | self.description = description
37 | }
38 |
39 | internal func relatedTo(_ other: ConstraintRelatableTarget, relation: ConstraintRelation, file: String, line: UInt) -> ConstraintMakerEditable {
40 | let related: ConstraintItem
41 | let constant: ConstraintConstantTarget
42 |
43 | if let other = other as? ConstraintItem {
44 | guard other.attributes == ConstraintAttributes.none ||
45 | other.attributes.layoutAttributes.count <= 1 ||
46 | other.attributes.layoutAttributes == self.description.attributes.layoutAttributes ||
47 | other.attributes == .edges && self.description.attributes == .margins ||
48 | other.attributes == .margins && self.description.attributes == .edges ||
49 | other.attributes == .directionalEdges && self.description.attributes == .directionalMargins ||
50 | other.attributes == .directionalMargins && self.description.attributes == .directionalEdges else {
51 | fatalError("Cannot constraint to multiple non identical attributes. (\(file), \(line))");
52 | }
53 |
54 | related = other
55 | constant = 0.0
56 | } else if let other = other as? ConstraintView {
57 | related = ConstraintItem(target: other, attributes: ConstraintAttributes.none)
58 | constant = 0.0
59 | } else if let other = other as? ConstraintConstantTarget {
60 | related = ConstraintItem(target: nil, attributes: ConstraintAttributes.none)
61 | constant = other
62 | } else if #available(iOS 9.0, OSX 10.11, *), let other = other as? ConstraintLayoutGuide {
63 | related = ConstraintItem(target: other, attributes: ConstraintAttributes.none)
64 | constant = 0.0
65 | } else {
66 | fatalError("Invalid constraint. (\(file), \(line))")
67 | }
68 |
69 | let editable = ConstraintMakerEditable(self.description)
70 | editable.description.sourceLocation = (file, line)
71 | editable.description.relation = relation
72 | editable.description.related = related
73 | editable.description.constant = constant
74 | return editable
75 | }
76 |
77 | @discardableResult
78 | public func equalTo(_ other: ConstraintRelatableTarget, _ file: String = #file, _ line: UInt = #line) -> ConstraintMakerEditable {
79 | return self.relatedTo(other, relation: .equal, file: file, line: line)
80 | }
81 |
82 | @discardableResult
83 | public func equalToSuperview(_ file: String = #file, _ line: UInt = #line) -> ConstraintMakerEditable {
84 | guard let other = self.description.item.superview else {
85 | fatalError("Expected superview but found nil when attempting make constraint `equalToSuperview`.")
86 | }
87 | return self.relatedTo(other, relation: .equal, file: file, line: line)
88 | }
89 |
90 | @discardableResult
91 | public func lessThanOrEqualTo(_ other: ConstraintRelatableTarget, _ file: String = #file, _ line: UInt = #line) -> ConstraintMakerEditable {
92 | return self.relatedTo(other, relation: .lessThanOrEqual, file: file, line: line)
93 | }
94 |
95 | @discardableResult
96 | public func lessThanOrEqualToSuperview(_ file: String = #file, _ line: UInt = #line) -> ConstraintMakerEditable {
97 | guard let other = self.description.item.superview else {
98 | fatalError("Expected superview but found nil when attempting make constraint `lessThanOrEqualToSuperview`.")
99 | }
100 | return self.relatedTo(other, relation: .lessThanOrEqual, file: file, line: line)
101 | }
102 |
103 | @discardableResult
104 | public func greaterThanOrEqualTo(_ other: ConstraintRelatableTarget, _ file: String = #file, line: UInt = #line) -> ConstraintMakerEditable {
105 | return self.relatedTo(other, relation: .greaterThanOrEqual, file: file, line: line)
106 | }
107 |
108 | @discardableResult
109 | public func greaterThanOrEqualToSuperview(_ file: String = #file, line: UInt = #line) -> ConstraintMakerEditable {
110 | guard let other = self.description.item.superview else {
111 | fatalError("Expected superview but found nil when attempting make constraint `greaterThanOrEqualToSuperview`.")
112 | }
113 | return self.relatedTo(other, relation: .greaterThanOrEqual, file: file, line: line)
114 | }
115 | }
116 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/Source/ConstraintMultiplierTarget.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SnapKit
3 | //
4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | // copies of the Software, and to permit persons to whom the Software is
11 | // furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in
14 | // all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | // THE SOFTWARE.
23 |
24 | #if os(iOS) || os(tvOS)
25 | import UIKit
26 | #else
27 | import AppKit
28 | #endif
29 |
30 |
31 | public protocol ConstraintMultiplierTarget {
32 |
33 | var constraintMultiplierTargetValue: CGFloat { get }
34 |
35 | }
36 |
37 | extension Int: ConstraintMultiplierTarget {
38 |
39 | public var constraintMultiplierTargetValue: CGFloat {
40 | return CGFloat(self)
41 | }
42 |
43 | }
44 |
45 | extension UInt: ConstraintMultiplierTarget {
46 |
47 | public var constraintMultiplierTargetValue: CGFloat {
48 | return CGFloat(self)
49 | }
50 |
51 | }
52 |
53 | extension Float: ConstraintMultiplierTarget {
54 |
55 | public var constraintMultiplierTargetValue: CGFloat {
56 | return CGFloat(self)
57 | }
58 |
59 | }
60 |
61 | extension Double: ConstraintMultiplierTarget {
62 |
63 | public var constraintMultiplierTargetValue: CGFloat {
64 | return CGFloat(self)
65 | }
66 |
67 | }
68 |
69 | extension CGFloat: ConstraintMultiplierTarget {
70 |
71 | public var constraintMultiplierTargetValue: CGFloat {
72 | return self
73 | }
74 |
75 | }
76 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/Source/ConstraintOffsetTarget.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SnapKit
3 | //
4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | // copies of the Software, and to permit persons to whom the Software is
11 | // furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in
14 | // all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | // THE SOFTWARE.
23 |
24 | #if os(iOS) || os(tvOS)
25 | import UIKit
26 | #else
27 | import AppKit
28 | #endif
29 |
30 |
31 | public protocol ConstraintOffsetTarget: ConstraintConstantTarget {
32 | }
33 |
34 | extension Int: ConstraintOffsetTarget {
35 | }
36 |
37 | extension UInt: ConstraintOffsetTarget {
38 | }
39 |
40 | extension Float: ConstraintOffsetTarget {
41 | }
42 |
43 | extension Double: ConstraintOffsetTarget {
44 | }
45 |
46 | extension CGFloat: ConstraintOffsetTarget {
47 | }
48 |
49 | extension ConstraintOffsetTarget {
50 |
51 | internal var constraintOffsetTargetValue: CGFloat {
52 | let offset: CGFloat
53 | if let amount = self as? Float {
54 | offset = CGFloat(amount)
55 | } else if let amount = self as? Double {
56 | offset = CGFloat(amount)
57 | } else if let amount = self as? CGFloat {
58 | offset = CGFloat(amount)
59 | } else if let amount = self as? Int {
60 | offset = CGFloat(amount)
61 | } else if let amount = self as? UInt {
62 | offset = CGFloat(amount)
63 | } else {
64 | offset = 0.0
65 | }
66 | return offset
67 | }
68 |
69 | }
70 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/Source/ConstraintPriority.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SnapKit
3 | //
4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | // copies of the Software, and to permit persons to whom the Software is
11 | // furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in
14 | // all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | // THE SOFTWARE.
23 |
24 | #if os(iOS) || os(tvOS)
25 | import UIKit
26 | #else
27 | import AppKit
28 | #endif
29 |
30 | public struct ConstraintPriority : ExpressibleByFloatLiteral, Equatable, Strideable {
31 | public typealias FloatLiteralType = Float
32 |
33 | public let value: Float
34 |
35 | public init(floatLiteral value: Float) {
36 | self.value = value
37 | }
38 |
39 | public init(_ value: Float) {
40 | self.value = value
41 | }
42 |
43 | public static var required: ConstraintPriority {
44 | return 1000.0
45 | }
46 |
47 | public static var high: ConstraintPriority {
48 | return 750.0
49 | }
50 |
51 | public static var medium: ConstraintPriority {
52 | #if os(OSX)
53 | return 501.0
54 | #else
55 | return 500.0
56 | #endif
57 |
58 | }
59 |
60 | public static var low: ConstraintPriority {
61 | return 250.0
62 | }
63 |
64 | public static func ==(lhs: ConstraintPriority, rhs: ConstraintPriority) -> Bool {
65 | return lhs.value == rhs.value
66 | }
67 |
68 | // MARK: Strideable
69 |
70 | public func advanced(by n: FloatLiteralType) -> ConstraintPriority {
71 | return ConstraintPriority(floatLiteral: value + n)
72 | }
73 |
74 | public func distance(to other: ConstraintPriority) -> FloatLiteralType {
75 | return other.value - value
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/Source/ConstraintPriorityTarget.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SnapKit
3 | //
4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | // copies of the Software, and to permit persons to whom the Software is
11 | // furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in
14 | // all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | // THE SOFTWARE.
23 |
24 | #if os(iOS) || os(tvOS)
25 | import UIKit
26 | #else
27 | import AppKit
28 | #endif
29 |
30 |
31 | public protocol ConstraintPriorityTarget {
32 |
33 | var constraintPriorityTargetValue: Float { get }
34 |
35 | }
36 |
37 | extension Int: ConstraintPriorityTarget {
38 |
39 | public var constraintPriorityTargetValue: Float {
40 | return Float(self)
41 | }
42 |
43 | }
44 |
45 | extension UInt: ConstraintPriorityTarget {
46 |
47 | public var constraintPriorityTargetValue: Float {
48 | return Float(self)
49 | }
50 |
51 | }
52 |
53 | extension Float: ConstraintPriorityTarget {
54 |
55 | public var constraintPriorityTargetValue: Float {
56 | return self
57 | }
58 |
59 | }
60 |
61 | extension Double: ConstraintPriorityTarget {
62 |
63 | public var constraintPriorityTargetValue: Float {
64 | return Float(self)
65 | }
66 |
67 | }
68 |
69 | extension CGFloat: ConstraintPriorityTarget {
70 |
71 | public var constraintPriorityTargetValue: Float {
72 | return Float(self)
73 | }
74 |
75 | }
76 |
77 | #if os(iOS) || os(tvOS)
78 | extension UILayoutPriority: ConstraintPriorityTarget {
79 |
80 | public var constraintPriorityTargetValue: Float {
81 | return self.rawValue
82 | }
83 |
84 | }
85 | #endif
86 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/Source/ConstraintRelatableTarget.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SnapKit
3 | //
4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | // copies of the Software, and to permit persons to whom the Software is
11 | // furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in
14 | // all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | // THE SOFTWARE.
23 |
24 | #if os(iOS) || os(tvOS)
25 | import UIKit
26 | #else
27 | import AppKit
28 | #endif
29 |
30 |
31 | public protocol ConstraintRelatableTarget {
32 | }
33 |
34 | extension Int: ConstraintRelatableTarget {
35 | }
36 |
37 | extension UInt: ConstraintRelatableTarget {
38 | }
39 |
40 | extension Float: ConstraintRelatableTarget {
41 | }
42 |
43 | extension Double: ConstraintRelatableTarget {
44 | }
45 |
46 | extension CGFloat: ConstraintRelatableTarget {
47 | }
48 |
49 | extension CGSize: ConstraintRelatableTarget {
50 | }
51 |
52 | extension CGPoint: ConstraintRelatableTarget {
53 | }
54 |
55 | extension ConstraintInsets: ConstraintRelatableTarget {
56 | }
57 |
58 | #if os(iOS) || os(tvOS)
59 | @available(iOS 11.0, tvOS 11.0, *)
60 | extension ConstraintDirectionalInsets: ConstraintRelatableTarget {
61 | }
62 | #endif
63 |
64 | extension ConstraintItem: ConstraintRelatableTarget {
65 | }
66 |
67 | extension ConstraintView: ConstraintRelatableTarget {
68 | }
69 |
70 | @available(iOS 9.0, OSX 10.11, *)
71 | extension ConstraintLayoutGuide: ConstraintRelatableTarget {
72 | }
73 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/Source/ConstraintRelation.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SnapKit
3 | //
4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | // copies of the Software, and to permit persons to whom the Software is
11 | // furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in
14 | // all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | // THE SOFTWARE.
23 |
24 | #if os(iOS) || os(tvOS)
25 | import UIKit
26 | #else
27 | import AppKit
28 | #endif
29 |
30 |
31 | internal enum ConstraintRelation : Int {
32 | case equal = 1
33 | case lessThanOrEqual
34 | case greaterThanOrEqual
35 |
36 | internal var layoutRelation: LayoutRelation {
37 | get {
38 | switch(self) {
39 | case .equal:
40 | return .equal
41 | case .lessThanOrEqual:
42 | return .lessThanOrEqual
43 | case .greaterThanOrEqual:
44 | return .greaterThanOrEqual
45 | }
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/Source/ConstraintView+Extensions.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SnapKit
3 | //
4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | // copies of the Software, and to permit persons to whom the Software is
11 | // furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in
14 | // all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | // THE SOFTWARE.
23 |
24 | #if os(iOS) || os(tvOS)
25 | import UIKit
26 | #else
27 | import AppKit
28 | #endif
29 |
30 |
31 | public extension ConstraintView {
32 |
33 | @available(*, deprecated, message:"Use newer snp.* syntax.")
34 | var snp_left: ConstraintItem { return self.snp.left }
35 |
36 | @available(*, deprecated, message:"Use newer snp.* syntax.")
37 | var snp_top: ConstraintItem { return self.snp.top }
38 |
39 | @available(*, deprecated, message:"Use newer snp.* syntax.")
40 | var snp_right: ConstraintItem { return self.snp.right }
41 |
42 | @available(*, deprecated, message:"Use newer snp.* syntax.")
43 | var snp_bottom: ConstraintItem { return self.snp.bottom }
44 |
45 | @available(*, deprecated, message:"Use newer snp.* syntax.")
46 | var snp_leading: ConstraintItem { return self.snp.leading }
47 |
48 | @available(*, deprecated, message:"Use newer snp.* syntax.")
49 | var snp_trailing: ConstraintItem { return self.snp.trailing }
50 |
51 | @available(*, deprecated, message:"Use newer snp.* syntax.")
52 | var snp_width: ConstraintItem { return self.snp.width }
53 |
54 | @available(*, deprecated, message:"Use newer snp.* syntax.")
55 | var snp_height: ConstraintItem { return self.snp.height }
56 |
57 | @available(*, deprecated, message:"Use newer snp.* syntax.")
58 | var snp_centerX: ConstraintItem { return self.snp.centerX }
59 |
60 | @available(*, deprecated, message:"Use newer snp.* syntax.")
61 | var snp_centerY: ConstraintItem { return self.snp.centerY }
62 |
63 | @available(*, deprecated, message:"Use newer snp.* syntax.")
64 | var snp_baseline: ConstraintItem { return self.snp.baseline }
65 |
66 | @available(*, deprecated, message:"Use newer snp.* syntax.")
67 | @available(iOS 8.0, OSX 10.11, *)
68 | var snp_lastBaseline: ConstraintItem { return self.snp.lastBaseline }
69 |
70 | @available(iOS, deprecated, message:"Use newer snp.* syntax.")
71 | @available(iOS 8.0, OSX 10.11, *)
72 | var snp_firstBaseline: ConstraintItem { return self.snp.firstBaseline }
73 |
74 | @available(iOS, deprecated, message:"Use newer snp.* syntax.")
75 | @available(iOS 8.0, *)
76 | var snp_leftMargin: ConstraintItem { return self.snp.leftMargin }
77 |
78 | @available(iOS, deprecated, message:"Use newer snp.* syntax.")
79 | @available(iOS 8.0, *)
80 | var snp_topMargin: ConstraintItem { return self.snp.topMargin }
81 |
82 | @available(iOS, deprecated, message:"Use newer snp.* syntax.")
83 | @available(iOS 8.0, *)
84 | var snp_rightMargin: ConstraintItem { return self.snp.rightMargin }
85 |
86 | @available(iOS, deprecated, message:"Use newer snp.* syntax.")
87 | @available(iOS 8.0, *)
88 | var snp_bottomMargin: ConstraintItem { return self.snp.bottomMargin }
89 |
90 | @available(iOS, deprecated, message:"Use newer snp.* syntax.")
91 | @available(iOS 8.0, *)
92 | var snp_leadingMargin: ConstraintItem { return self.snp.leadingMargin }
93 |
94 | @available(iOS, deprecated, message:"Use newer snp.* syntax.")
95 | @available(iOS 8.0, *)
96 | var snp_trailingMargin: ConstraintItem { return self.snp.trailingMargin }
97 |
98 | @available(iOS, deprecated, message:"Use newer snp.* syntax.")
99 | @available(iOS 8.0, *)
100 | var snp_centerXWithinMargins: ConstraintItem { return self.snp.centerXWithinMargins }
101 |
102 | @available(iOS, deprecated, message:"Use newer snp.* syntax.")
103 | @available(iOS 8.0, *)
104 | var snp_centerYWithinMargins: ConstraintItem { return self.snp.centerYWithinMargins }
105 |
106 | @available(*, deprecated, message:"Use newer snp.* syntax.")
107 | var snp_edges: ConstraintItem { return self.snp.edges }
108 |
109 | @available(*, deprecated, message:"Use newer snp.* syntax.")
110 | var snp_size: ConstraintItem { return self.snp.size }
111 |
112 | @available(*, deprecated, message:"Use newer snp.* syntax.")
113 | var snp_center: ConstraintItem { return self.snp.center }
114 |
115 | @available(iOS, deprecated, message:"Use newer snp.* syntax.")
116 | @available(iOS 8.0, *)
117 | var snp_margins: ConstraintItem { return self.snp.margins }
118 |
119 | @available(iOS, deprecated, message:"Use newer snp.* syntax.")
120 | @available(iOS 8.0, *)
121 | var snp_centerWithinMargins: ConstraintItem { return self.snp.centerWithinMargins }
122 |
123 | @available(*, deprecated, message:"Use newer snp.* syntax.")
124 | func snp_prepareConstraints(_ closure: (_ make: ConstraintMaker) -> Void) -> [Constraint] {
125 | return self.snp.prepareConstraints(closure)
126 | }
127 |
128 | @available(*, deprecated, message:"Use newer snp.* syntax.")
129 | func snp_makeConstraints(_ closure: (_ make: ConstraintMaker) -> Void) {
130 | self.snp.makeConstraints(closure)
131 | }
132 |
133 | @available(*, deprecated, message:"Use newer snp.* syntax.")
134 | func snp_remakeConstraints(_ closure: (_ make: ConstraintMaker) -> Void) {
135 | self.snp.remakeConstraints(closure)
136 | }
137 |
138 | @available(*, deprecated, message:"Use newer snp.* syntax.")
139 | func snp_updateConstraints(_ closure: (_ make: ConstraintMaker) -> Void) {
140 | self.snp.updateConstraints(closure)
141 | }
142 |
143 | @available(*, deprecated, message:"Use newer snp.* syntax.")
144 | func snp_removeConstraints() {
145 | self.snp.removeConstraints()
146 | }
147 |
148 | var snp: ConstraintViewDSL {
149 | return ConstraintViewDSL(view: self)
150 | }
151 |
152 | }
153 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/Source/ConstraintView.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SnapKit
3 | //
4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | // copies of the Software, and to permit persons to whom the Software is
11 | // furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in
14 | // all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | // THE SOFTWARE.
23 |
24 | #if os(iOS) || os(tvOS)
25 | import UIKit
26 | #else
27 | import AppKit
28 | #endif
29 |
30 |
31 | #if os(iOS) || os(tvOS)
32 | public typealias ConstraintView = UIView
33 | #else
34 | public typealias ConstraintView = NSView
35 | #endif
36 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/Source/ConstraintViewDSL.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SnapKit
3 | //
4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | // copies of the Software, and to permit persons to whom the Software is
11 | // furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in
14 | // all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | // THE SOFTWARE.
23 |
24 | #if os(iOS) || os(tvOS)
25 | import UIKit
26 | #else
27 | import AppKit
28 | #endif
29 |
30 |
31 | public struct ConstraintViewDSL: ConstraintAttributesDSL {
32 |
33 | @discardableResult
34 | public func prepareConstraints(_ closure: (_ make: ConstraintMaker) -> Void) -> [Constraint] {
35 | return ConstraintMaker.prepareConstraints(item: self.view, closure: closure)
36 | }
37 |
38 | public func makeConstraints(_ closure: (_ make: ConstraintMaker) -> Void) {
39 | ConstraintMaker.makeConstraints(item: self.view, closure: closure)
40 | }
41 |
42 | public func remakeConstraints(_ closure: (_ make: ConstraintMaker) -> Void) {
43 | ConstraintMaker.remakeConstraints(item: self.view, closure: closure)
44 | }
45 |
46 | public func updateConstraints(_ closure: (_ make: ConstraintMaker) -> Void) {
47 | ConstraintMaker.updateConstraints(item: self.view, closure: closure)
48 | }
49 |
50 | public func removeConstraints() {
51 | ConstraintMaker.removeConstraints(item: self.view)
52 | }
53 |
54 | public var contentHuggingHorizontalPriority: Float {
55 | get {
56 | return self.view.contentHuggingPriority(for: .horizontal).rawValue
57 | }
58 | nonmutating set {
59 | self.view.setContentHuggingPriority(LayoutPriority(rawValue: newValue), for: .horizontal)
60 | }
61 | }
62 |
63 | public var contentHuggingVerticalPriority: Float {
64 | get {
65 | return self.view.contentHuggingPriority(for: .vertical).rawValue
66 | }
67 | nonmutating set {
68 | self.view.setContentHuggingPriority(LayoutPriority(rawValue: newValue), for: .vertical)
69 | }
70 | }
71 |
72 | public var contentCompressionResistanceHorizontalPriority: Float {
73 | get {
74 | return self.view.contentCompressionResistancePriority(for: .horizontal).rawValue
75 | }
76 | nonmutating set {
77 | self.view.setContentCompressionResistancePriority(LayoutPriority(rawValue: newValue), for: .horizontal)
78 | }
79 | }
80 |
81 | public var contentCompressionResistanceVerticalPriority: Float {
82 | get {
83 | return self.view.contentCompressionResistancePriority(for: .vertical).rawValue
84 | }
85 | nonmutating set {
86 | self.view.setContentCompressionResistancePriority(LayoutPriority(rawValue: newValue), for: .vertical)
87 | }
88 | }
89 |
90 | public var target: AnyObject? {
91 | return self.view
92 | }
93 |
94 | internal let view: ConstraintView
95 |
96 | internal init(view: ConstraintView) {
97 | self.view = view
98 |
99 | }
100 |
101 | }
102 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/Source/LayoutConstraint.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SnapKit
3 | //
4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | // copies of the Software, and to permit persons to whom the Software is
11 | // furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in
14 | // all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | // THE SOFTWARE.
23 |
24 | #if os(iOS) || os(tvOS)
25 | import UIKit
26 | #else
27 | import AppKit
28 | #endif
29 |
30 |
31 | public class LayoutConstraint : NSLayoutConstraint {
32 |
33 | public var label: String? {
34 | get {
35 | return self.identifier
36 | }
37 | set {
38 | self.identifier = newValue
39 | }
40 | }
41 |
42 | internal weak var constraint: Constraint? = nil
43 |
44 | }
45 |
46 | internal func ==(lhs: LayoutConstraint, rhs: LayoutConstraint) -> Bool {
47 | // If firstItem or secondItem on either constraint has a dangling pointer
48 | // this comparison can cause a crash. The solution for this is to ensure
49 | // your layout code hold strong references to things like Views, LayoutGuides
50 | // and LayoutAnchors as SnapKit will not keep strong references to any of these.
51 | guard lhs.firstAttribute == rhs.firstAttribute &&
52 | lhs.secondAttribute == rhs.secondAttribute &&
53 | lhs.relation == rhs.relation &&
54 | lhs.priority == rhs.priority &&
55 | lhs.multiplier == rhs.multiplier &&
56 | lhs.secondItem === rhs.secondItem &&
57 | lhs.firstItem === rhs.firstItem else {
58 | return false
59 | }
60 | return true
61 | }
62 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/Source/LayoutConstraintItem.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SnapKit
3 | //
4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | // copies of the Software, and to permit persons to whom the Software is
11 | // furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in
14 | // all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | // THE SOFTWARE.
23 |
24 | #if os(iOS) || os(tvOS)
25 | import UIKit
26 | #else
27 | import AppKit
28 | #endif
29 |
30 |
31 | public protocol LayoutConstraintItem: class {
32 | }
33 |
34 | @available(iOS 9.0, OSX 10.11, *)
35 | extension ConstraintLayoutGuide : LayoutConstraintItem {
36 | }
37 |
38 | extension ConstraintView : LayoutConstraintItem {
39 | }
40 |
41 |
42 | extension LayoutConstraintItem {
43 |
44 | internal func prepare() {
45 | if let view = self as? ConstraintView {
46 | view.translatesAutoresizingMaskIntoConstraints = false
47 | }
48 | }
49 |
50 | internal var superview: ConstraintView? {
51 | if let view = self as? ConstraintView {
52 | return view.superview
53 | }
54 |
55 | if #available(iOS 9.0, OSX 10.11, *), let guide = self as? ConstraintLayoutGuide {
56 | return guide.owningView
57 | }
58 |
59 | return nil
60 | }
61 | internal var constraints: [Constraint] {
62 | return self.constraintsSet.allObjects as! [Constraint]
63 | }
64 |
65 | internal func add(constraints: [Constraint]) {
66 | let constraintsSet = self.constraintsSet
67 | for constraint in constraints {
68 | constraintsSet.add(constraint)
69 | }
70 | }
71 |
72 | internal func remove(constraints: [Constraint]) {
73 | let constraintsSet = self.constraintsSet
74 | for constraint in constraints {
75 | constraintsSet.remove(constraint)
76 | }
77 | }
78 |
79 | private var constraintsSet: NSMutableSet {
80 | let constraintsSet: NSMutableSet
81 |
82 | if let existing = objc_getAssociatedObject(self, &constraintsKey) as? NSMutableSet {
83 | constraintsSet = existing
84 | } else {
85 | constraintsSet = NSMutableSet()
86 | objc_setAssociatedObject(self, &constraintsKey, constraintsSet, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)
87 | }
88 | return constraintsSet
89 |
90 | }
91 |
92 | }
93 | private var constraintsKey: UInt8 = 0
94 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/Source/Typealiases.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SnapKit
3 | //
4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | // copies of the Software, and to permit persons to whom the Software is
11 | // furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in
14 | // all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | // THE SOFTWARE.
23 |
24 | import Foundation
25 |
26 | #if os(iOS) || os(tvOS)
27 | import UIKit
28 | #if swift(>=4.2)
29 | typealias LayoutRelation = NSLayoutConstraint.Relation
30 | typealias LayoutAttribute = NSLayoutConstraint.Attribute
31 | #else
32 | typealias LayoutRelation = NSLayoutRelation
33 | typealias LayoutAttribute = NSLayoutAttribute
34 | #endif
35 | typealias LayoutPriority = UILayoutPriority
36 | #else
37 | import AppKit
38 | typealias LayoutRelation = NSLayoutConstraint.Relation
39 | typealias LayoutAttribute = NSLayoutConstraint.Attribute
40 | typealias LayoutPriority = NSLayoutConstraint.Priority
41 | #endif
42 |
43 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/Source/UILayoutSupport+Extensions.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SnapKit
3 | //
4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | // copies of the Software, and to permit persons to whom the Software is
11 | // furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in
14 | // all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | // THE SOFTWARE.
23 |
24 | #if os(iOS) || os(tvOS)
25 | import UIKit
26 | #endif
27 |
28 |
29 | @available(iOS 8.0, *)
30 | public extension ConstraintLayoutSupport {
31 |
32 | var snp: ConstraintLayoutSupportDSL {
33 | return ConstraintLayoutSupportDSL(support: self)
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-SZAVPlayer_Example/Pods-SZAVPlayer_Example-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.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | ${CURRENT_PROJECT_VERSION}
23 | NSPrincipalClass
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-SZAVPlayer_Example/Pods-SZAVPlayer_Example-acknowledgements.markdown:
--------------------------------------------------------------------------------
1 | # Acknowledgements
2 | This application makes use of the following third party libraries:
3 |
4 | ## SZAVPlayer
5 |
6 | Copyright (c) 2019 eroscai
7 |
8 | Permission is hereby granted, free of charge, to any person obtaining a copy
9 | of this software and associated documentation files (the "Software"), to deal
10 | in the Software without restriction, including without limitation the rights
11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | copies of the Software, and to permit persons to whom the Software is
13 | furnished to do so, subject to the following conditions:
14 |
15 | The above copyright notice and this permission notice shall be included in
16 | all copies or substantial portions of the Software.
17 |
18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 | THE SOFTWARE.
25 |
26 |
27 | ## SnapKit
28 |
29 | Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
30 |
31 | Permission is hereby granted, free of charge, to any person obtaining a copy
32 | of this software and associated documentation files (the "Software"), to deal
33 | in the Software without restriction, including without limitation the rights
34 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
35 | copies of the Software, and to permit persons to whom the Software is
36 | furnished to do so, subject to the following conditions:
37 |
38 | The above copyright notice and this permission notice shall be included in
39 | all copies or substantial portions of the Software.
40 |
41 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
42 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
43 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
44 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
45 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
46 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
47 | THE SOFTWARE.
48 |
49 | Generated by CocoaPods - https://cocoapods.org
50 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-SZAVPlayer_Example/Pods-SZAVPlayer_Example-acknowledgements.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreferenceSpecifiers
6 |
7 |
8 | FooterText
9 | This application makes use of the following third party libraries:
10 | Title
11 | Acknowledgements
12 | Type
13 | PSGroupSpecifier
14 |
15 |
16 | FooterText
17 | Copyright (c) 2019 eroscai <csz0102@gmail.com>
18 |
19 | Permission is hereby granted, free of charge, to any person obtaining a copy
20 | of this software and associated documentation files (the "Software"), to deal
21 | in the Software without restriction, including without limitation the rights
22 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
23 | copies of the Software, and to permit persons to whom the Software is
24 | furnished to do so, subject to the following conditions:
25 |
26 | The above copyright notice and this permission notice shall be included in
27 | all copies or substantial portions of the Software.
28 |
29 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
30 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
32 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
33 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
34 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
35 | THE SOFTWARE.
36 |
37 | License
38 | MIT
39 | Title
40 | SZAVPlayer
41 | Type
42 | PSGroupSpecifier
43 |
44 |
45 | FooterText
46 | Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
47 |
48 | Permission is hereby granted, free of charge, to any person obtaining a copy
49 | of this software and associated documentation files (the "Software"), to deal
50 | in the Software without restriction, including without limitation the rights
51 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
52 | copies of the Software, and to permit persons to whom the Software is
53 | furnished to do so, subject to the following conditions:
54 |
55 | The above copyright notice and this permission notice shall be included in
56 | all copies or substantial portions of the Software.
57 |
58 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
59 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
60 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
61 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
62 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
63 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
64 | THE SOFTWARE.
65 |
66 | License
67 | MIT
68 | Title
69 | SnapKit
70 | Type
71 | PSGroupSpecifier
72 |
73 |
74 | FooterText
75 | Generated by CocoaPods - https://cocoapods.org
76 | Title
77 |
78 | Type
79 | PSGroupSpecifier
80 |
81 |
82 | StringsTable
83 | Acknowledgements
84 | Title
85 | Acknowledgements
86 |
87 |
88 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-SZAVPlayer_Example/Pods-SZAVPlayer_Example-dummy.m:
--------------------------------------------------------------------------------
1 | #import
2 | @interface PodsDummy_Pods_SZAVPlayer_Example : NSObject
3 | @end
4 | @implementation PodsDummy_Pods_SZAVPlayer_Example
5 | @end
6 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-SZAVPlayer_Example/Pods-SZAVPlayer_Example-umbrella.h:
--------------------------------------------------------------------------------
1 | #ifdef __OBJC__
2 | #import
3 | #else
4 | #ifndef FOUNDATION_EXPORT
5 | #if defined(__cplusplus)
6 | #define FOUNDATION_EXPORT extern "C"
7 | #else
8 | #define FOUNDATION_EXPORT extern
9 | #endif
10 | #endif
11 | #endif
12 |
13 |
14 | FOUNDATION_EXPORT double Pods_SZAVPlayer_ExampleVersionNumber;
15 | FOUNDATION_EXPORT const unsigned char Pods_SZAVPlayer_ExampleVersionString[];
16 |
17 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-SZAVPlayer_Example/Pods-SZAVPlayer_Example.debug.xcconfig:
--------------------------------------------------------------------------------
1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES
2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/SZAVPlayer" "${PODS_CONFIGURATION_BUILD_DIR}/SnapKit"
3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
4 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/SZAVPlayer/SZAVPlayer.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/SnapKit/SnapKit.framework/Headers"
5 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
6 | OTHER_LDFLAGS = $(inherited) -framework "AVFoundation" -framework "CoreServices" -framework "SZAVPlayer" -framework "SnapKit" -framework "UIKit"
7 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
8 | PODS_BUILD_DIR = ${BUILD_DIR}
9 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
10 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
11 | PODS_ROOT = ${SRCROOT}/Pods
12 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES
13 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-SZAVPlayer_Example/Pods-SZAVPlayer_Example.modulemap:
--------------------------------------------------------------------------------
1 | framework module Pods_SZAVPlayer_Example {
2 | umbrella header "Pods-SZAVPlayer_Example-umbrella.h"
3 |
4 | export *
5 | module * { export * }
6 | }
7 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-SZAVPlayer_Example/Pods-SZAVPlayer_Example.release.xcconfig:
--------------------------------------------------------------------------------
1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES
2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/SZAVPlayer" "${PODS_CONFIGURATION_BUILD_DIR}/SnapKit"
3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
4 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/SZAVPlayer/SZAVPlayer.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/SnapKit/SnapKit.framework/Headers"
5 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
6 | OTHER_LDFLAGS = $(inherited) -framework "AVFoundation" -framework "CoreServices" -framework "SZAVPlayer" -framework "SnapKit" -framework "UIKit"
7 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
8 | PODS_BUILD_DIR = ${BUILD_DIR}
9 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
10 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
11 | PODS_ROOT = ${SRCROOT}/Pods
12 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES
13 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-SZAVPlayer_Tests/Pods-SZAVPlayer_Tests-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.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | ${CURRENT_PROJECT_VERSION}
23 | NSPrincipalClass
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-SZAVPlayer_Tests/Pods-SZAVPlayer_Tests-acknowledgements.markdown:
--------------------------------------------------------------------------------
1 | # Acknowledgements
2 | This application makes use of the following third party libraries:
3 | Generated by CocoaPods - https://cocoapods.org
4 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-SZAVPlayer_Tests/Pods-SZAVPlayer_Tests-acknowledgements.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreferenceSpecifiers
6 |
7 |
8 | FooterText
9 | This application makes use of the following third party libraries:
10 | Title
11 | Acknowledgements
12 | Type
13 | PSGroupSpecifier
14 |
15 |
16 | FooterText
17 | Generated by CocoaPods - https://cocoapods.org
18 | Title
19 |
20 | Type
21 | PSGroupSpecifier
22 |
23 |
24 | StringsTable
25 | Acknowledgements
26 | Title
27 | Acknowledgements
28 |
29 |
30 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-SZAVPlayer_Tests/Pods-SZAVPlayer_Tests-dummy.m:
--------------------------------------------------------------------------------
1 | #import
2 | @interface PodsDummy_Pods_SZAVPlayer_Tests : NSObject
3 | @end
4 | @implementation PodsDummy_Pods_SZAVPlayer_Tests
5 | @end
6 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-SZAVPlayer_Tests/Pods-SZAVPlayer_Tests-umbrella.h:
--------------------------------------------------------------------------------
1 | #ifdef __OBJC__
2 | #import
3 | #else
4 | #ifndef FOUNDATION_EXPORT
5 | #if defined(__cplusplus)
6 | #define FOUNDATION_EXPORT extern "C"
7 | #else
8 | #define FOUNDATION_EXPORT extern
9 | #endif
10 | #endif
11 | #endif
12 |
13 |
14 | FOUNDATION_EXPORT double Pods_SZAVPlayer_TestsVersionNumber;
15 | FOUNDATION_EXPORT const unsigned char Pods_SZAVPlayer_TestsVersionString[];
16 |
17 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-SZAVPlayer_Tests/Pods-SZAVPlayer_Tests.debug.xcconfig:
--------------------------------------------------------------------------------
1 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/SZAVPlayer" "${PODS_CONFIGURATION_BUILD_DIR}/SnapKit"
2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
3 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/SZAVPlayer/SZAVPlayer.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/SnapKit/SnapKit.framework/Headers"
4 | OTHER_LDFLAGS = $(inherited) -framework "AVFoundation" -framework "CoreServices" -framework "SZAVPlayer" -framework "SnapKit" -framework "UIKit"
5 | PODS_BUILD_DIR = ${BUILD_DIR}
6 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
7 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
8 | PODS_ROOT = ${SRCROOT}/Pods
9 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES
10 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-SZAVPlayer_Tests/Pods-SZAVPlayer_Tests.modulemap:
--------------------------------------------------------------------------------
1 | framework module Pods_SZAVPlayer_Tests {
2 | umbrella header "Pods-SZAVPlayer_Tests-umbrella.h"
3 |
4 | export *
5 | module * { export * }
6 | }
7 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-SZAVPlayer_Tests/Pods-SZAVPlayer_Tests.release.xcconfig:
--------------------------------------------------------------------------------
1 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/SZAVPlayer" "${PODS_CONFIGURATION_BUILD_DIR}/SnapKit"
2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
3 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/SZAVPlayer/SZAVPlayer.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/SnapKit/SnapKit.framework/Headers"
4 | OTHER_LDFLAGS = $(inherited) -framework "AVFoundation" -framework "CoreServices" -framework "SZAVPlayer" -framework "SnapKit" -framework "UIKit"
5 | PODS_BUILD_DIR = ${BUILD_DIR}
6 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
7 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
8 | PODS_ROOT = ${SRCROOT}/Pods
9 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES
10 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/SZAVPlayer/SZAVPlayer-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.2.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | ${CURRENT_PROJECT_VERSION}
23 | NSPrincipalClass
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/SZAVPlayer/SZAVPlayer-dummy.m:
--------------------------------------------------------------------------------
1 | #import
2 | @interface PodsDummy_SZAVPlayer : NSObject
3 | @end
4 | @implementation PodsDummy_SZAVPlayer
5 | @end
6 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/SZAVPlayer/SZAVPlayer-prefix.pch:
--------------------------------------------------------------------------------
1 | #ifdef __OBJC__
2 | #import
3 | #else
4 | #ifndef FOUNDATION_EXPORT
5 | #if defined(__cplusplus)
6 | #define FOUNDATION_EXPORT extern "C"
7 | #else
8 | #define FOUNDATION_EXPORT extern
9 | #endif
10 | #endif
11 | #endif
12 |
13 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/SZAVPlayer/SZAVPlayer-umbrella.h:
--------------------------------------------------------------------------------
1 | #ifdef __OBJC__
2 | #import
3 | #else
4 | #ifndef FOUNDATION_EXPORT
5 | #if defined(__cplusplus)
6 | #define FOUNDATION_EXPORT extern "C"
7 | #else
8 | #define FOUNDATION_EXPORT extern
9 | #endif
10 | #endif
11 | #endif
12 |
13 |
14 | FOUNDATION_EXPORT double SZAVPlayerVersionNumber;
15 | FOUNDATION_EXPORT const unsigned char SZAVPlayerVersionString[];
16 |
17 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/SZAVPlayer/SZAVPlayer.debug.xcconfig:
--------------------------------------------------------------------------------
1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/SZAVPlayer
2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
3 | OTHER_LDFLAGS = $(inherited) -framework "AVFoundation" -framework "CoreServices" -framework "UIKit"
4 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
5 | PODS_BUILD_DIR = ${BUILD_DIR}
6 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
7 | PODS_ROOT = ${SRCROOT}
8 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/../..
9 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
10 | SKIP_INSTALL = YES
11 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES
12 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/SZAVPlayer/SZAVPlayer.modulemap:
--------------------------------------------------------------------------------
1 | framework module SZAVPlayer {
2 | umbrella header "SZAVPlayer-umbrella.h"
3 |
4 | export *
5 | module * { export * }
6 | }
7 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/SZAVPlayer/SZAVPlayer.release.xcconfig:
--------------------------------------------------------------------------------
1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/SZAVPlayer
2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
3 | OTHER_LDFLAGS = $(inherited) -framework "AVFoundation" -framework "CoreServices" -framework "UIKit"
4 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
5 | PODS_BUILD_DIR = ${BUILD_DIR}
6 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
7 | PODS_ROOT = ${SRCROOT}
8 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/../..
9 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
10 | SKIP_INSTALL = YES
11 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES
12 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/SZAVPlayer/SZAVPlayer.xcconfig:
--------------------------------------------------------------------------------
1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/SZAVPlayer
2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
3 | OTHER_LDFLAGS = $(inherited) -framework "AVFoundation" -framework "CoreServices" -framework "UIKit"
4 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
5 | PODS_BUILD_DIR = ${BUILD_DIR}
6 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
7 | PODS_ROOT = ${SRCROOT}
8 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/../..
9 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
10 | SKIP_INSTALL = YES
11 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES
12 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/SnapKit/SnapKit-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 | 5.0.1
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | ${CURRENT_PROJECT_VERSION}
23 | NSPrincipalClass
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/SnapKit/SnapKit-dummy.m:
--------------------------------------------------------------------------------
1 | #import
2 | @interface PodsDummy_SnapKit : NSObject
3 | @end
4 | @implementation PodsDummy_SnapKit
5 | @end
6 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/SnapKit/SnapKit-prefix.pch:
--------------------------------------------------------------------------------
1 | #ifdef __OBJC__
2 | #import
3 | #else
4 | #ifndef FOUNDATION_EXPORT
5 | #if defined(__cplusplus)
6 | #define FOUNDATION_EXPORT extern "C"
7 | #else
8 | #define FOUNDATION_EXPORT extern
9 | #endif
10 | #endif
11 | #endif
12 |
13 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/SnapKit/SnapKit-umbrella.h:
--------------------------------------------------------------------------------
1 | #ifdef __OBJC__
2 | #import
3 | #else
4 | #ifndef FOUNDATION_EXPORT
5 | #if defined(__cplusplus)
6 | #define FOUNDATION_EXPORT extern "C"
7 | #else
8 | #define FOUNDATION_EXPORT extern
9 | #endif
10 | #endif
11 | #endif
12 |
13 |
14 | FOUNDATION_EXPORT double SnapKitVersionNumber;
15 | FOUNDATION_EXPORT const unsigned char SnapKitVersionString[];
16 |
17 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/SnapKit/SnapKit.debug.xcconfig:
--------------------------------------------------------------------------------
1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/SnapKit
2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
3 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
4 | PODS_BUILD_DIR = ${BUILD_DIR}
5 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
6 | PODS_ROOT = ${SRCROOT}
7 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/SnapKit
8 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
9 | SKIP_INSTALL = YES
10 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES
11 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/SnapKit/SnapKit.modulemap:
--------------------------------------------------------------------------------
1 | framework module SnapKit {
2 | umbrella header "SnapKit-umbrella.h"
3 |
4 | export *
5 | module * { export * }
6 | }
7 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/SnapKit/SnapKit.release.xcconfig:
--------------------------------------------------------------------------------
1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/SnapKit
2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
3 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
4 | PODS_BUILD_DIR = ${BUILD_DIR}
5 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
6 | PODS_ROOT = ${SRCROOT}
7 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/SnapKit
8 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
9 | SKIP_INSTALL = YES
10 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES
11 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/SnapKit/SnapKit.xcconfig:
--------------------------------------------------------------------------------
1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/SnapKit
2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
3 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
4 | PODS_BUILD_DIR = ${BUILD_DIR}
5 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
6 | PODS_ROOT = ${SRCROOT}
7 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/SnapKit
8 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
9 | SKIP_INSTALL = YES
10 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES
11 |
--------------------------------------------------------------------------------
/Example/SZAVPlayer.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Example/SZAVPlayer.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Example/SZAVPlayer.xcodeproj/xcshareddata/xcschemes/SZAVPlayer-Example.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
29 |
35 |
36 |
37 |
38 |
39 |
44 |
45 |
51 |
52 |
53 |
54 |
56 |
62 |
63 |
64 |
65 |
66 |
76 |
78 |
84 |
85 |
86 |
87 |
93 |
95 |
101 |
102 |
103 |
104 |
106 |
107 |
110 |
111 |
112 |
--------------------------------------------------------------------------------
/Example/SZAVPlayer.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Example/SZAVPlayer.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Example/SZAVPlayer.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Example/SZAVPlayer/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.swift
3 | // SZAVPlayer
4 | //
5 | // Created by eroscai on 11/27/2019.
6 | // Copyright (c) 2019 eroscai. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | @UIApplicationMain
12 | class AppDelegate: UIResponder, UIApplicationDelegate {
13 |
14 | var window: UIWindow?
15 |
16 |
17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
18 | // Override point for customization after application launch.
19 |
20 | let rootVC = UINavigationController(rootViewController: ViewController())
21 | window = UIWindow(frame: UIScreen.main.bounds)
22 | window?.rootViewController = rootVC
23 | window?.makeKeyAndVisible()
24 |
25 | return true
26 | }
27 |
28 | func applicationWillResignActive(_ application: UIApplication) {
29 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
30 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
31 | }
32 |
33 | func applicationDidEnterBackground(_ application: UIApplication) {
34 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
35 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
36 | }
37 |
38 | func applicationWillEnterForeground(_ application: UIApplication) {
39 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
40 | }
41 |
42 | func applicationDidBecomeActive(_ application: UIApplication) {
43 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
44 | }
45 |
46 | func applicationWillTerminate(_ application: UIApplication) {
47 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
48 | }
49 |
50 |
51 | }
52 |
53 |
--------------------------------------------------------------------------------
/Example/SZAVPlayer/AudioView/AudioPlayerProgressView.swift:
--------------------------------------------------------------------------------
1 | //
2 | // AudioPlayerProgressView.swift
3 | //
4 | // Created by CaiSanze on 2019/11/6.
5 | //
6 |
7 | import UIKit
8 |
9 | protocol AudioPlayerProgressViewDelegate: AnyObject {
10 | func progressView(_ progressView: AudioPlayerProgressView, didChanged currentTime: Float64)
11 | }
12 |
13 | class AudioPlayerProgressView: UIView {
14 |
15 | public weak var delegate: AudioPlayerProgressViewDelegate?
16 | private(set) public var isDraggingSlider: Bool = false
17 |
18 | private lazy var progressSlider: AudioPlayerSlider = createProgressSlider()
19 | private lazy var minTimeLabel: UILabel = createTimeLabel()
20 | private lazy var maxTimeLabel: UILabel = createTimeLabel()
21 | private var progressSliderOriginalBounds: CGRect?
22 | private var shouldIgnoreProgress: Bool = false
23 |
24 | override init(frame: CGRect) {
25 | super.init(frame: frame)
26 |
27 | addSubviews()
28 | ListenerCenter.shared.addListener(listener: self, type: .playerStatusEvent)
29 | }
30 |
31 | required init?(coder: NSCoder) {
32 | fatalError("init(coder:) has not been implemented")
33 | }
34 |
35 | deinit {
36 | ListenerCenter.shared.removeAllListener(listener: self)
37 | }
38 |
39 | }
40 |
41 | // MARK: - Configure UI
42 |
43 | extension AudioPlayerProgressView {
44 |
45 | public func update(currentTime: Float64, totalTime: Float64) {
46 | guard currentTime >= 0 && totalTime >= 0 && totalTime >= currentTime else { return }
47 |
48 | if isDraggingSlider || shouldIgnoreProgress {
49 | return
50 | }
51 |
52 | minTimeLabel.text = minuteAndSecondStr(second: currentTime)
53 | maxTimeLabel.text = minuteAndSecondStr(second: totalTime)
54 | progressSlider.value = Float(currentTime)
55 | progressSlider.maximumValue = Float(totalTime)
56 | }
57 |
58 | public func reset() {
59 | minTimeLabel.text = "00:00"
60 | maxTimeLabel.text = "--:--"
61 | progressSlider.value = 0
62 | }
63 |
64 | private func addSubviews() {
65 | addSubview(progressSlider)
66 | progressSlider.snp.makeConstraints { (make) in
67 | make.left.right.equalTo(self).inset(60)
68 | make.height.equalTo(6)
69 | make.centerY.equalTo(self)
70 | }
71 |
72 | minTimeLabel.textAlignment = .right
73 | addSubview(minTimeLabel)
74 | minTimeLabel.snp.makeConstraints { (make) in
75 | make.width.equalTo(48)
76 | make.height.equalTo(self)
77 | make.right.equalTo(progressSlider.snp.left).offset(-12)
78 | make.centerY.equalTo(self)
79 | }
80 |
81 | maxTimeLabel.textAlignment = .left
82 | addSubview(maxTimeLabel)
83 | maxTimeLabel.snp.makeConstraints { (make) in
84 | make.width.equalTo(48)
85 | make.height.equalTo(self)
86 | make.left.equalTo(progressSlider.snp.right).offset(12)
87 | make.centerY.equalTo(self)
88 | }
89 |
90 | }
91 |
92 | }
93 |
94 | // MARK: - Actions
95 |
96 | extension AudioPlayerProgressView {
97 |
98 | @objc private func handleSliderValueChanged(_ slider: AudioPlayerSlider, event: UIEvent) {
99 | isDraggingSlider = true
100 | minTimeLabel.text = minuteAndSecondStr(second: Float64(slider.value))
101 | }
102 |
103 | @objc private func handleSliderTouchUp(_ slider: AudioPlayerSlider) {
104 | delegate?.progressView(self, didChanged: Float64(slider.value))
105 | isDraggingSlider = false
106 | }
107 |
108 | }
109 |
110 | // MARK: - Utils
111 |
112 | extension AudioPlayerProgressView {
113 |
114 | /// 02:30
115 | func minuteAndSecondStr(second: Float64) -> String {
116 | let str = String(format: "%02ld:%02ld", Int64(second / 60), Int64(second.truncatingRemainder(dividingBy: 60)))
117 |
118 | return str
119 | }
120 |
121 | }
122 |
123 | // MARK: - PlayerStatusListenerProtocol
124 |
125 | extension AudioPlayerProgressView: PlayerControllerEventListenerProtocol {
126 |
127 | func onPlayerControllerEventDetected(event: PlayerControllerEventType) {
128 | shouldIgnoreProgress = event != .playing
129 | }
130 |
131 | }
132 |
133 | // MARK: - Getter
134 |
135 | extension AudioPlayerProgressView {
136 |
137 | private func createProgressSlider() -> AudioPlayerSlider {
138 | let slider = AudioPlayerSlider()
139 | slider.addTarget(self, action: #selector(handleSliderValueChanged(_:event:)), for: .valueChanged)
140 | slider.addTarget(self, action: #selector(handleSliderTouchUp(_:)), for: .touchUpInside)
141 | slider.addTarget(self, action: #selector(handleSliderTouchUp(_:)), for: .touchUpOutside)
142 |
143 | return slider
144 | }
145 |
146 | private func createTimeLabel() -> UILabel {
147 | let label = UILabel()
148 | label.backgroundColor = .clear
149 | label.font = .systemFont(ofSize: 12)
150 | label.textColor = .black
151 | label.text = "--:--"
152 |
153 | return label
154 | }
155 |
156 | }
157 |
--------------------------------------------------------------------------------
/Example/SZAVPlayer/AudioView/AudioPlayerSlider.swift:
--------------------------------------------------------------------------------
1 | //
2 | // STAudioPlayerSlider.swift
3 | //
4 | // Created by CaiSanze on 2019/11/6.
5 | //
6 |
7 | import UIKit
8 |
9 | class AudioPlayerSlider: UISlider {
10 |
11 | override init(frame: CGRect) {
12 | super.init(frame: frame)
13 | }
14 |
15 | required init?(coder: NSCoder) {
16 | fatalError("init(coder:) has not been implemented")
17 | }
18 |
19 | override func trackRect(forBounds bounds: CGRect) -> CGRect {
20 | return CGRect(origin: bounds.origin, size: CGSize(width: bounds.width, height: 6))
21 | }
22 |
23 | override func point(inside point: CGPoint, with event: UIEvent?) -> Bool {
24 | var bounds: CGRect = self.bounds
25 | bounds = bounds.insetBy(dx: -20, dy: -20)
26 |
27 | return bounds.contains(point)
28 | }
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/Example/SZAVPlayer/AudioView/FakeAudio.swift:
--------------------------------------------------------------------------------
1 | //
2 | // FakeAudio.swift
3 | //
4 | // Created by CaiSanze on 2019/11/29.
5 | //
6 |
7 | import UIKit
8 |
9 | class FakeAudio: NSObject {
10 |
11 | var cover: String = ""
12 | var title: String = ""
13 | var url: String = ""
14 |
15 | var isSelected: Bool = false
16 | var isFirst: Bool = false
17 | var isLast: Bool = false
18 |
19 | override func isEqual(_ object: Any?) -> Bool {
20 | if let object = object as? FakeAudio {
21 | return url == object.url
22 | }
23 |
24 | return false
25 | }
26 |
27 | static func fake1() -> FakeAudio {
28 | let audio = FakeAudio()
29 | audio.cover = "http://p2.music.126.net/nEtbaHINgXyGz3mLOELUhg==/6637751697108298.jpg?param=400y400"
30 | audio.title = "Where'd You Go"
31 | audio.url = "http://music.163.com/song/media/outer/url?id=1345171.mp3"
32 |
33 | return audio
34 | }
35 |
36 | static func fake2() -> FakeAudio {
37 | let audio = FakeAudio()
38 | audio.cover = "http://p2.music.126.net/-2sXMGhK4vw6KlzhW_YayQ==/109951163780662542.jpg?param=400y400"
39 | audio.title = "Do It"
40 | audio.url = "http://music.163.com/song/media/outer/url?id=27845048.mp3"
41 |
42 | return audio
43 | }
44 |
45 | static func fake3() -> FakeAudio {
46 | let audio = FakeAudio()
47 | audio.cover = "http://p2.music.126.net/FGhXCsQCEZOjTRc8K8XsYQ==/109951164461390248.jpg?param=400y400"
48 | audio.title = "Love poem"
49 | audio.url = "http://music.163.com/song/media/outer/url?id=1400436688.mp3"
50 |
51 | return audio
52 | }
53 |
54 | }
55 |
56 |
--------------------------------------------------------------------------------
/Example/SZAVPlayer/Base.lproj/LaunchScreen.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
25 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/Example/SZAVPlayer/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/Example/SZAVPlayer/Images.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "20x20",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "20x20",
11 | "scale" : "3x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "29x29",
16 | "scale" : "2x"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "size" : "29x29",
21 | "scale" : "3x"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "size" : "40x40",
26 | "scale" : "2x"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "size" : "40x40",
31 | "scale" : "3x"
32 | },
33 | {
34 | "idiom" : "iphone",
35 | "size" : "60x60",
36 | "scale" : "2x"
37 | },
38 | {
39 | "idiom" : "iphone",
40 | "size" : "60x60",
41 | "scale" : "3x"
42 | },
43 | {
44 | "idiom" : "ios-marketing",
45 | "size" : "1024x1024",
46 | "scale" : "1x"
47 | }
48 | ],
49 | "info" : {
50 | "version" : 1,
51 | "author" : "xcode"
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/Example/SZAVPlayer/Images.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/Example/SZAVPlayer/Images.xcassets/next.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "next@2x.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/Example/SZAVPlayer/Images.xcassets/next.imageset/next@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eroscai/SZAVPlayer/4f6cf619650f76bc0b2d7ab068dc5c083490018b/Example/SZAVPlayer/Images.xcassets/next.imageset/next@2x.png
--------------------------------------------------------------------------------
/Example/SZAVPlayer/Images.xcassets/pause.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "pause@2x.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/Example/SZAVPlayer/Images.xcassets/pause.imageset/pause@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eroscai/SZAVPlayer/4f6cf619650f76bc0b2d7ab068dc5c083490018b/Example/SZAVPlayer/Images.xcassets/pause.imageset/pause@2x.png
--------------------------------------------------------------------------------
/Example/SZAVPlayer/Images.xcassets/play.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "play@2x.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/Example/SZAVPlayer/Images.xcassets/play.imageset/play@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eroscai/SZAVPlayer/4f6cf619650f76bc0b2d7ab068dc5c083490018b/Example/SZAVPlayer/Images.xcassets/play.imageset/play@2x.png
--------------------------------------------------------------------------------
/Example/SZAVPlayer/Images.xcassets/previous.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "previous@2x.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/Example/SZAVPlayer/Images.xcassets/previous.imageset/previous@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eroscai/SZAVPlayer/4f6cf619650f76bc0b2d7ab068dc5c083490018b/Example/SZAVPlayer/Images.xcassets/previous.imageset/previous@2x.png
--------------------------------------------------------------------------------
/Example/SZAVPlayer/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 | NSAppTransportSecurity
26 |
27 | NSAllowsArbitraryLoads
28 |
29 |
30 | UIBackgroundModes
31 |
32 | audio
33 |
34 | UILaunchStoryboardName
35 | LaunchScreen
36 | UIRequiredDeviceCapabilities
37 |
38 | armv7
39 |
40 | UISupportedInterfaceOrientations
41 |
42 | UIInterfaceOrientationPortrait
43 | UIInterfaceOrientationLandscapeLeft
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/Example/SZAVPlayer/ListenerCenter/ListenerCenter.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ListenerCenter.swift
3 | //
4 | // Created by CaiSanze on 2020/01/05.
5 | //
6 |
7 | import UIKit
8 |
9 | class ListenerCenter {
10 |
11 | public static let shared = ListenerCenter()
12 |
13 | private lazy var recursiveLock: NSRecursiveLock = NSRecursiveLock()
14 | private lazy var systemEventListeners: [ListenerNode] = []
15 | private lazy var playerControllerEventListeners: [ListenerNode] = []
16 |
17 | //保存监听者,不让其自动释放,监听完毕以后再手动删除
18 | private lazy var preserveListeners: [ListenerBaseProtocol] = []
19 |
20 | enum ListenerType: CaseIterable {
21 | case systemEvent
22 | case playerStatusEvent
23 | }
24 |
25 | }
26 |
27 | // MARK: - Public
28 |
29 | extension ListenerCenter {
30 |
31 | func addListener(listener: ListenerBaseProtocol, type: ListenerType, preserve: Bool = false) {
32 | removeListener(listener: listener, type: type)
33 |
34 | recursiveLock.lock()
35 | defer { recursiveLock.unlock() }
36 |
37 | switch type {
38 | case .systemEvent:
39 | ListenerNode.add(listener: listener, to: &systemEventListeners)
40 | case .playerStatusEvent:
41 | ListenerNode.add(listener: listener, to: &playerControllerEventListeners)
42 | }
43 |
44 | if preserve {
45 | preserveListeners.append(listener)
46 | }
47 | }
48 |
49 | func removeListener(listener: AnyObject, type: ListenerType) {
50 | recursiveLock.lock()
51 | defer { recursiveLock.unlock() }
52 |
53 | switch type {
54 | case .systemEvent:
55 | ListenerNode.remove(listener: listener, from: &systemEventListeners)
56 | case .playerStatusEvent:
57 | ListenerNode.remove(listener: listener, from: &playerControllerEventListeners)
58 | }
59 |
60 | for (index, preserveListener) in preserveListeners.enumerated() {
61 | if listener.isEqual(preserveListener) {
62 | preserveListeners.remove(at: index)
63 | }
64 | }
65 | }
66 |
67 | func removeAllListener(listener: AnyObject) {
68 | recursiveLock.lock()
69 | defer { recursiveLock.unlock() }
70 |
71 | for type in ListenerType.allCases {
72 | removeListener(listener: listener, type: type)
73 | }
74 | }
75 |
76 | }
77 |
78 | // MARK: - SystemEvent
79 |
80 | extension ListenerCenter {
81 |
82 | public func notifySystemEventDetected(application: UIApplication, type: SystemEventType) {
83 | recursiveLock.lock()
84 | defer { recursiveLock.unlock() }
85 |
86 | for node in systemEventListeners {
87 | if let listener = node.listener as? SystemEventListenerProtocol {
88 | listener.onSystemEventDetected(application: application, type: type)
89 | }
90 | }
91 | }
92 |
93 | }
94 |
95 | // MARK: - PlayerStatus
96 |
97 | extension ListenerCenter {
98 |
99 | public func notifyPlayerControllerEventDetected(event: PlayerControllerEventType) {
100 | recursiveLock.lock()
101 | defer { recursiveLock.unlock() }
102 |
103 | for node in playerControllerEventListeners {
104 | if let listener = node.listener as? PlayerControllerEventListenerProtocol {
105 | listener.onPlayerControllerEventDetected(event: event)
106 | }
107 | }
108 | }
109 |
110 | }
111 |
112 |
--------------------------------------------------------------------------------
/Example/SZAVPlayer/ListenerCenter/ListenerNode.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ListenerNode.swift
3 | //
4 | // Created by CaiSanze on 2020/01/05.
5 | //
6 |
7 | import UIKit
8 |
9 | class ListenerNode {
10 |
11 | public weak var listener: AnyObject?
12 |
13 | public static func create(listener: AnyObject) -> ListenerNode {
14 | let node = ListenerNode()
15 | node.listener = listener
16 |
17 | return node
18 | }
19 |
20 | public static func add(listener: AnyObject, to listenners: inout [ListenerNode]) {
21 | let node = ListenerNode.create(listener: listener)
22 | listenners.append(node)
23 | }
24 |
25 | public static func remove(listener: AnyObject, from listeners: inout [ListenerNode]) {
26 | for (index, node) in listeners.enumerated() {
27 | if let tmpListener = node.listener {
28 | if tmpListener.isEqual(listener) {
29 | listeners.remove(at: index)
30 | }
31 | } else {
32 | listeners.remove(at: index)
33 | }
34 | }
35 | }
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/Example/SZAVPlayer/ListenerCenter/ListenerProtocol.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ListenerProtocol.swift
3 | //
4 | // Created by CaiSanze on 2020/01/05.
5 | //
6 |
7 | import UIKit
8 |
9 | protocol ListenerBaseProtocol: AnyObject {
10 |
11 | }
12 |
13 | // MARK: - SystemEvent
14 |
15 | enum SystemEventType {
16 | case willResignActive
17 | case didEnterBackground
18 | case willEnterForeground
19 | case didBecomeActive
20 | case willTerminate
21 | }
22 |
23 | protocol SystemEventListenerProtocol: ListenerBaseProtocol {
24 | func onSystemEventDetected(application: UIApplication, type: SystemEventType) -> Void
25 | }
26 |
27 | // MARK: - PlayerControllerEvent
28 |
29 | enum PlayerControllerEventType {
30 | case none
31 | case playing
32 | case paused
33 | case stalled
34 | case failed
35 | }
36 |
37 | protocol PlayerControllerEventListenerProtocol: ListenerBaseProtocol {
38 | func onPlayerControllerEventDetected(event: PlayerControllerEventType) -> Void
39 | }
40 |
--------------------------------------------------------------------------------
/Example/SZAVPlayer/VideoView/FakeVideo.swift:
--------------------------------------------------------------------------------
1 | //
2 | // FakeAudio.swift
3 | //
4 | // Created by CaiSanze on 2019/11/29.
5 | //
6 |
7 | import UIKit
8 |
9 | class FakeVideo: NSObject {
10 |
11 | var cover: String = ""
12 | var title: String = ""
13 | var url: String = ""
14 |
15 | var isSelected: Bool = false
16 | var isFirst: Bool = false
17 | var isLast: Bool = false
18 |
19 | override func isEqual(_ object: Any?) -> Bool {
20 | if let object = object as? FakeVideo {
21 | return url == object.url
22 | }
23 |
24 | return false
25 | }
26 |
27 | static func fake1() -> FakeVideo {
28 | let video = FakeVideo()
29 | video.cover = "https://img9.doubanio.com/img/trailer/small/1509216846.jpg"
30 | video.title = "Titanic"
31 | video.url = "http://vt1.doubanio.com/202001021917/01b91ce2e71fd7f671e226ffe8ea0cda/view/movie/M/301120229.mp4"
32 |
33 | return video
34 | }
35 |
36 | static func fake2() -> FakeVideo {
37 | let video = FakeVideo()
38 | video.cover = "https://img3.doubanio.com/img/trailer/small/2412648020.jpg"
39 | video.title = "Inception"
40 | video.url = "http://vt1.doubanio.com/202001022001/7264e07afc6d8347c15f61c247c36f0e/view/movie/M/302100358.mp4"
41 |
42 | return video
43 | }
44 |
45 | static func fake3() -> FakeVideo {
46 | let video = FakeVideo()
47 | video.cover = "https://img9.doubanio.com/img/trailer/small/2209820525.jpg"
48 | video.title = "Interstellar"
49 | video.url = "http://vt1.doubanio.com/202001021947/7ae57141cc259bfb49e75bdf6b716caf/view/movie/M/301650578.mp4"
50 |
51 | return video
52 | }
53 |
54 | static func fake4() -> FakeVideo {
55 | let video = FakeVideo()
56 | video.cover = ""
57 | video.title = "Test Long Video"
58 | video.url = "https://seed128.bitchute.com/vBEqxcyTQvca/ucXUjHNSZo9G.mp4"
59 |
60 | return video
61 | }
62 |
63 | }
64 |
65 |
--------------------------------------------------------------------------------
/Example/SZAVPlayer/ViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.swift
3 | // SZAVPlayer
4 | //
5 | // Created by eroscai on 11/27/2019.
6 | // Copyright (c) 2019 eroscai. All rights reserved.
7 | //
8 |
9 | import UIKit
10 | import SnapKit
11 | import SZAVPlayer
12 |
13 | class ViewController: UIViewController {
14 |
15 | override func viewDidLoad() {
16 | super.viewDidLoad()
17 | // Do any additional setup after loading the view, typically from a nib.
18 |
19 | view.backgroundColor = .white
20 |
21 | let audioVCBtn = UIButton()
22 | audioVCBtn.backgroundColor = .black
23 | audioVCBtn.setTitle("Audio Example", for: .normal)
24 | audioVCBtn.setTitleColor(.white, for: .normal)
25 | audioVCBtn.addTarget(self, action: #selector(handleAudioVCBtnClick), for: .touchUpInside)
26 | view.addSubview(audioVCBtn)
27 | audioVCBtn.snp.makeConstraints { (make) in
28 | make.width.equalTo(200)
29 | make.height.equalTo(50)
30 | make.centerX.equalTo(view)
31 | make.centerY.equalTo(view).offset(-100)
32 | }
33 |
34 | let videoVCBtn1 = UIButton()
35 | videoVCBtn1.backgroundColor = .black
36 | videoVCBtn1.setTitle("Video Example", for: .normal)
37 | videoVCBtn1.setTitleColor(.white, for: .normal)
38 | videoVCBtn1.addTarget(self, action: #selector(handleVideoVCBtnClick), for: .touchUpInside)
39 | view.addSubview(videoVCBtn1)
40 | videoVCBtn1.snp.makeConstraints { (make) in
41 | make.width.equalTo(200)
42 | make.height.equalTo(50)
43 | make.centerX.equalTo(view)
44 | make.centerY.equalTo(view).offset(40)
45 | }
46 |
47 | let videoVCBtn2 = UIButton()
48 | videoVCBtn2.backgroundColor = .black
49 | videoVCBtn2.setTitle("Video Example With Output", for: .normal)
50 | videoVCBtn2.setTitleColor(.white, for: .normal)
51 | videoVCBtn2.addTarget(self, action: #selector(handleVideoOutputVCBtnClick), for: .touchUpInside)
52 | view.addSubview(videoVCBtn2)
53 | videoVCBtn2.snp.makeConstraints { (make) in
54 | make.width.equalTo(300)
55 | make.height.equalTo(50)
56 | make.centerX.equalTo(view)
57 | make.centerY.equalTo(view).offset(110)
58 | }
59 |
60 | }
61 |
62 | @objc func handleAudioVCBtnClick() {
63 | let vc = AudioViewController()
64 | navigationController?.pushViewController(vc, animated: true)
65 | }
66 |
67 | @objc func handleVideoVCBtnClick() {
68 | let vc = VideoViewController()
69 | navigationController?.pushViewController(vc, animated: true)
70 | }
71 |
72 | @objc func handleVideoOutputVCBtnClick() {
73 | let vc = VideoViewController(enableVideoOutput: true)
74 | navigationController?.pushViewController(vc, animated: true)
75 | }
76 |
77 | }
78 |
79 |
--------------------------------------------------------------------------------
/Example/Tests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Example/Tests/Tests.swift:
--------------------------------------------------------------------------------
1 | import XCTest
2 | import SZAVPlayer
3 |
4 | class Tests: XCTestCase {
5 |
6 | override func setUp() {
7 | super.setUp()
8 | // Put setup code here. This method is called before the invocation of each test method in the class.
9 | }
10 |
11 | override func tearDown() {
12 | // Put teardown code here. This method is called after the invocation of each test method in the class.
13 | super.tearDown()
14 | }
15 |
16 | func testExample() {
17 | // This is an example of a functional test case.
18 | XCTAssert(true, "Pass")
19 | }
20 |
21 | func testPerformanceExample() {
22 | // This is an example of a performance test case.
23 | self.measure() {
24 | // Put the code you want to measure the time of here.
25 | }
26 | }
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2019 eroscai
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 |
--------------------------------------------------------------------------------
/MainFlow.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eroscai/SZAVPlayer/4f6cf619650f76bc0b2d7ab068dc5c083490018b/MainFlow.jpg
--------------------------------------------------------------------------------
/Package.swift:
--------------------------------------------------------------------------------
1 | // swift-tools-version:5.1
2 | // The swift-tools-version declares the minimum version of Swift required to build this package.
3 |
4 | import PackageDescription
5 |
6 | let package = Package(
7 | name: "SZAVPlayer",
8 | platforms: [.iOS(.v10)],
9 | products: [
10 | // Products define the executables and libraries produced by a package, and make them visible to other packages.
11 | .library(
12 | name: "SZAVPlayer",
13 | targets: ["SZAVPlayer"]),
14 | ],
15 | dependencies: [
16 | // Dependencies declare other packages that this package depends on.
17 | // .package(url: /* package url */, from: "1.0.0"),
18 | ],
19 | targets: [
20 | // Targets are the basic building blocks of a package. A target can define a module or a test suite.
21 | // Targets can depend on other targets in this package, and on products in packages which this package depends on.
22 | .target(
23 | name: "SZAVPlayer",
24 | path: "Sources"
25 | ),
26 | ],
27 | swiftLanguageVersions: [.v5]
28 | )
29 |
--------------------------------------------------------------------------------
/SZAVPlayer.podspec:
--------------------------------------------------------------------------------
1 | #
2 | # Be sure to run `pod lib lint SZAVPlayer.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 https://guides.cocoapods.org/syntax/podspec.html
7 | #
8 |
9 | Pod::Spec.new do |s|
10 | s.name = 'SZAVPlayer'
11 | s.version = '1.3.5'
12 | s.summary = 'Swift AVPlayer, based on AVAssetResourceLoaderDelegate, support cache.'
13 |
14 | # This description is used to generate tags and improve search results.
15 | # * Think: What does it do? Why did you write it? What is the focus?
16 | # * Try to keep it short, snappy and to the point.
17 | # * Write the description between the DESC delimiters below.
18 | # * Finally, don't worry about the indent, CocoaPods strips it!
19 |
20 | s.description = <<-DESC
21 | SZAVPlayer is a lightweight audio player library, based on AVPlayer, pure-Swift. Video playing will be supported later.
22 | DESC
23 |
24 | s.homepage = 'https://github.com/eroscai/SZAVPlayer'
25 | # s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2'
26 | s.license = { :type => 'MIT', :file => 'LICENSE' }
27 | s.author = { 'eroscai' => 'csz0102@gmail.com' }
28 | s.source = { :git => 'https://github.com/eroscai/SZAVPlayer.git', :tag => s.version.to_s }
29 | # s.social_media_url = 'https://twitter.com/'
30 |
31 | s.ios.deployment_target = '10.0'
32 | s.swift_version = '5.0'
33 |
34 | s.source_files = 'Sources/Classes/**/*'
35 | s.resource = 'Sources/PrivacyInfo.xcprivacy'
36 |
37 | # s.resource_bundles = {
38 | # 'SZAVPlayer' => ['SZAVPlayer/Assets/*.png']
39 | # }
40 |
41 | # s.public_header_files = 'Pod/Classes/**/*.h'
42 | s.frameworks = 'UIKit', 'CoreServices', 'AVFoundation'
43 | end
44 |
--------------------------------------------------------------------------------
/Sources/Assets/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eroscai/SZAVPlayer/4f6cf619650f76bc0b2d7ab068dc5c083490018b/Sources/Assets/.gitkeep
--------------------------------------------------------------------------------
/Sources/Classes/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eroscai/SZAVPlayer/4f6cf619650f76bc0b2d7ab068dc5c083490018b/Sources/Classes/.gitkeep
--------------------------------------------------------------------------------
/Sources/Classes/Model/SZAVPlayerConfig.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SZAVPlayerConfig.swift
3 | // SZAVPlayer
4 | //
5 | // Created by CaiSanze on 2020/1/6.
6 | //
7 |
8 | import UIKit
9 | import AVKit
10 |
11 | public struct SZAVPlayerConfig {
12 |
13 | public var urlStr: String // The URL value for playing.
14 | public var uniqueID: String? // The uniqueID to identify wether they are the same audio. If set to nil will use urlStr to create one.
15 | public var isVideo: Bool // Is video or not.
16 | public var isVideoOutputEnabled: Bool // Output video image function enabled or not.
17 | public var timeObserverInterval: Float64 = 1 // TimeObserver interval, default value is 1s.
18 | public var videoGravity: AVLayerVideoGravity = .resizeAspect
19 |
20 | /// If set to ture, the asset will be loaded with the system's own way. It is suitable for situations like
21 | /// local files or you don't needed custom loading.
22 | public var disableCustomLoading: Bool = false
23 |
24 | public var headersForContentInfoRequest: [String: String]?
25 | public var headersForDataRequest: [String: String]?
26 |
27 | public init(urlStr: String, uniqueID: String?, isVideo: Bool = false, isVideoOutputEnabled: Bool = false) {
28 | self.urlStr = urlStr
29 | self.uniqueID = uniqueID
30 | self.isVideo = isVideo
31 | self.isVideoOutputEnabled = isVideoOutputEnabled
32 | }
33 |
34 | public static var `default`: SZAVPlayerConfig {
35 | return SZAVPlayerConfig(urlStr: "fakeURL.com", uniqueID: nil)
36 | }
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/Sources/Classes/Model/SZAVPlayerContentInfo.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SZAVPlayerContentInfo.swift
3 | // SZAVPlayer
4 | //
5 | // Created by CaiSanze on 2019/12/6.
6 | //
7 |
8 | import UIKit
9 |
10 | public struct SZAVPlayerContentInfo: SZBaseModel {
11 |
12 | static let tableName: String = "SZAVPlayerContentInfo"
13 |
14 | var uniqueID: String
15 | var mimeType: String
16 | var contentLength: Int64
17 | var updated: Int64 = 0
18 | var isByteRangeAccessSupported: Bool = false
19 |
20 | static func isNotExpired(updated: Int64) -> Bool {
21 | let expiredTimeInterval = 3600
22 | return Int64(Date().timeIntervalSince1970) - updated <= expiredTimeInterval
23 | }
24 |
25 | }
26 |
27 | extension SZAVPlayerContentInfo: Decodable {
28 |
29 | public init(from decoder: Decoder) throws {
30 | let values = try decoder.container(keyedBy: CodingKeys.self)
31 |
32 | uniqueID = try values.decode(String.self, forKey: .uniqueID)
33 | mimeType = try values.decode(String.self, forKey: .mimeType)
34 | contentLength = try values.decode(Int64.self, forKey: .contentLength)
35 | updated = try values.decode(Int64.self, forKey: .updated)
36 |
37 | let rangeAccessSupportedValue = try values.decode(Int.self, forKey: .isByteRangeAccessSupported)
38 | isByteRangeAccessSupported = rangeAccessSupportedValue == 1 ? true : false
39 | }
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/Sources/Classes/Model/SZAVPlayerError.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SZAVPlayerError.swift
3 | // SZAVPlayer
4 | //
5 | // Created by CaiSanze on 2019/12/10.
6 | //
7 |
8 | import Foundation
9 |
10 | public enum SZAVPlayerError: Error {
11 | case localFileNotExist
12 | }
13 |
--------------------------------------------------------------------------------
/Sources/Classes/Model/SZAVPlayerLocalFileInfo.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SZAVPlayerLocalFileInfo.swift
3 | // SZAVPlayer
4 | //
5 | // Created by CaiSanze on 2019/12/6.
6 | //
7 |
8 | import UIKit
9 |
10 | public struct SZAVPlayerLocalFileInfo: SZBaseModel {
11 |
12 | static var tableName: String = "SZAVPlayerLocalFileInfo"
13 |
14 | var uniqueID: String
15 | var startOffset: Int64
16 | var loadedByteLength: Int64
17 | var localFileName: String
18 | var updated: Int64 = 0
19 |
20 | static func newFileName(uniqueID: String) -> String {
21 | let timeInterval = Int64(Date().timeIntervalSince1970 * 1000)
22 |
23 | return "\(timeInterval)"
24 | }
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/Sources/Classes/Model/SZAVPlayerSeekItem.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SZAVPlayerSeekItem.swift
3 | // SZAVPlayer
4 | //
5 | // Created by CaiSanze on 2019/12/23.
6 | //
7 |
8 | import Foundation
9 |
10 | struct SZAVPlayerSeekItem {
11 |
12 | var time: Float64
13 | var autoPlay: Bool
14 | var completion: SZAVPlayer.SeekCompletion?
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/Sources/Classes/Model/SZBaseModel.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SZBaseModel.swift
3 | // SZAVPlayer
4 | //
5 | // Created by CaiSanze on 2019/12/13.
6 | //
7 |
8 | import UIKit
9 |
10 | protocol SZBaseModel: Codable {
11 | static var tableName: String { get }
12 | static func deserialize(data: Any) -> Self?
13 | }
14 |
15 | extension SZBaseModel {
16 |
17 | static func deserialize(data: Any) -> Self? {
18 | do {
19 | let jsonData = try JSONSerialization.data(withJSONObject: data, options: [])
20 | let info = try JSONDecoder().decode(Self.self, from: jsonData)
21 | return info
22 | } catch {
23 | SZLogError("\(error)")
24 | }
25 |
26 | return nil
27 | }
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/Sources/Classes/Request/SZAVPlayerDataLoader.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SZAVPlayerDataLoader.swift
3 | // SZAVPlayer
4 | //
5 | // Created by CaiSanze on 2019/12/6.
6 | //
7 |
8 | import UIKit
9 |
10 | public typealias SZAVPlayerRange = Range
11 |
12 | protocol SZAVPlayerDataLoaderDelegate: AnyObject {
13 |
14 | func dataLoader(_ loader: SZAVPlayerDataLoader, willBeginRequest dataRequest: SZAVPlayerDataRequest)
15 | func dataLoader(_ loader: SZAVPlayerDataLoader, didFinishRequest dataRequest: SZAVPlayerDataRequest, error: Error?)
16 | func dataLoader(_ loader: SZAVPlayerDataLoader, didReceive data: Data, dataRequest: SZAVPlayerDataRequest)
17 |
18 | }
19 |
20 | class SZAVPlayerDataLoader: NSObject {
21 |
22 | public weak var delegate: SZAVPlayerDataLoaderDelegate?
23 |
24 | private let callbackQueue: DispatchQueue
25 | private lazy var dataLoaderOperationQueue = createOperationQueue(name: "dataLoaderOperationQueue")
26 | private let uniqueID: String
27 | private let url: URL
28 | private let config: SZAVPlayerConfig
29 | private var mediaData: Data?
30 |
31 | init(uniqueID: String, url: URL, config: SZAVPlayerConfig, callbackQueue: DispatchQueue) {
32 | self.uniqueID = uniqueID
33 | self.url = url
34 | self.config = config
35 | self.callbackQueue = callbackQueue
36 | super.init()
37 | }
38 |
39 | deinit {
40 | SZLogInfo("deinit")
41 | }
42 |
43 | public func append(requestedRange: SZAVPlayerRange, dataRequest: SZAVPlayerDataRequest) {
44 | let dataLoaderOperation = SZAVPlayerDataLoaderOperation(uniqueID: uniqueID,
45 | url: url,
46 | config: config,
47 | requestedRange: requestedRange,
48 | dataRequest: dataRequest)
49 | dataLoaderOperation.delegate = self
50 | dataLoaderOperationQueue.addOperation(dataLoaderOperation)
51 | }
52 |
53 | public func cancel() {
54 | dataLoaderOperationQueue.cancelAllOperations()
55 | }
56 |
57 | public static func isOutOfRange(startOffset: Int64, endOffset: Int64, fileInfo: SZAVPlayerLocalFileInfo) -> Bool {
58 | let localFileStartOffset = fileInfo.startOffset
59 | let localFileEndOffset = fileInfo.startOffset + fileInfo.loadedByteLength
60 | let remainRange = startOffset..= endOffset
64 |
65 | return !(isIntersectionWithRange || isContainsRange)
66 | }
67 |
68 | }
69 |
70 | // MARK: - SZAVPlayerDataLoaderOperationDelegate
71 |
72 | extension SZAVPlayerDataLoader: SZAVPlayerDataLoaderOperationDelegate {
73 |
74 | func dataLoaderOperation(_ operation: SZAVPlayerDataLoaderOperation, willBeginRequest dataRequest: SZAVPlayerDataRequest) {
75 | delegate?.dataLoader(self, willBeginRequest: dataRequest)
76 | }
77 |
78 | func dataLoaderOperation(_ operation: SZAVPlayerDataLoaderOperation, didReceive data: Data, dataRequest: SZAVPlayerDataRequest) {
79 | callbackQueue.sync { [weak self] in
80 | guard let self = self else { return }
81 |
82 | self.delegate?.dataLoader(self, didReceive: data, dataRequest: dataRequest)
83 | }
84 | }
85 |
86 | func dataLoaderOperation(_ operation: SZAVPlayerDataLoaderOperation, didFinishRequest dataRequest: SZAVPlayerDataRequest, error: Error?) {
87 | callbackQueue.sync { [weak self] in
88 | guard let self = self else { return }
89 |
90 | self.delegate?.dataLoader(self, didFinishRequest: dataRequest, error: error)
91 | }
92 | }
93 |
94 | }
95 |
96 | // MARK: - Getter
97 |
98 | extension SZAVPlayerDataLoader {
99 |
100 | private func createOperationQueue(name: String) -> OperationQueue {
101 | let queue = OperationQueue()
102 | queue.name = name
103 |
104 | return queue
105 | }
106 |
107 | }
108 |
--------------------------------------------------------------------------------
/Sources/Classes/Request/SZAVPlayerItemRequest.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SZAVPlayerItemRequest.swift
3 | // SZAVPlayer
4 | //
5 | // Created by CaiSanze on 2019/11/28.
6 | //
7 | //
8 |
9 | import Foundation
10 | import AVFoundation
11 |
12 | protocol SZAVPlayerRequest: AnyObject {
13 |
14 | var resourceUrl: URL { get }
15 | var loadingRequest: AVAssetResourceLoadingRequest { get }
16 |
17 | func cancel()
18 |
19 | }
20 |
21 | public class SZAVPlayerContentInfoRequest: SZAVPlayerRequest {
22 |
23 | let resourceUrl: URL
24 | let loadingRequest: AVAssetResourceLoadingRequest
25 | let infoRequest: AVAssetResourceLoadingContentInformationRequest
26 | let task: URLSessionTask
27 |
28 | init(resourceUrl: URL,
29 | loadingRequest: AVAssetResourceLoadingRequest,
30 | infoRequest: AVAssetResourceLoadingContentInformationRequest,
31 | task: URLSessionTask)
32 | {
33 | self.resourceUrl = resourceUrl
34 | self.loadingRequest = loadingRequest
35 | self.infoRequest = infoRequest
36 | self.task = task
37 | }
38 |
39 | func cancel() {
40 | task.cancel()
41 | if !loadingRequest.isCancelled && !loadingRequest.isFinished {
42 | loadingRequest.finishLoading()
43 | }
44 | }
45 |
46 | }
47 |
48 | public class SZAVPlayerDataRequest: SZAVPlayerRequest {
49 |
50 | let resourceUrl: URL
51 | let loadingRequest: AVAssetResourceLoadingRequest
52 | let dataRequest: AVAssetResourceLoadingDataRequest
53 | let range: SZAVPlayerRange
54 |
55 | init(resourceUrl: URL,
56 | loadingRequest: AVAssetResourceLoadingRequest,
57 | dataRequest: AVAssetResourceLoadingDataRequest,
58 | range: SZAVPlayerRange)
59 | {
60 | self.resourceUrl = resourceUrl
61 | self.loadingRequest = loadingRequest
62 | self.dataRequest = dataRequest
63 | self.range = range
64 | }
65 |
66 | func cancel() {
67 | if !loadingRequest.isCancelled && !loadingRequest.isFinished {
68 | loadingRequest.finishLoading()
69 | }
70 | }
71 |
72 | }
73 |
74 | public class SZAVPlayerLocalFileRequest: SZAVPlayerRequest {
75 |
76 | let resourceUrl: URL
77 | let loadingRequest: AVAssetResourceLoadingRequest
78 | let dataRequest: AVAssetResourceLoadingDataRequest
79 |
80 | init(resourceUrl: URL,
81 | loadingRequest: AVAssetResourceLoadingRequest,
82 | dataRequest: AVAssetResourceLoadingDataRequest)
83 | {
84 | self.resourceUrl = resourceUrl
85 | self.loadingRequest = loadingRequest
86 | self.dataRequest = dataRequest
87 | }
88 |
89 | func cancel() {
90 | if !loadingRequest.isCancelled && !loadingRequest.isFinished {
91 | loadingRequest.finishLoading()
92 | }
93 | }
94 |
95 | }
96 |
--------------------------------------------------------------------------------
/Sources/Classes/Request/SZAVPlayerRequestOperation.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SZAVPlayerRequestOperation.swift
3 | // SZAVPlayer
4 | //
5 | // Created by CaiSanze on 2019/12/6.
6 | //
7 | //
8 |
9 | import Foundation
10 |
11 | public protocol SZAVPlayerRequestOperationDelegate: AnyObject {
12 | func requestOperationWillStart(_ operation: SZAVPlayerRequestOperation)
13 | func requestOperation(_ operation: SZAVPlayerRequestOperation, didReceive data: Data)
14 | func requestOperation(_ operation: SZAVPlayerRequestOperation, didCompleteWithError error: Error?)
15 | }
16 |
17 | public class SZAVPlayerRequestOperation: Operation {
18 |
19 | public typealias CompletionHandler = () -> Void
20 | public weak var delegate: SZAVPlayerRequestOperationDelegate?
21 | private(set) public var startOffset: Int64 = 0
22 |
23 | private var requestCompletion: CompletionHandler?
24 | private lazy var session: URLSession = createSession()
25 | private var task: URLSessionDataTask?
26 | private let config: SZAVPlayerConfig
27 |
28 | private var _finished: Bool = false
29 | private var _executing: Bool = false
30 |
31 | deinit {
32 | SZLogInfo("deinit")
33 | }
34 |
35 | public init(url: URL, range: SZAVPlayerRange?, config: SZAVPlayerConfig) {
36 | self.config = config
37 | super.init()
38 |
39 | requestCompletion = defaultCompletion()
40 | task = dataRequest(url: url, range: range)
41 | }
42 |
43 | private func work(completion: @escaping CompletionHandler) {
44 | requestCompletion = completion
45 | delegate?.requestOperationWillStart(self)
46 | task?.resume()
47 | }
48 |
49 | // MARK: Operation Requirements
50 |
51 | override public func start() {
52 | guard !isCancelled else {return}
53 | markAsRunning()
54 | DispatchQueue.global(qos: .background).async {
55 | self.work { [weak self] in
56 | guard let self = self else { return }
57 |
58 | self.session.finishTasksAndInvalidate()
59 | DispatchQueue.main.async {
60 | guard !self.isCancelled else {return}
61 | self.markAsFinished()
62 | }
63 | }
64 | }
65 | }
66 |
67 | override public func cancel() {
68 | task?.cancel()
69 |
70 | if isExecuting {
71 | markAsFinished()
72 | }
73 | }
74 |
75 | override open var isFinished: Bool {
76 | get { return _finished }
77 | set { _finished = newValue }
78 | }
79 |
80 | override open var isExecuting: Bool {
81 | get { return _executing }
82 | set { _executing = newValue }
83 | }
84 |
85 | override open var isAsynchronous: Bool {
86 | return true
87 | }
88 |
89 | }
90 |
91 | // MARK: - Private
92 |
93 | extension SZAVPlayerRequestOperation {
94 |
95 | private func markAsRunning() {
96 | willChangeValue(for: .isExecuting)
97 | _executing = true
98 | didChangeValue(for: .isExecuting)
99 | }
100 |
101 | private func markAsFinished() {
102 | willChangeValue(for: .isExecuting)
103 | willChangeValue(for: .isFinished)
104 | _executing = false
105 | _finished = true
106 | didChangeValue(for: .isExecuting)
107 | didChangeValue(for: .isFinished)
108 | }
109 |
110 | private func willChangeValue(for key: OperationChangeKey) {
111 | self.willChangeValue(forKey: key.rawValue)
112 | }
113 |
114 | private func didChangeValue(for key: OperationChangeKey) {
115 | self.didChangeValue(forKey: key.rawValue)
116 | }
117 |
118 | private enum OperationChangeKey: String {
119 | case isFinished
120 | case isExecuting
121 | }
122 |
123 | }
124 |
125 | // MARK: - URLSessionDelegate
126 |
127 | extension SZAVPlayerRequestOperation: URLSessionDataDelegate {
128 |
129 | public func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didReceive data: Data) {
130 | delegate?.requestOperation(self, didReceive: data)
131 | }
132 |
133 | public func urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError error: Error?) {
134 | delegate?.requestOperation(self, didCompleteWithError: error)
135 |
136 | if let completion = requestCompletion {
137 | completion()
138 | }
139 | }
140 |
141 | }
142 |
143 | // MARK: - Getter
144 |
145 | extension SZAVPlayerRequestOperation {
146 |
147 | private func dataRequest(url: URL, range: SZAVPlayerRange? = nil) -> URLSessionDataTask {
148 | var request = URLRequest(url: url)
149 | if let range = range {
150 | let rangeHeader = "bytes=\(range.lowerBound)-\(range.upperBound)"
151 | request.setValue(rangeHeader, forHTTPHeaderField: "Range")
152 | startOffset = range.lowerBound
153 | }
154 |
155 | if let headers = config.headersForDataRequest {
156 | for (key, value) in headers {
157 | request.setValue(value, forHTTPHeaderField: key)
158 | }
159 | }
160 |
161 | return session.dataTask(with: request)
162 | }
163 |
164 | private func createSession() -> URLSession {
165 | let configuration = URLSessionConfiguration.default
166 | configuration.requestCachePolicy = .reloadIgnoringLocalCacheData
167 | let session = URLSession(configuration: configuration, delegate: self, delegateQueue: nil)
168 |
169 | return session
170 | }
171 |
172 | private func defaultCompletion() -> CompletionHandler {
173 | return { [weak self] in
174 | self?.markAsFinished()
175 | }
176 | }
177 |
178 | }
179 |
--------------------------------------------------------------------------------
/Sources/Classes/Storage/SZAVPlayerCache.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SZAVPlayerCache.swift
3 | //
4 | // Created by CaiSanze on 2019/11/27.
5 | //
6 |
7 | import UIKit
8 |
9 | public class SZAVPlayerCache: NSObject {
10 |
11 | public static let shared: SZAVPlayerCache = SZAVPlayerCache()
12 |
13 | private var maxCacheSize: Int64 = 0
14 |
15 | override init() {
16 | super.init()
17 |
18 | setup(maxCacheSize: 100)
19 | trimCache()
20 | }
21 |
22 | /// Setup
23 | /// - Parameter maxCacheSize: Unit: MB
24 | public func setup(maxCacheSize: Int64) {
25 | self.maxCacheSize = maxCacheSize
26 | SZAVPlayerFileSystem.createCacheDirectory()
27 | }
28 |
29 | public func save(uniqueID: String, mediaData: Data, startOffset: Int64) {
30 | let newFileName = SZAVPlayerLocalFileInfo.newFileName(uniqueID: uniqueID)
31 | let localFilePath = SZAVPlayerFileSystem.localFilePath(fileName: newFileName)
32 | if SZAVPlayerFileSystem.write(data: mediaData, url: localFilePath) {
33 | let fileInfo = SZAVPlayerLocalFileInfo(uniqueID: uniqueID,
34 | startOffset: startOffset,
35 | loadedByteLength: Int64(mediaData.count),
36 | localFileName: newFileName)
37 | SZAVPlayerDatabase.shared.update(fileInfo: fileInfo)
38 | }
39 |
40 | trimCache()
41 | }
42 |
43 | public func delete(uniqueID: String) {
44 | SZAVPlayerDatabase.shared.trimData(uniqueID: uniqueID)
45 | }
46 |
47 | public func cleanCache() {
48 | SZAVPlayerDatabase.shared.cleanData()
49 | SZAVPlayerFileSystem.cleanCachedFiles()
50 | }
51 |
52 | public func isFullyCached(uniqueID: String) -> Bool {
53 | let info = SZAVPlayerDatabase.shared.contentInfo(uniqueID: uniqueID)
54 | let localFileInfos = SZAVPlayerDatabase.shared.localFileInfos(uniqueID: uniqueID)
55 | guard let contentInfo = info, contentInfo.contentLength > 0,
56 | localFileInfos.count > 0 else
57 | {
58 | return false
59 | }
60 |
61 | var startOffset = Int64(0)
62 | let endOffset = contentInfo.contentLength
63 | for fileInfo in localFileInfos {
64 | if SZAVPlayerDataLoader.isOutOfRange(startOffset: startOffset, endOffset: endOffset, fileInfo: fileInfo) {
65 | break
66 | }
67 |
68 | let localFileStartOffset = fileInfo.startOffset
69 | if startOffset >= localFileStartOffset {
70 | let localFileStartOffset = max(0, startOffset - fileInfo.startOffset)
71 | let localFileUsefulLength = min(fileInfo.loadedByteLength - localFileStartOffset, endOffset)
72 | startOffset = startOffset + localFileUsefulLength
73 | } else {
74 | break
75 | }
76 | }
77 |
78 | let isFullyCached = startOffset >= endOffset
79 | return isFullyCached
80 | }
81 |
82 | public func trimCache() {
83 | DispatchQueue.global(qos: .background).async {
84 | let directory = SZAVPlayerFileSystem.cacheDirectory
85 | let allFiles: [URL] = SZAVPlayerFileSystem.allFiles(path: directory)
86 | var totalFileSize: Int64 = 0
87 | for file in allFiles {
88 | if let attributes = SZAVPlayerFileSystem.attributes(url: file.path),
89 | let fileSize = attributes[FileAttributeKey.size] as? Int64
90 | {
91 | totalFileSize += fileSize
92 | }
93 | }
94 |
95 | totalFileSize /= 1024 * 1024
96 | if totalFileSize >= self.maxCacheSize {
97 | SZAVPlayerDatabase.shared.trimData()
98 | }
99 | }
100 | }
101 |
102 | }
103 |
104 | // MARK: - Getter
105 |
106 | extension SZAVPlayerCache {
107 |
108 | public static func dataExist(uniqueID: String) -> Bool {
109 | return SZAVPlayerFileSystem.isExist(url: fileURL(uniqueID: uniqueID))
110 | }
111 |
112 | private static func fileURL(uniqueID: String) -> URL {
113 | return SZAVPlayerFileSystem.cacheDirectory.appendingPathComponent(uniqueID)
114 | }
115 |
116 | }
117 |
--------------------------------------------------------------------------------
/Sources/Classes/Utils/SZLog.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SZLog.swift
3 | //
4 | // Created by CaiSanze on 2019/11/27.
5 | //
6 |
7 | import UIKit
8 |
9 | #if DEBUG
10 | private let shouldLog: Bool = true
11 | #else
12 | private let shouldLog: Bool = false
13 | #endif
14 |
15 | @inlinable
16 | public func SZLogError(_ message: @autoclosure () -> String,
17 | file: StaticString = #file,
18 | function: StaticString = #function,
19 | line: UInt = #line)
20 | {
21 | SZLog.log(message(), type: .error, file: file, function: function, line: line)
22 | }
23 |
24 | @inlinable
25 | public func SZLogWarn(_ message: @autoclosure () -> String,
26 | file: StaticString = #file,
27 | function: StaticString = #function,
28 | line: UInt = #line)
29 | {
30 | SZLog.log(message(), type: .warning, file: file, function: function, line: line)
31 | }
32 |
33 | @inlinable
34 | public func SZLogInfo(_ message: @autoclosure () -> String,
35 | file: StaticString = #file,
36 | function: StaticString = #function,
37 | line: UInt = #line)
38 | {
39 | SZLog.log(message(), type: .info, file: file, function: function, line: line)
40 | }
41 |
42 | @inlinable
43 | public func SZLogDebug(_ message: @autoclosure () -> String,
44 | file: StaticString = #file,
45 | function: StaticString = #function,
46 | line: UInt = #line)
47 | {
48 | SZLog.log(message(), type: .debug, file: file, function: function, line: line)
49 | }
50 |
51 | @inlinable
52 | public func SZLogVerbose(_ message: @autoclosure () -> String,
53 | file: StaticString = #file,
54 | function: StaticString = #function,
55 | line: UInt = #line)
56 | {
57 | SZLog.log(message(), type: .verbose, file: file, function: function, line: line)
58 | }
59 |
60 | public class SZLog {
61 | public enum logType {
62 | case error
63 | case warning
64 | case info
65 | case debug
66 | case verbose
67 | }
68 |
69 | public static func log(_ message: @autoclosure () -> String,
70 | type: logType,
71 | file: StaticString,
72 | function: StaticString,
73 | line: UInt)
74 | {
75 | guard shouldLog else { return }
76 |
77 | let fileName = String(describing: file).lastPathComponent
78 | let formattedMsg = String(format: "file:%@ func:%@ line:%d msg:---%@", fileName, String(describing: function), line, message())
79 | SZLogFormatter.shared.log(message: formattedMsg, type: type)
80 | }
81 |
82 | }
83 |
84 | private extension String {
85 |
86 | var fileURL: URL {
87 | return URL(fileURLWithPath: self)
88 | }
89 |
90 | var pathExtension: String {
91 | return fileURL.pathExtension
92 | }
93 |
94 | var lastPathComponent: String {
95 | return fileURL.lastPathComponent
96 | }
97 |
98 | }
99 |
100 | class SZLogFormatter: NSObject {
101 |
102 | static let shared = SZLogFormatter()
103 | let dateFormatter: DateFormatter
104 |
105 | override init() {
106 | dateFormatter = DateFormatter()
107 | dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss:SSS"
108 | super.init()
109 | }
110 |
111 | func log(message logMessage: String, type: SZLog.logType) {
112 | var logLevelStr: String
113 | switch type {
114 | case .error:
115 | logLevelStr = "‼️ Error"
116 | case .warning:
117 | logLevelStr = "⚠️ Warning"
118 | case .info:
119 | logLevelStr = "ℹ️ Info"
120 | case .debug:
121 | logLevelStr = "✅ Debug"
122 | case .verbose:
123 | logLevelStr = "⚪ Verbose"
124 | }
125 |
126 | let dateStr = dateFormatter.string(from: Date())
127 | let finalMessage = String(format: "%@ | %@ %@", logLevelStr, dateStr, logMessage)
128 | print(finalMessage)
129 | }
130 | }
131 |
--------------------------------------------------------------------------------
/Sources/PrivacyInfo.xcprivacy:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | NSPrivacyTracking
6 |
7 | NSPrivacyTrackingDomains
8 |
9 | NSPrivacyCollectedDataTypes
10 |
11 | NSPrivacyAccessedAPITypes
12 |
13 |
14 | NSPrivacyAccessedAPITypeReasons
15 |
16 | DDA9.1
17 |
18 | NSPrivacyAccessedAPIType
19 | NSPrivacyAccessedAPICategoryFileTimestamp
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/Tests/LinuxMain.swift:
--------------------------------------------------------------------------------
1 | import XCTest
2 |
3 | import SZAVPlayerTests
4 |
5 | var tests = [XCTestCaseEntry]()
6 | tests += SZAVPlayerTests.allTests()
7 | XCTMain(tests)
8 |
--------------------------------------------------------------------------------
/Tests/SZAVPlayerTests/SZAVPlayerTests.swift:
--------------------------------------------------------------------------------
1 | import XCTest
2 | @testable import SZAVPlayer
3 |
4 | final class SZAVPlayerTests: XCTestCase {
5 | func testExample() {
6 | // This is an example of a functional test case.
7 | // Use XCTAssert and related functions to verify your tests produce the correct
8 | // results.
9 | XCTAssertEqual(SZAVPlayer().text, "Hello, World!")
10 | }
11 |
12 | static var allTests = [
13 | ("testExample", testExample),
14 | ]
15 | }
16 |
--------------------------------------------------------------------------------
/Tests/SZAVPlayerTests/XCTestManifests.swift:
--------------------------------------------------------------------------------
1 | import XCTest
2 |
3 | #if !canImport(ObjectiveC)
4 | public func allTests() -> [XCTestCaseEntry] {
5 | return [
6 | testCase(SZAVPlayerTests.allTests),
7 | ]
8 | }
9 | #endif
10 |
--------------------------------------------------------------------------------
/_Pods.xcodeproj:
--------------------------------------------------------------------------------
1 | Example/Pods/Pods.xcodeproj
--------------------------------------------------------------------------------