Compare commits
65 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f2e8d4411f | |||
| 3c2848ffd1 | |||
| f162d50891 | |||
| 9f34fcb70c | |||
| fed617321f | |||
| 139082d366 | |||
| ca43421a8f | |||
| 08975badd3 | |||
| 72759913ae | |||
| 410f53dc1c | |||
| 7916101d7b | |||
| 17313e2bd3 | |||
| fc09d21272 | |||
| 1b85dfa196 | |||
| 830bceb3cb | |||
| 8b467a2b59 | |||
| 7656a3f287 | |||
| aa2f484b6b | |||
| fd21f9adb7 | |||
| ffb3e42939 | |||
| a59bacaf89 | |||
| ab373c569a | |||
| 29c7b63352 | |||
| 45a2479733 | |||
| 36ec1c3d12 | |||
| 59832f0e4b | |||
| f77b041bce | |||
| 07ddae83a0 | |||
| 7ae64d9350 | |||
| 51b9c84daa | |||
| 211dcf48a6 | |||
| e3ae3d440e | |||
| 87b208dc1b | |||
| 9449d4d9d6 | |||
| 5249c14314 | |||
| f95ba4f1e4 | |||
| ad9dfd7f5a | |||
| 6d7e1a010b | |||
| 262727193c | |||
| a17e142cfa | |||
| 99591d784f | |||
| c4ff71566c | |||
| 1418eeda0f | |||
| 8aeab6b534 | |||
| 45ef8d369f | |||
| 8e4786465a | |||
| 353468f82a | |||
| f2c2dec7e9 | |||
| f71316aded | |||
| 5a6ac33d30 | |||
| 2efe85d480 | |||
| 74647ef9ba | |||
| 2a14634869 | |||
| 42f03ef1be | |||
| 4e56501f41 | |||
| 6236c59b73 | |||
| e140d52e21 | |||
| 9c3ba97d6b | |||
| 892a66c9b0 | |||
| 01997fcddd | |||
| 49b0b16761 | |||
| 09c40f710e | |||
| f844311ff1 | |||
| 8669d9685c | |||
| 9c66a0b6f3 |
+1
-1
@@ -2,6 +2,6 @@
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "self:ContainerControllerSwift.xcodeproj">
|
||||
location = "self:">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
@@ -7,9 +7,9 @@
|
||||
#
|
||||
|
||||
Pod::Spec.new do |s|
|
||||
s.name = 'ContainerControllerSwift'
|
||||
s.version = '1.0.0'
|
||||
s.summary = 'This is a swipe-panel from application: https://www.apple.com/ios/maps/'
|
||||
s.name = 'ContainerControllerSwift'
|
||||
s.version = '1.1.3'
|
||||
s.summary = 'This is a swipe-panel from application: https://www.apple.com/ios/maps/'
|
||||
|
||||
# This description is used to generate tags and improve search results.
|
||||
# * Think: What does it do? Why did you write it? What is the focus?
|
||||
@@ -17,24 +17,27 @@ Pod::Spec.new do |s|
|
||||
# * Write the description between the DESC delimiters below.
|
||||
# * Finally, don't worry about the indent, CocoaPods strips it!
|
||||
|
||||
s.description = <<-DESC
|
||||
s.description = <<-DESC
|
||||
TODO: Add long description of the pod here.
|
||||
'This is a swipe-panel from application: https://www.apple.com/ios/maps/'
|
||||
DESC
|
||||
|
||||
s.homepage = 'https://github.com/mrustaa/ContainerController'
|
||||
# s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2'
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
s.author = { 'rustamburger@gmail.com' => 'rustamburger@gmail.com' }
|
||||
s.source = { :git => 'https://github.com/mrustaa/ContainerController.git', :tag => s.version.to_s }
|
||||
# s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'
|
||||
s.homepage = 'https://github.com/mrustaa/ContainerController'
|
||||
# s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2'
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
s.author = { 'mrustaa' => 'rustamburger@gmail.com' }
|
||||
s.source = { :git => 'https://github.com/mrustaa/ContainerController.git', :tag => s.version.to_s }
|
||||
# s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'
|
||||
s.swift_version = "5.0"
|
||||
|
||||
s.swift_version = '5.2.4'
|
||||
s.ios.deployment_target = '13.0'
|
||||
# s.ios.deployment_target = '13.0'
|
||||
s.platform = :ios, "13.0"
|
||||
|
||||
s.source_files = 'ContainerControllerSwift/*.{swift}'
|
||||
s.source_files = 'ContainerControllerSwift/**/*.{swift}'
|
||||
|
||||
s.source_files = '**/ContainerControllerSwift/**/*.{swift}'
|
||||
s.exclude_files = '**/ContainerControllerSwift/**/*.plist'
|
||||
|
||||
s.framework = "UIKit"
|
||||
# s.ios.framework = 'UIKit'
|
||||
# s.resource_bundles = {
|
||||
# 'ContainerControllerSwift' => ['ContainerControllerSwift/Assets/*.png']
|
||||
# }
|
||||
|
||||
Binary file not shown.
@@ -1,19 +0,0 @@
|
||||
//
|
||||
// ColletionAdapterCellData.swift
|
||||
// PatternsSwift
|
||||
//
|
||||
// Created by Рустам Мотыгуллин on 01/05/2020.
|
||||
// Copyright © 2020 mrusta. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class CollectionAdapterCellData: NSObject {
|
||||
|
||||
public var selectCallback: (() -> Void)?
|
||||
|
||||
open func size() -> CGSize {
|
||||
return CGSize.zero
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
//
|
||||
// CollectionAdapterTypes.swift
|
||||
// PatternsSwift
|
||||
//
|
||||
// Created by Рустам Мотыгуллин on 01/05/2020.
|
||||
// Copyright © 2020 mrusta. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
typealias CollectionAdapterCountCallback = () -> Int
|
||||
typealias CollectionAdapterCellIndexCallback = (_ index: Int) -> UICollectionViewCell
|
||||
typealias CollectionAdapterSizeIndexCallback = (_ index: Int) -> CGSize
|
||||
typealias CollectionAdapterSelectIndexCallback = (_ index: Int) -> ()
|
||||
@@ -1,27 +0,0 @@
|
||||
//
|
||||
// TableAdapterCellData.swift
|
||||
// PatternsSwift
|
||||
//
|
||||
// Created by Рустам Мотыгуллин on 17/04/2020.
|
||||
// Copyright © 2020 mrusta. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class TableAdapterCellData: NSObject {
|
||||
|
||||
// public let cellIdentifier: String
|
||||
//
|
||||
// public init(cellIdentifier: String? = UUID().uuidString) {
|
||||
// self.cellIdentifier = cellIdentifier ?? UUID().uuidString
|
||||
// }
|
||||
|
||||
open func cellHeight() -> CGFloat {
|
||||
return UITableView.automaticDimension
|
||||
}
|
||||
|
||||
open func canEditing() -> Bool {
|
||||
return false
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
//
|
||||
// ContainerTypes.swift
|
||||
// PatternsSwift
|
||||
//
|
||||
// Created by Рустам Мотыгуллин on 21/04/2020.
|
||||
// Copyright © 2020 mrusta. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
typealias TableAdapterCountCallback = () -> Int
|
||||
typealias TableAdapterCellIndexCallback = (_ index: Int) -> UITableViewCell
|
||||
typealias TableAdapterHeightIndexCallback = (_ index: Int) -> CGFloat
|
||||
typealias TableAdapterSelectIndexCallback = (_ index: Int) -> ()
|
||||
typealias TableAdapterDidScrollCallback = () -> ()
|
||||
typealias TableAdapterDeleteIndexCallback = (_ index: Int) -> ()
|
||||
@@ -1,598 +0,0 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 46;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
607FACD61AFB9204008FA782 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACD51AFB9204008FA782 /* AppDelegate.swift */; };
|
||||
607FACD81AFB9204008FA782 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACD71AFB9204008FA782 /* ViewController.swift */; };
|
||||
607FACDB1AFB9204008FA782 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 607FACD91AFB9204008FA782 /* Main.storyboard */; };
|
||||
607FACDD1AFB9204008FA782 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 607FACDC1AFB9204008FA782 /* Images.xcassets */; };
|
||||
607FACE01AFB9204008FA782 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 607FACDE1AFB9204008FA782 /* LaunchScreen.xib */; };
|
||||
607FACEC1AFB9204008FA782 /* Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACEB1AFB9204008FA782 /* Tests.swift */; };
|
||||
76B8DCAE51106B56EBBCCF22 /* Pods_ContainerControllerSwift_Tests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D8903A29B31F63B5A7A8607B /* Pods_ContainerControllerSwift_Tests.framework */; };
|
||||
968DB7E5EF2DD4AE15D171EB /* Pods_ContainerControllerSwift_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 121FB933CAE3EC5A2A00F4B2 /* Pods_ContainerControllerSwift_Example.framework */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
607FACE61AFB9204008FA782 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 607FACC81AFB9204008FA782 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 607FACCF1AFB9204008FA782;
|
||||
remoteInfo = ContainerControllerSwift;
|
||||
};
|
||||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
01C7EF19A8C89AA4D02D74D2 /* Pods-ContainerControllerSwift_Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ContainerControllerSwift_Tests.debug.xcconfig"; path = "Target Support Files/Pods-ContainerControllerSwift_Tests/Pods-ContainerControllerSwift_Tests.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
0AA8BF39B9F182FE833C0178 /* Pods-ContainerControllerSwift_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ContainerControllerSwift_Example.debug.xcconfig"; path = "Target Support Files/Pods-ContainerControllerSwift_Example/Pods-ContainerControllerSwift_Example.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
1034FE614CC8890CE063531F /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = "<group>"; };
|
||||
121FB933CAE3EC5A2A00F4B2 /* Pods_ContainerControllerSwift_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_ContainerControllerSwift_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
607FACD01AFB9204008FA782 /* ContainerControllerSwift_Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ContainerControllerSwift_Example.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
607FACD41AFB9204008FA782 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
607FACD51AFB9204008FA782 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||
607FACD71AFB9204008FA782 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
|
||||
607FACDA1AFB9204008FA782 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
|
||||
607FACDC1AFB9204008FA782 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
|
||||
607FACDF1AFB9204008FA782 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = "<group>"; };
|
||||
607FACE51AFB9204008FA782 /* ContainerControllerSwift_Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ContainerControllerSwift_Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
607FACEA1AFB9204008FA782 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
607FACEB1AFB9204008FA782 /* Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Tests.swift; sourceTree = "<group>"; };
|
||||
84550121AB9630F101ECE515 /* Pods-ContainerControllerSwift_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ContainerControllerSwift_Example.release.xcconfig"; path = "Target Support Files/Pods-ContainerControllerSwift_Example/Pods-ContainerControllerSwift_Example.release.xcconfig"; sourceTree = "<group>"; };
|
||||
95BE06AF27887E1C134436AD /* ContainerControllerSwift.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = ContainerControllerSwift.podspec; path = ../ContainerControllerSwift.podspec; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.ruby; };
|
||||
D8903A29B31F63B5A7A8607B /* Pods_ContainerControllerSwift_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_ContainerControllerSwift_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
DF5E269035BE15FBD5F947F3 /* Pods-ContainerControllerSwift_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ContainerControllerSwift_Tests.release.xcconfig"; path = "Target Support Files/Pods-ContainerControllerSwift_Tests/Pods-ContainerControllerSwift_Tests.release.xcconfig"; sourceTree = "<group>"; };
|
||||
E0FB46D7C5BC0F8759A83A60 /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
607FACCD1AFB9204008FA782 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
968DB7E5EF2DD4AE15D171EB /* Pods_ContainerControllerSwift_Example.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
607FACE21AFB9204008FA782 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
76B8DCAE51106B56EBBCCF22 /* Pods_ContainerControllerSwift_Tests.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
22F538CF8601A849D034CF8B /* Pods */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
0AA8BF39B9F182FE833C0178 /* Pods-ContainerControllerSwift_Example.debug.xcconfig */,
|
||||
84550121AB9630F101ECE515 /* Pods-ContainerControllerSwift_Example.release.xcconfig */,
|
||||
01C7EF19A8C89AA4D02D74D2 /* Pods-ContainerControllerSwift_Tests.debug.xcconfig */,
|
||||
DF5E269035BE15FBD5F947F3 /* Pods-ContainerControllerSwift_Tests.release.xcconfig */,
|
||||
);
|
||||
path = Pods;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
607FACC71AFB9204008FA782 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
607FACF51AFB993E008FA782 /* Podspec Metadata */,
|
||||
607FACD21AFB9204008FA782 /* Example for ContainerControllerSwift */,
|
||||
607FACE81AFB9204008FA782 /* Tests */,
|
||||
607FACD11AFB9204008FA782 /* Products */,
|
||||
22F538CF8601A849D034CF8B /* Pods */,
|
||||
AD5BB6CA5AB2437952B3E0A8 /* Frameworks */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
607FACD11AFB9204008FA782 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
607FACD01AFB9204008FA782 /* ContainerControllerSwift_Example.app */,
|
||||
607FACE51AFB9204008FA782 /* ContainerControllerSwift_Tests.xctest */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
607FACD21AFB9204008FA782 /* Example for ContainerControllerSwift */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
607FACD51AFB9204008FA782 /* AppDelegate.swift */,
|
||||
607FACD71AFB9204008FA782 /* ViewController.swift */,
|
||||
607FACD91AFB9204008FA782 /* Main.storyboard */,
|
||||
607FACDC1AFB9204008FA782 /* Images.xcassets */,
|
||||
607FACDE1AFB9204008FA782 /* LaunchScreen.xib */,
|
||||
607FACD31AFB9204008FA782 /* Supporting Files */,
|
||||
);
|
||||
name = "Example for ContainerControllerSwift";
|
||||
path = ContainerControllerSwift;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
607FACD31AFB9204008FA782 /* Supporting Files */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
607FACD41AFB9204008FA782 /* Info.plist */,
|
||||
);
|
||||
name = "Supporting Files";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
607FACE81AFB9204008FA782 /* Tests */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
607FACEB1AFB9204008FA782 /* Tests.swift */,
|
||||
607FACE91AFB9204008FA782 /* Supporting Files */,
|
||||
);
|
||||
path = Tests;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
607FACE91AFB9204008FA782 /* Supporting Files */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
607FACEA1AFB9204008FA782 /* Info.plist */,
|
||||
);
|
||||
name = "Supporting Files";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
607FACF51AFB993E008FA782 /* Podspec Metadata */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
95BE06AF27887E1C134436AD /* ContainerControllerSwift.podspec */,
|
||||
1034FE614CC8890CE063531F /* README.md */,
|
||||
E0FB46D7C5BC0F8759A83A60 /* LICENSE */,
|
||||
);
|
||||
name = "Podspec Metadata";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
AD5BB6CA5AB2437952B3E0A8 /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
121FB933CAE3EC5A2A00F4B2 /* Pods_ContainerControllerSwift_Example.framework */,
|
||||
D8903A29B31F63B5A7A8607B /* Pods_ContainerControllerSwift_Tests.framework */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
607FACCF1AFB9204008FA782 /* ContainerControllerSwift_Example */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 607FACEF1AFB9204008FA782 /* Build configuration list for PBXNativeTarget "ContainerControllerSwift_Example" */;
|
||||
buildPhases = (
|
||||
83D2AA92C153B73649CBCF16 /* [CP] Check Pods Manifest.lock */,
|
||||
607FACCC1AFB9204008FA782 /* Sources */,
|
||||
607FACCD1AFB9204008FA782 /* Frameworks */,
|
||||
607FACCE1AFB9204008FA782 /* Resources */,
|
||||
8E6E3C608EFDC3DE4C572F9E /* [CP] Embed Pods Frameworks */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = ContainerControllerSwift_Example;
|
||||
productName = ContainerControllerSwift;
|
||||
productReference = 607FACD01AFB9204008FA782 /* ContainerControllerSwift_Example.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
607FACE41AFB9204008FA782 /* ContainerControllerSwift_Tests */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 607FACF21AFB9204008FA782 /* Build configuration list for PBXNativeTarget "ContainerControllerSwift_Tests" */;
|
||||
buildPhases = (
|
||||
A0AFE6DE4C88627AC97D4DF0 /* [CP] Check Pods Manifest.lock */,
|
||||
607FACE11AFB9204008FA782 /* Sources */,
|
||||
607FACE21AFB9204008FA782 /* Frameworks */,
|
||||
607FACE31AFB9204008FA782 /* Resources */,
|
||||
E34E2A83D00021FED54D587A /* [CP] Embed Pods Frameworks */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
607FACE71AFB9204008FA782 /* PBXTargetDependency */,
|
||||
);
|
||||
name = ContainerControllerSwift_Tests;
|
||||
productName = Tests;
|
||||
productReference = 607FACE51AFB9204008FA782 /* ContainerControllerSwift_Tests.xctest */;
|
||||
productType = "com.apple.product-type.bundle.unit-test";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
607FACC81AFB9204008FA782 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastSwiftUpdateCheck = 0830;
|
||||
LastUpgradeCheck = 0830;
|
||||
ORGANIZATIONNAME = CocoaPods;
|
||||
TargetAttributes = {
|
||||
607FACCF1AFB9204008FA782 = {
|
||||
CreatedOnToolsVersion = 6.3.1;
|
||||
LastSwiftMigration = 0900;
|
||||
};
|
||||
607FACE41AFB9204008FA782 = {
|
||||
CreatedOnToolsVersion = 6.3.1;
|
||||
LastSwiftMigration = 0900;
|
||||
TestTargetID = 607FACCF1AFB9204008FA782;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 607FACCB1AFB9204008FA782 /* Build configuration list for PBXProject "ContainerControllerSwift" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
English,
|
||||
en,
|
||||
Base,
|
||||
);
|
||||
mainGroup = 607FACC71AFB9204008FA782;
|
||||
productRefGroup = 607FACD11AFB9204008FA782 /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
607FACCF1AFB9204008FA782 /* ContainerControllerSwift_Example */,
|
||||
607FACE41AFB9204008FA782 /* ContainerControllerSwift_Tests */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
607FACCE1AFB9204008FA782 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
607FACDB1AFB9204008FA782 /* Main.storyboard in Resources */,
|
||||
607FACE01AFB9204008FA782 /* LaunchScreen.xib in Resources */,
|
||||
607FACDD1AFB9204008FA782 /* Images.xcassets in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
607FACE31AFB9204008FA782 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
83D2AA92C153B73649CBCF16 /* [CP] Check Pods Manifest.lock */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputFileListPaths = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
|
||||
"${PODS_ROOT}/Manifest.lock",
|
||||
);
|
||||
name = "[CP] Check Pods Manifest.lock";
|
||||
outputFileListPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
"$(DERIVED_FILE_DIR)/Pods-ContainerControllerSwift_Example-checkManifestLockResult.txt",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
8E6E3C608EFDC3DE4C572F9E /* [CP] Embed Pods Frameworks */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${PODS_ROOT}/Target Support Files/Pods-ContainerControllerSwift_Example/Pods-ContainerControllerSwift_Example-frameworks.sh",
|
||||
"${BUILT_PRODUCTS_DIR}/ContainerControllerSwift/ContainerControllerSwift.framework",
|
||||
);
|
||||
name = "[CP] Embed Pods Frameworks";
|
||||
outputPaths = (
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ContainerControllerSwift.framework",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-ContainerControllerSwift_Example/Pods-ContainerControllerSwift_Example-frameworks.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
A0AFE6DE4C88627AC97D4DF0 /* [CP] Check Pods Manifest.lock */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputFileListPaths = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
|
||||
"${PODS_ROOT}/Manifest.lock",
|
||||
);
|
||||
name = "[CP] Check Pods Manifest.lock";
|
||||
outputFileListPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
"$(DERIVED_FILE_DIR)/Pods-ContainerControllerSwift_Tests-checkManifestLockResult.txt",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
E34E2A83D00021FED54D587A /* [CP] Embed Pods Frameworks */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${PODS_ROOT}/Target Support Files/Pods-ContainerControllerSwift_Tests/Pods-ContainerControllerSwift_Tests-frameworks.sh",
|
||||
"${BUILT_PRODUCTS_DIR}/FBSnapshotTestCase/FBSnapshotTestCase.framework",
|
||||
);
|
||||
name = "[CP] Embed Pods Frameworks";
|
||||
outputPaths = (
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FBSnapshotTestCase.framework",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-ContainerControllerSwift_Tests/Pods-ContainerControllerSwift_Tests-frameworks.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
607FACCC1AFB9204008FA782 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
607FACD81AFB9204008FA782 /* ViewController.swift in Sources */,
|
||||
607FACD61AFB9204008FA782 /* AppDelegate.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
607FACE11AFB9204008FA782 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
607FACEC1AFB9204008FA782 /* Tests.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXTargetDependency section */
|
||||
607FACE71AFB9204008FA782 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 607FACCF1AFB9204008FA782 /* ContainerControllerSwift_Example */;
|
||||
targetProxy = 607FACE61AFB9204008FA782 /* PBXContainerItemProxy */;
|
||||
};
|
||||
/* End PBXTargetDependency section */
|
||||
|
||||
/* Begin PBXVariantGroup section */
|
||||
607FACD91AFB9204008FA782 /* Main.storyboard */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
607FACDA1AFB9204008FA782 /* Base */,
|
||||
);
|
||||
name = Main.storyboard;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
607FACDE1AFB9204008FA782 /* LaunchScreen.xib */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
607FACDF1AFB9204008FA782 /* Base */,
|
||||
);
|
||||
name = LaunchScreen.xib;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXVariantGroup section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
607FACED1AFB9204008FA782 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
607FACEE1AFB9204008FA782 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
607FACF01AFB9204008FA782 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 0AA8BF39B9F182FE833C0178 /* Pods-ContainerControllerSwift_Example.debug.xcconfig */;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
INFOPLIST_FILE = ContainerControllerSwift/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
MODULE_NAME = ExampleApp;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
|
||||
SWIFT_VERSION = 4.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
607FACF11AFB9204008FA782 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 84550121AB9630F101ECE515 /* Pods-ContainerControllerSwift_Example.release.xcconfig */;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
INFOPLIST_FILE = ContainerControllerSwift/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
MODULE_NAME = ExampleApp;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
|
||||
SWIFT_VERSION = 4.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
607FACF31AFB9204008FA782 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 01C7EF19A8C89AA4D02D74D2 /* Pods-ContainerControllerSwift_Tests.debug.xcconfig */;
|
||||
buildSettings = {
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(PLATFORM_DIR)/Developer/Library/Frameworks",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
INFOPLIST_FILE = Tests/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
|
||||
SWIFT_VERSION = 4.0;
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ContainerControllerSwift_Example.app/ContainerControllerSwift_Example";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
607FACF41AFB9204008FA782 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = DF5E269035BE15FBD5F947F3 /* Pods-ContainerControllerSwift_Tests.release.xcconfig */;
|
||||
buildSettings = {
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(PLATFORM_DIR)/Developer/Library/Frameworks",
|
||||
"$(inherited)",
|
||||
);
|
||||
INFOPLIST_FILE = Tests/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
|
||||
SWIFT_VERSION = 4.0;
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ContainerControllerSwift_Example.app/ContainerControllerSwift_Example";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
607FACCB1AFB9204008FA782 /* Build configuration list for PBXProject "ContainerControllerSwift" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
607FACED1AFB9204008FA782 /* Debug */,
|
||||
607FACEE1AFB9204008FA782 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
607FACEF1AFB9204008FA782 /* Build configuration list for PBXNativeTarget "ContainerControllerSwift_Example" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
607FACF01AFB9204008FA782 /* Debug */,
|
||||
607FACF11AFB9204008FA782 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
607FACF21AFB9204008FA782 /* Build configuration list for PBXNativeTarget "ContainerControllerSwift_Tests" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
607FACF31AFB9204008FA782 /* Debug */,
|
||||
607FACF41AFB9204008FA782 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 607FACC81AFB9204008FA782 /* Project object */;
|
||||
}
|
||||
-117
@@ -1,117 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0900"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "607FACCF1AFB9204008FA782"
|
||||
BuildableName = "ContainerControllerSwift_Example.app"
|
||||
BlueprintName = "ContainerControllerSwift_Example"
|
||||
ReferencedContainer = "container:ContainerControllerSwift.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "NO"
|
||||
buildForArchiving = "NO"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "607FACE41AFB9204008FA782"
|
||||
BuildableName = "ContainerControllerSwift_Tests.xctest"
|
||||
BlueprintName = "ContainerControllerSwift_Tests"
|
||||
ReferencedContainer = "container:ContainerControllerSwift.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
<TestableReference
|
||||
skipped = "NO">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "607FACE41AFB9204008FA782"
|
||||
BuildableName = "ContainerControllerSwift_Tests.xctest"
|
||||
BlueprintName = "ContainerControllerSwift_Tests"
|
||||
ReferencedContainer = "container:ContainerControllerSwift.xcodeproj">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
</Testables>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "607FACCF1AFB9204008FA782"
|
||||
BuildableName = "ContainerControllerSwift_Example.app"
|
||||
BlueprintName = "ContainerControllerSwift_Example"
|
||||
ReferencedContainer = "container:ContainerControllerSwift.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "607FACCF1AFB9204008FA782"
|
||||
BuildableName = "ContainerControllerSwift_Example.app"
|
||||
BlueprintName = "ContainerControllerSwift_Example"
|
||||
ReferencedContainer = "container:ContainerControllerSwift.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "607FACCF1AFB9204008FA782"
|
||||
BuildableName = "ContainerControllerSwift_Example.app"
|
||||
BlueprintName = "ContainerControllerSwift_Example"
|
||||
ReferencedContainer = "container:ContainerControllerSwift.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
@@ -1,10 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "group:ContainerControllerSwift.xcodeproj">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:Pods/Pods.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IDEDidComputeMac32BitWarning</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -1,46 +0,0 @@
|
||||
//
|
||||
// AppDelegate.swift
|
||||
// ContainerControllerSwift
|
||||
//
|
||||
// Created by rustamburger@gmail.com on 06/09/2020.
|
||||
// Copyright (c) 2020 rustamburger@gmail.com. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
@UIApplicationMain
|
||||
class AppDelegate: UIResponder, UIApplicationDelegate {
|
||||
|
||||
var window: UIWindow?
|
||||
|
||||
|
||||
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
|
||||
// Override point for customization after application launch.
|
||||
return true
|
||||
}
|
||||
|
||||
func applicationWillResignActive(_ application: UIApplication) {
|
||||
// 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.
|
||||
// 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.
|
||||
}
|
||||
|
||||
func applicationDidEnterBackground(_ application: UIApplication) {
|
||||
// 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.
|
||||
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
|
||||
}
|
||||
|
||||
func applicationWillEnterForeground(_ application: UIApplication) {
|
||||
// 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.
|
||||
}
|
||||
|
||||
func applicationDidBecomeActive(_ application: UIApplication) {
|
||||
// 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.
|
||||
}
|
||||
|
||||
func applicationWillTerminate(_ application: UIApplication) {
|
||||
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13771" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES">
|
||||
<device id="retina4_7" orientation="portrait">
|
||||
<adaptation id="fullscreen"/>
|
||||
</device>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13772"/>
|
||||
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<view contentMode="scaleToFill" id="iN0-l3-epB">
|
||||
<rect key="frame" x="0.0" y="0.0" width="480" height="480"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" Copyright (c) 2015 CocoaPods. All rights reserved." textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="8ie-xW-0ye">
|
||||
<rect key="frame" x="20" y="439" width="441" height="21"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="ContainerControllerSwift" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="kId-c2-rCX">
|
||||
<rect key="frame" x="20" y="140" width="441" height="43"/>
|
||||
<fontDescription key="fontDescription" type="boldSystem" pointSize="36"/>
|
||||
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<constraint firstItem="kId-c2-rCX" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="bottom" multiplier="1/3" constant="1" id="5cJ-9S-tgC"/>
|
||||
<constraint firstAttribute="centerX" secondItem="kId-c2-rCX" secondAttribute="centerX" id="Koa-jz-hwk"/>
|
||||
<constraint firstAttribute="bottom" secondItem="8ie-xW-0ye" secondAttribute="bottom" constant="20" id="Kzo-t9-V3l"/>
|
||||
<constraint firstItem="8ie-xW-0ye" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="MfP-vx-nX0"/>
|
||||
<constraint firstAttribute="centerX" secondItem="8ie-xW-0ye" secondAttribute="centerX" id="ZEH-qu-HZ9"/>
|
||||
<constraint firstItem="kId-c2-rCX" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="fvb-Df-36g"/>
|
||||
</constraints>
|
||||
<nil key="simulatedStatusBarMetrics"/>
|
||||
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
|
||||
<point key="canvasLocation" x="548" y="455"/>
|
||||
</view>
|
||||
</objects>
|
||||
</document>
|
||||
@@ -1,30 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13771" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="vXZ-lx-hvc">
|
||||
<device id="retina4_7" orientation="portrait">
|
||||
<adaptation id="fullscreen"/>
|
||||
</device>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13772"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--View Controller-->
|
||||
<scene sceneID="ufC-wZ-h7g">
|
||||
<objects>
|
||||
<viewController id="vXZ-lx-hvc" customClass="ViewController" customModule="ContainerControllerSwift_Example" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<layoutGuides>
|
||||
<viewControllerLayoutGuide type="top" id="jyV-Pf-zRb"/>
|
||||
<viewControllerLayoutGuide type="bottom" id="2fi-mo-0CV"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="kh9-bI-dsS">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="x5A-6p-PRh" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
</scene>
|
||||
</scenes>
|
||||
</document>
|
||||
@@ -1,24 +0,0 @@
|
||||
//
|
||||
// ViewController.swift
|
||||
// ContainerControllerSwift
|
||||
//
|
||||
// Created by rustamburger@gmail.com on 06/09/2020.
|
||||
// Copyright (c) 2020 rustamburger@gmail.com. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class ViewController: UIViewController {
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
// Do any additional setup after loading the view, typically from a nib.
|
||||
}
|
||||
|
||||
override func didReceiveMemoryWarning() {
|
||||
super.didReceiveMemoryWarning()
|
||||
// Dispose of any resources that can be recreated.
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
use_frameworks!
|
||||
|
||||
target 'ContainerControllerSwift_Example' do
|
||||
pod 'ContainerControllerSwift', :path => '../'
|
||||
|
||||
target 'ContainerControllerSwift_Tests' do
|
||||
inherit! :search_paths
|
||||
|
||||
pod 'FBSnapshotTestCase' , '~> 2.1.4'
|
||||
end
|
||||
end
|
||||
@@ -1,27 +0,0 @@
|
||||
PODS:
|
||||
- ContainerControllerSwift (0.1.0)
|
||||
- FBSnapshotTestCase (2.1.4):
|
||||
- FBSnapshotTestCase/SwiftSupport (= 2.1.4)
|
||||
- FBSnapshotTestCase/Core (2.1.4)
|
||||
- FBSnapshotTestCase/SwiftSupport (2.1.4):
|
||||
- FBSnapshotTestCase/Core
|
||||
|
||||
DEPENDENCIES:
|
||||
- ContainerControllerSwift (from `../`)
|
||||
- FBSnapshotTestCase (~> 2.1.4)
|
||||
|
||||
SPEC REPOS:
|
||||
https://cdn.cocoapods.org/:
|
||||
- FBSnapshotTestCase
|
||||
|
||||
EXTERNAL SOURCES:
|
||||
ContainerControllerSwift:
|
||||
:path: "../"
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
ContainerControllerSwift: d9165e33edebeea0b8e0992717b0811328400d3c
|
||||
FBSnapshotTestCase: 094f9f314decbabe373b87cc339bea235a63e07a
|
||||
|
||||
PODFILE CHECKSUM: 748541873723babe6decea03fbfa834df5db1b55
|
||||
|
||||
COCOAPODS: 1.9.3
|
||||
Generated
-20
@@ -1,20 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
*/
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface UIApplication (StrictKeyWindow)
|
||||
|
||||
/**
|
||||
@return The receiver's @c keyWindow. Raises an assertion if @c nil.
|
||||
*/
|
||||
- (UIWindow *)fb_strictKeyWindow;
|
||||
|
||||
@end
|
||||
Generated
-27
@@ -1,27 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
*/
|
||||
|
||||
#import <FBSnapshotTestCase/UIApplication+StrictKeyWindow.h>
|
||||
|
||||
@implementation UIApplication (StrictKeyWindow)
|
||||
|
||||
- (UIWindow *)fb_strictKeyWindow
|
||||
{
|
||||
UIWindow *keyWindow = [UIApplication sharedApplication].keyWindow;
|
||||
if (!keyWindow) {
|
||||
[NSException raise:@"FBSnapshotTestCaseNilKeyWindowException"
|
||||
format:@"Snapshot tests must be hosted by an application with a key window. Please ensure your test"
|
||||
" host sets up a key window at launch (either via storyboards or programmatically) and doesn't"
|
||||
" do anything to remove it while snapshot tests are running."];
|
||||
}
|
||||
return keyWindow;
|
||||
}
|
||||
|
||||
@end
|
||||
-37
@@ -1,37 +0,0 @@
|
||||
//
|
||||
// Created by Gabriel Handford on 3/1/09.
|
||||
// Copyright 2009-2013. All rights reserved.
|
||||
// Created by John Boiles on 10/20/11.
|
||||
// Copyright (c) 2011. All rights reserved
|
||||
// Modified by Felix Schulze on 2/11/13.
|
||||
// Copyright 2013. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
// obtaining a copy of this software and associated documentation
|
||||
// files (the "Software"), to deal in the Software without
|
||||
// restriction, including without limitation the rights to use,
|
||||
// copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following
|
||||
// conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface UIImage (Compare)
|
||||
|
||||
- (BOOL)fb_compareWithImage:(UIImage *)image tolerance:(CGFloat)tolerance;
|
||||
|
||||
@end
|
||||
-134
@@ -1,134 +0,0 @@
|
||||
//
|
||||
// Created by Gabriel Handford on 3/1/09.
|
||||
// Copyright 2009-2013. All rights reserved.
|
||||
// Created by John Boiles on 10/20/11.
|
||||
// Copyright (c) 2011. All rights reserved
|
||||
// Modified by Felix Schulze on 2/11/13.
|
||||
// Copyright 2013. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
// obtaining a copy of this software and associated documentation
|
||||
// files (the "Software"), to deal in the Software without
|
||||
// restriction, including without limitation the rights to use,
|
||||
// copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following
|
||||
// conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
#import <FBSnapshotTestCase/UIImage+Compare.h>
|
||||
|
||||
// This makes debugging much more fun
|
||||
typedef union {
|
||||
uint32_t raw;
|
||||
unsigned char bytes[4];
|
||||
struct {
|
||||
char red;
|
||||
char green;
|
||||
char blue;
|
||||
char alpha;
|
||||
} __attribute__ ((packed)) pixels;
|
||||
} FBComparePixel;
|
||||
|
||||
@implementation UIImage (Compare)
|
||||
|
||||
- (BOOL)fb_compareWithImage:(UIImage *)image tolerance:(CGFloat)tolerance
|
||||
{
|
||||
NSAssert(CGSizeEqualToSize(self.size, image.size), @"Images must be same size.");
|
||||
|
||||
CGSize referenceImageSize = CGSizeMake(CGImageGetWidth(self.CGImage), CGImageGetHeight(self.CGImage));
|
||||
CGSize imageSize = CGSizeMake(CGImageGetWidth(image.CGImage), CGImageGetHeight(image.CGImage));
|
||||
|
||||
// The images have the equal size, so we could use the smallest amount of bytes because of byte padding
|
||||
size_t minBytesPerRow = MIN(CGImageGetBytesPerRow(self.CGImage), CGImageGetBytesPerRow(image.CGImage));
|
||||
size_t referenceImageSizeBytes = referenceImageSize.height * minBytesPerRow;
|
||||
void *referenceImagePixels = calloc(1, referenceImageSizeBytes);
|
||||
void *imagePixels = calloc(1, referenceImageSizeBytes);
|
||||
|
||||
if (!referenceImagePixels || !imagePixels) {
|
||||
free(referenceImagePixels);
|
||||
free(imagePixels);
|
||||
return NO;
|
||||
}
|
||||
|
||||
CGContextRef referenceImageContext = CGBitmapContextCreate(referenceImagePixels,
|
||||
referenceImageSize.width,
|
||||
referenceImageSize.height,
|
||||
CGImageGetBitsPerComponent(self.CGImage),
|
||||
minBytesPerRow,
|
||||
CGImageGetColorSpace(self.CGImage),
|
||||
(CGBitmapInfo)kCGImageAlphaPremultipliedLast
|
||||
);
|
||||
CGContextRef imageContext = CGBitmapContextCreate(imagePixels,
|
||||
imageSize.width,
|
||||
imageSize.height,
|
||||
CGImageGetBitsPerComponent(image.CGImage),
|
||||
minBytesPerRow,
|
||||
CGImageGetColorSpace(image.CGImage),
|
||||
(CGBitmapInfo)kCGImageAlphaPremultipliedLast
|
||||
);
|
||||
|
||||
if (!referenceImageContext || !imageContext) {
|
||||
CGContextRelease(referenceImageContext);
|
||||
CGContextRelease(imageContext);
|
||||
free(referenceImagePixels);
|
||||
free(imagePixels);
|
||||
return NO;
|
||||
}
|
||||
|
||||
CGContextDrawImage(referenceImageContext, CGRectMake(0, 0, referenceImageSize.width, referenceImageSize.height), self.CGImage);
|
||||
CGContextDrawImage(imageContext, CGRectMake(0, 0, imageSize.width, imageSize.height), image.CGImage);
|
||||
|
||||
CGContextRelease(referenceImageContext);
|
||||
CGContextRelease(imageContext);
|
||||
|
||||
BOOL imageEqual = YES;
|
||||
|
||||
// Do a fast compare if we can
|
||||
if (tolerance == 0) {
|
||||
imageEqual = (memcmp(referenceImagePixels, imagePixels, referenceImageSizeBytes) == 0);
|
||||
} else {
|
||||
// Go through each pixel in turn and see if it is different
|
||||
const NSInteger pixelCount = referenceImageSize.width * referenceImageSize.height;
|
||||
|
||||
FBComparePixel *p1 = referenceImagePixels;
|
||||
FBComparePixel *p2 = imagePixels;
|
||||
|
||||
NSInteger numDiffPixels = 0;
|
||||
for (int n = 0; n < pixelCount; ++n) {
|
||||
// If this pixel is different, increment the pixel diff count and see
|
||||
// if we have hit our limit.
|
||||
if (p1->raw != p2->raw) {
|
||||
numDiffPixels ++;
|
||||
|
||||
CGFloat percent = (CGFloat)numDiffPixels / pixelCount;
|
||||
if (percent > tolerance) {
|
||||
imageEqual = NO;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
p1++;
|
||||
p2++;
|
||||
}
|
||||
}
|
||||
|
||||
free(referenceImagePixels);
|
||||
free(imagePixels);
|
||||
|
||||
return imageEqual;
|
||||
}
|
||||
|
||||
@end
|
||||
-37
@@ -1,37 +0,0 @@
|
||||
//
|
||||
// Created by Gabriel Handford on 3/1/09.
|
||||
// Copyright 2009-2013. All rights reserved.
|
||||
// Created by John Boiles on 10/20/11.
|
||||
// Copyright (c) 2011. All rights reserved
|
||||
// Modified by Felix Schulze on 2/11/13.
|
||||
// Copyright 2013. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
// obtaining a copy of this software and associated documentation
|
||||
// files (the "Software"), to deal in the Software without
|
||||
// restriction, including without limitation the rights to use,
|
||||
// copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following
|
||||
// conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface UIImage (Diff)
|
||||
|
||||
- (UIImage *)fb_diffWithImage:(UIImage *)image;
|
||||
|
||||
@end
|
||||
-56
@@ -1,56 +0,0 @@
|
||||
//
|
||||
// Created by Gabriel Handford on 3/1/09.
|
||||
// Copyright 2009-2013. All rights reserved.
|
||||
// Created by John Boiles on 10/20/11.
|
||||
// Copyright (c) 2011. All rights reserved
|
||||
// Modified by Felix Schulze on 2/11/13.
|
||||
// Copyright 2013. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
// obtaining a copy of this software and associated documentation
|
||||
// files (the "Software"), to deal in the Software without
|
||||
// restriction, including without limitation the rights to use,
|
||||
// copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following
|
||||
// conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
#import <FBSnapshotTestCase/UIImage+Diff.h>
|
||||
|
||||
@implementation UIImage (Diff)
|
||||
|
||||
- (UIImage *)fb_diffWithImage:(UIImage *)image
|
||||
{
|
||||
if (!image) {
|
||||
return nil;
|
||||
}
|
||||
CGSize imageSize = CGSizeMake(MAX(self.size.width, image.size.width), MAX(self.size.height, image.size.height));
|
||||
UIGraphicsBeginImageContextWithOptions(imageSize, YES, 0);
|
||||
CGContextRef context = UIGraphicsGetCurrentContext();
|
||||
[self drawInRect:CGRectMake(0, 0, self.size.width, self.size.height)];
|
||||
CGContextSetAlpha(context, 0.5);
|
||||
CGContextBeginTransparencyLayer(context, NULL);
|
||||
[image drawInRect:CGRectMake(0, 0, image.size.width, image.size.height)];
|
||||
CGContextSetBlendMode(context, kCGBlendModeDifference);
|
||||
CGContextSetFillColorWithColor(context,[UIColor whiteColor].CGColor);
|
||||
CGContextFillRect(context, CGRectMake(0, 0, self.size.width, self.size.height));
|
||||
CGContextEndTransparencyLayer(context);
|
||||
UIImage *returnImage = UIGraphicsGetImageFromCurrentImageContext();
|
||||
UIGraphicsEndImageContext();
|
||||
return returnImage;
|
||||
}
|
||||
|
||||
@end
|
||||
-24
@@ -1,24 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
*/
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface UIImage (Snapshot)
|
||||
|
||||
/// Uses renderInContext: to get a snapshot of the layer.
|
||||
+ (UIImage *)fb_imageForLayer:(CALayer *)layer;
|
||||
|
||||
/// Uses renderInContext: to get a snapshot of the view layer.
|
||||
+ (UIImage *)fb_imageForViewLayer:(UIView *)view;
|
||||
|
||||
/// Uses drawViewHierarchyInRect: to get a snapshot of the view and adds the view into a window if needed.
|
||||
+ (UIImage *)fb_imageForView:(UIView *)view;
|
||||
|
||||
@end
|
||||
-73
@@ -1,73 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
*/
|
||||
|
||||
#import <FBSnapshotTestCase/UIImage+Snapshot.h>
|
||||
#import <FBSnapshotTestCase/UIApplication+StrictKeyWindow.h>
|
||||
|
||||
@implementation UIImage (Snapshot)
|
||||
|
||||
+ (UIImage *)fb_imageForLayer:(CALayer *)layer
|
||||
{
|
||||
CGRect bounds = layer.bounds;
|
||||
NSAssert1(CGRectGetWidth(bounds), @"Zero width for layer %@", layer);
|
||||
NSAssert1(CGRectGetHeight(bounds), @"Zero height for layer %@", layer);
|
||||
|
||||
UIGraphicsBeginImageContextWithOptions(bounds.size, NO, 0);
|
||||
CGContextRef context = UIGraphicsGetCurrentContext();
|
||||
NSAssert1(context, @"Could not generate context for layer %@", layer);
|
||||
CGContextSaveGState(context);
|
||||
[layer layoutIfNeeded];
|
||||
[layer renderInContext:context];
|
||||
CGContextRestoreGState(context);
|
||||
|
||||
UIImage *snapshot = UIGraphicsGetImageFromCurrentImageContext();
|
||||
UIGraphicsEndImageContext();
|
||||
return snapshot;
|
||||
}
|
||||
|
||||
+ (UIImage *)fb_imageForViewLayer:(UIView *)view
|
||||
{
|
||||
[view layoutIfNeeded];
|
||||
return [self fb_imageForLayer:view.layer];
|
||||
}
|
||||
|
||||
+ (UIImage *)fb_imageForView:(UIView *)view
|
||||
{
|
||||
CGRect bounds = view.bounds;
|
||||
NSAssert1(CGRectGetWidth(bounds), @"Zero width for view %@", view);
|
||||
NSAssert1(CGRectGetHeight(bounds), @"Zero height for view %@", view);
|
||||
|
||||
// If the input view is already a UIWindow, then just use that. Otherwise wrap in a window.
|
||||
UIWindow *window = [view isKindOfClass:[UIWindow class]] ? (UIWindow *)view : view.window;
|
||||
BOOL removeFromSuperview = NO;
|
||||
if (!window) {
|
||||
window = [[UIApplication sharedApplication] fb_strictKeyWindow];
|
||||
}
|
||||
|
||||
if (!view.window && view != window) {
|
||||
[window addSubview:view];
|
||||
removeFromSuperview = YES;
|
||||
}
|
||||
|
||||
UIGraphicsBeginImageContextWithOptions(bounds.size, NO, 0);
|
||||
[view layoutIfNeeded];
|
||||
[view drawViewHierarchyInRect:view.bounds afterScreenUpdates:YES];
|
||||
|
||||
UIImage *snapshot = UIGraphicsGetImageFromCurrentImageContext();
|
||||
UIGraphicsEndImageContext();
|
||||
|
||||
if (removeFromSuperview) {
|
||||
[view removeFromSuperview];
|
||||
}
|
||||
|
||||
return snapshot;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,180 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
*/
|
||||
|
||||
#import <FBSnapshotTestCase/FBSnapshotTestCasePlatform.h>
|
||||
#import <FBSnapshotTestCase/FBSnapshotTestController.h>
|
||||
|
||||
#import <QuartzCore/QuartzCore.h>
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import <XCTest/XCTest.h>
|
||||
|
||||
/*
|
||||
There are three ways of setting reference image directories.
|
||||
|
||||
1. Set the preprocessor macro FB_REFERENCE_IMAGE_DIR to a double quoted
|
||||
c-string with the path.
|
||||
2. Set an environment variable named FB_REFERENCE_IMAGE_DIR with the path. This
|
||||
takes precedence over the preprocessor macro to allow for run-time override.
|
||||
3. Keep everything unset, which will cause the reference images to be looked up
|
||||
inside the bundle holding the current test, in the
|
||||
Resources/ReferenceImages_* directories.
|
||||
*/
|
||||
#ifndef FB_REFERENCE_IMAGE_DIR
|
||||
#define FB_REFERENCE_IMAGE_DIR ""
|
||||
#endif
|
||||
|
||||
/**
|
||||
Similar to our much-loved XCTAssert() macros. Use this to perform your test. No need to write an explanation, though.
|
||||
@param view The view to snapshot
|
||||
@param identifier An optional identifier, used if there are multiple snapshot tests in a given -test method.
|
||||
@param suffixes An NSOrderedSet of strings for the different suffixes
|
||||
@param tolerance The percentage of pixels that can differ and still count as an 'identical' view
|
||||
*/
|
||||
#define FBSnapshotVerifyViewWithOptions(view__, identifier__, suffixes__, tolerance__) \
|
||||
FBSnapshotVerifyViewOrLayerWithOptions(View, view__, identifier__, suffixes__, tolerance__)
|
||||
|
||||
#define FBSnapshotVerifyView(view__, identifier__) \
|
||||
FBSnapshotVerifyViewWithOptions(view__, identifier__, FBSnapshotTestCaseDefaultSuffixes(), 0)
|
||||
|
||||
|
||||
/**
|
||||
Similar to our much-loved XCTAssert() macros. Use this to perform your test. No need to write an explanation, though.
|
||||
@param layer The layer to snapshot
|
||||
@param identifier An optional identifier, used if there are multiple snapshot tests in a given -test method.
|
||||
@param suffixes An NSOrderedSet of strings for the different suffixes
|
||||
@param tolerance The percentage of pixels that can differ and still count as an 'identical' layer
|
||||
*/
|
||||
#define FBSnapshotVerifyLayerWithOptions(layer__, identifier__, suffixes__, tolerance__) \
|
||||
FBSnapshotVerifyViewOrLayerWithOptions(Layer, layer__, identifier__, suffixes__, tolerance__)
|
||||
|
||||
#define FBSnapshotVerifyLayer(layer__, identifier__) \
|
||||
FBSnapshotVerifyLayerWithOptions(layer__, identifier__, FBSnapshotTestCaseDefaultSuffixes(), 0)
|
||||
|
||||
|
||||
#define FBSnapshotVerifyViewOrLayerWithOptions(what__, viewOrLayer__, identifier__, suffixes__, tolerance__) \
|
||||
{ \
|
||||
NSString *errorDescription = [self snapshotVerifyViewOrLayer:viewOrLayer__ identifier:identifier__ suffixes:suffixes__ tolerance:tolerance__]; \
|
||||
BOOL noErrors = (errorDescription == nil); \
|
||||
XCTAssertTrue(noErrors, @"%@", errorDescription); \
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
The base class of view snapshotting tests. If you have small UI component, it's often easier to configure it in a test
|
||||
and compare an image of the view to a reference image that write lots of complex layout-code tests.
|
||||
|
||||
In order to flip the tests in your subclass to record the reference images set @c recordMode to @c YES.
|
||||
|
||||
@attention When recording, the reference image directory should be explicitly
|
||||
set, otherwise the images may be written to somewhere inside the
|
||||
simulator directory.
|
||||
|
||||
For example:
|
||||
@code
|
||||
- (void)setUp
|
||||
{
|
||||
[super setUp];
|
||||
self.recordMode = YES;
|
||||
}
|
||||
@endcode
|
||||
*/
|
||||
@interface FBSnapshotTestCase : XCTestCase
|
||||
|
||||
/**
|
||||
When YES, the test macros will save reference images, rather than performing an actual test.
|
||||
*/
|
||||
@property (readwrite, nonatomic, assign) BOOL recordMode;
|
||||
|
||||
/**
|
||||
When @c YES appends the name of the device model and OS to the snapshot file name.
|
||||
The default value is @c NO.
|
||||
*/
|
||||
@property (readwrite, nonatomic, assign, getter=isDeviceAgnostic) BOOL deviceAgnostic;
|
||||
|
||||
/**
|
||||
When YES, renders a snapshot of the complete view hierarchy as visible onscreen.
|
||||
There are several things that do not work if renderInContext: is used.
|
||||
- UIVisualEffect #70
|
||||
- UIAppearance #91
|
||||
- Size Classes #92
|
||||
|
||||
@attention If the view does't belong to a UIWindow, it will create one and add the view as a subview.
|
||||
*/
|
||||
@property (readwrite, nonatomic, assign) BOOL usesDrawViewHierarchyInRect;
|
||||
|
||||
- (void)setUp NS_REQUIRES_SUPER;
|
||||
- (void)tearDown NS_REQUIRES_SUPER;
|
||||
|
||||
/**
|
||||
Performs the comparison or records a snapshot of the layer if recordMode is YES.
|
||||
@param viewOrLayer The UIView or CALayer to snapshot
|
||||
@param identifier An optional identifier, used if there are multiple snapshot tests in a given -test method.
|
||||
@param suffixes An NSOrderedSet of strings for the different suffixes
|
||||
@param tolerance The percentage difference to still count as identical - 0 mean pixel perfect, 1 means I don't care
|
||||
@returns nil if the comparison (or saving of the reference image) succeeded. Otherwise it contains an error description.
|
||||
*/
|
||||
- (NSString *)snapshotVerifyViewOrLayer:(id)viewOrLayer
|
||||
identifier:(NSString *)identifier
|
||||
suffixes:(NSOrderedSet *)suffixes
|
||||
tolerance:(CGFloat)tolerance;
|
||||
|
||||
/**
|
||||
Performs the comparison or records a snapshot of the layer if recordMode is YES.
|
||||
@param layer The Layer to snapshot
|
||||
@param referenceImagesDirectory The directory in which reference images are stored.
|
||||
@param identifier An optional identifier, used if there are multiple snapshot tests in a given -test method.
|
||||
@param tolerance The percentage difference to still count as identical - 0 mean pixel perfect, 1 means I don't care
|
||||
@param errorPtr An error to log in an XCTAssert() macro if the method fails (missing reference image, images differ, etc).
|
||||
@returns YES if the comparison (or saving of the reference image) succeeded.
|
||||
*/
|
||||
- (BOOL)compareSnapshotOfLayer:(CALayer *)layer
|
||||
referenceImagesDirectory:(NSString *)referenceImagesDirectory
|
||||
identifier:(NSString *)identifier
|
||||
tolerance:(CGFloat)tolerance
|
||||
error:(NSError **)errorPtr;
|
||||
|
||||
/**
|
||||
Performs the comparison or records a snapshot of the view if recordMode is YES.
|
||||
@param view The view to snapshot
|
||||
@param referenceImagesDirectory The directory in which reference images are stored.
|
||||
@param identifier An optional identifier, used if there are multiple snapshot tests in a given -test method.
|
||||
@param tolerance The percentage difference to still count as identical - 0 mean pixel perfect, 1 means I don't care
|
||||
@param errorPtr An error to log in an XCTAssert() macro if the method fails (missing reference image, images differ, etc).
|
||||
@returns YES if the comparison (or saving of the reference image) succeeded.
|
||||
*/
|
||||
- (BOOL)compareSnapshotOfView:(UIView *)view
|
||||
referenceImagesDirectory:(NSString *)referenceImagesDirectory
|
||||
identifier:(NSString *)identifier
|
||||
tolerance:(CGFloat)tolerance
|
||||
error:(NSError **)errorPtr;
|
||||
|
||||
/**
|
||||
Checks if reference image with identifier based name exists in the reference images directory.
|
||||
@param referenceImagesDirectory The directory in which reference images are stored.
|
||||
@param identifier An optional identifier, used if there are multiple snapshot tests in a given -test method.
|
||||
@param errorPtr An error to log in an XCTAssert() macro if the method fails (missing reference image, images differ, etc).
|
||||
@returns YES if reference image exists.
|
||||
*/
|
||||
- (BOOL)referenceImageRecordedInDirectory:(NSString *)referenceImagesDirectory
|
||||
identifier:(NSString *)identifier
|
||||
error:(NSError **)errorPtr;
|
||||
|
||||
/**
|
||||
Returns the reference image directory.
|
||||
|
||||
Helper function used to implement the assert macros.
|
||||
|
||||
@param dir directory to use if environment variable not specified. Ignored if null or empty.
|
||||
*/
|
||||
- (NSString *)getReferenceImageDirectoryWithDefault:(NSString *)dir;
|
||||
|
||||
@end
|
||||
@@ -1,192 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
*/
|
||||
|
||||
#import <FBSnapshotTestCase/FBSnapshotTestCase.h>
|
||||
#import <FBSnapshotTestCase/FBSnapshotTestController.h>
|
||||
|
||||
@implementation FBSnapshotTestCase
|
||||
{
|
||||
FBSnapshotTestController *_snapshotController;
|
||||
}
|
||||
|
||||
#pragma mark - Overrides
|
||||
|
||||
- (void)setUp
|
||||
{
|
||||
[super setUp];
|
||||
_snapshotController = [[FBSnapshotTestController alloc] initWithTestName:NSStringFromClass([self class])];
|
||||
}
|
||||
|
||||
- (void)tearDown
|
||||
{
|
||||
_snapshotController = nil;
|
||||
[super tearDown];
|
||||
}
|
||||
|
||||
- (BOOL)recordMode
|
||||
{
|
||||
return _snapshotController.recordMode;
|
||||
}
|
||||
|
||||
- (void)setRecordMode:(BOOL)recordMode
|
||||
{
|
||||
NSAssert1(_snapshotController, @"%s cannot be called before [super setUp]", __FUNCTION__);
|
||||
_snapshotController.recordMode = recordMode;
|
||||
}
|
||||
|
||||
- (BOOL)isDeviceAgnostic
|
||||
{
|
||||
return _snapshotController.deviceAgnostic;
|
||||
}
|
||||
|
||||
- (void)setDeviceAgnostic:(BOOL)deviceAgnostic
|
||||
{
|
||||
NSAssert1(_snapshotController, @"%s cannot be called before [super setUp]", __FUNCTION__);
|
||||
_snapshotController.deviceAgnostic = deviceAgnostic;
|
||||
}
|
||||
|
||||
- (BOOL)usesDrawViewHierarchyInRect
|
||||
{
|
||||
return _snapshotController.usesDrawViewHierarchyInRect;
|
||||
}
|
||||
|
||||
- (void)setUsesDrawViewHierarchyInRect:(BOOL)usesDrawViewHierarchyInRect
|
||||
{
|
||||
NSAssert1(_snapshotController, @"%s cannot be called before [super setUp]", __FUNCTION__);
|
||||
_snapshotController.usesDrawViewHierarchyInRect = usesDrawViewHierarchyInRect;
|
||||
}
|
||||
|
||||
#pragma mark - Public API
|
||||
|
||||
- (NSString *)snapshotVerifyViewOrLayer:(id)viewOrLayer
|
||||
identifier:(NSString *)identifier
|
||||
suffixes:(NSOrderedSet *)suffixes
|
||||
tolerance:(CGFloat)tolerance
|
||||
{
|
||||
if (nil == viewOrLayer) {
|
||||
return @"Object to be snapshotted must not be nil";
|
||||
}
|
||||
NSString *referenceImageDirectory = [self getReferenceImageDirectoryWithDefault:(@ FB_REFERENCE_IMAGE_DIR)];
|
||||
if (referenceImageDirectory == nil) {
|
||||
return @"Missing value for referenceImagesDirectory - Set FB_REFERENCE_IMAGE_DIR as Environment variable in your scheme.";
|
||||
}
|
||||
if (suffixes.count == 0) {
|
||||
return [NSString stringWithFormat:@"Suffixes set cannot be empty %@", suffixes];
|
||||
}
|
||||
|
||||
BOOL testSuccess = NO;
|
||||
NSError *error = nil;
|
||||
NSMutableArray *errors = [NSMutableArray array];
|
||||
|
||||
if (self.recordMode) {
|
||||
NSString *referenceImagesDirectory = [NSString stringWithFormat:@"%@%@", referenceImageDirectory, suffixes.firstObject];
|
||||
BOOL referenceImageSaved = [self _compareSnapshotOfViewOrLayer:viewOrLayer referenceImagesDirectory:referenceImagesDirectory identifier:(identifier) tolerance:tolerance error:&error];
|
||||
if (!referenceImageSaved) {
|
||||
[errors addObject:error];
|
||||
}
|
||||
} else {
|
||||
for (NSString *suffix in suffixes) {
|
||||
NSString *referenceImagesDirectory = [NSString stringWithFormat:@"%@%@", referenceImageDirectory, suffix];
|
||||
BOOL referenceImageAvailable = [self referenceImageRecordedInDirectory:referenceImagesDirectory identifier:(identifier) error:&error];
|
||||
|
||||
if (referenceImageAvailable) {
|
||||
BOOL comparisonSuccess = [self _compareSnapshotOfViewOrLayer:viewOrLayer referenceImagesDirectory:referenceImagesDirectory identifier:identifier tolerance:tolerance error:&error];
|
||||
[errors removeAllObjects];
|
||||
if (comparisonSuccess) {
|
||||
testSuccess = YES;
|
||||
break;
|
||||
} else {
|
||||
[errors addObject:error];
|
||||
}
|
||||
} else {
|
||||
[errors addObject:error];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!testSuccess) {
|
||||
return [NSString stringWithFormat:@"Snapshot comparison failed: %@", errors.firstObject];
|
||||
}
|
||||
if (self.recordMode) {
|
||||
return @"Test ran in record mode. Reference image is now saved. Disable record mode to perform an actual snapshot comparison!";
|
||||
}
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (BOOL)compareSnapshotOfLayer:(CALayer *)layer
|
||||
referenceImagesDirectory:(NSString *)referenceImagesDirectory
|
||||
identifier:(NSString *)identifier
|
||||
tolerance:(CGFloat)tolerance
|
||||
error:(NSError **)errorPtr
|
||||
{
|
||||
return [self _compareSnapshotOfViewOrLayer:layer
|
||||
referenceImagesDirectory:referenceImagesDirectory
|
||||
identifier:identifier
|
||||
tolerance:tolerance
|
||||
error:errorPtr];
|
||||
}
|
||||
|
||||
- (BOOL)compareSnapshotOfView:(UIView *)view
|
||||
referenceImagesDirectory:(NSString *)referenceImagesDirectory
|
||||
identifier:(NSString *)identifier
|
||||
tolerance:(CGFloat)tolerance
|
||||
error:(NSError **)errorPtr
|
||||
{
|
||||
return [self _compareSnapshotOfViewOrLayer:view
|
||||
referenceImagesDirectory:referenceImagesDirectory
|
||||
identifier:identifier
|
||||
tolerance:tolerance
|
||||
error:errorPtr];
|
||||
}
|
||||
|
||||
- (BOOL)referenceImageRecordedInDirectory:(NSString *)referenceImagesDirectory
|
||||
identifier:(NSString *)identifier
|
||||
error:(NSError **)errorPtr
|
||||
{
|
||||
NSAssert1(_snapshotController, @"%s cannot be called before [super setUp]", __FUNCTION__);
|
||||
_snapshotController.referenceImagesDirectory = referenceImagesDirectory;
|
||||
UIImage *referenceImage = [_snapshotController referenceImageForSelector:self.invocation.selector
|
||||
identifier:identifier
|
||||
error:errorPtr];
|
||||
|
||||
return (referenceImage != nil);
|
||||
}
|
||||
|
||||
- (NSString *)getReferenceImageDirectoryWithDefault:(NSString *)dir
|
||||
{
|
||||
NSString *envReferenceImageDirectory = [NSProcessInfo processInfo].environment[@"FB_REFERENCE_IMAGE_DIR"];
|
||||
if (envReferenceImageDirectory) {
|
||||
return envReferenceImageDirectory;
|
||||
}
|
||||
if (dir && dir.length > 0) {
|
||||
return dir;
|
||||
}
|
||||
return [[NSBundle bundleForClass:self.class].resourcePath stringByAppendingPathComponent:@"ReferenceImages"];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - Private API
|
||||
|
||||
- (BOOL)_compareSnapshotOfViewOrLayer:(id)viewOrLayer
|
||||
referenceImagesDirectory:(NSString *)referenceImagesDirectory
|
||||
identifier:(NSString *)identifier
|
||||
tolerance:(CGFloat)tolerance
|
||||
error:(NSError **)errorPtr
|
||||
{
|
||||
_snapshotController.referenceImagesDirectory = referenceImagesDirectory;
|
||||
return [_snapshotController compareSnapshotOfViewOrLayer:viewOrLayer
|
||||
selector:self.invocation.selector
|
||||
identifier:identifier
|
||||
tolerance:tolerance
|
||||
error:errorPtr];
|
||||
}
|
||||
|
||||
@end
|
||||
-44
@@ -1,44 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
Returns a Boolean value that indicates whether the snapshot test is running in 64Bit.
|
||||
This method is a convenience for creating the suffixes set based on the architecture
|
||||
that the test is running.
|
||||
|
||||
@returns @c YES if the test is running in 64bit, otherwise @c NO.
|
||||
*/
|
||||
BOOL FBSnapshotTestCaseIs64Bit(void);
|
||||
|
||||
/**
|
||||
Returns a default set of strings that is used to append a suffix based on the architectures.
|
||||
@warning Do not modify this function, you can create your own and use it with @c FBSnapshotVerifyViewWithOptions()
|
||||
|
||||
@returns An @c NSOrderedSet object containing strings that are appended to the reference images directory.
|
||||
*/
|
||||
NSOrderedSet *FBSnapshotTestCaseDefaultSuffixes(void);
|
||||
|
||||
/**
|
||||
Returns a fully «normalized» file name.
|
||||
Strips punctuation and spaces and replaces them with @c _. Also appends the device model, running OS and screen size to the file name.
|
||||
|
||||
@returns An @c NSString object containing the passed @c fileName with the device model, OS and screen size appended at the end.
|
||||
*/
|
||||
NSString *FBDeviceAgnosticNormalizedFileName(NSString *fileName);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
-51
@@ -1,51 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
*/
|
||||
|
||||
#import <FBSnapshotTestCase/FBSnapshotTestCasePlatform.h>
|
||||
#import <FBSnapshotTestCase/UIApplication+StrictKeyWindow.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
BOOL FBSnapshotTestCaseIs64Bit(void)
|
||||
{
|
||||
#if __LP64__
|
||||
return YES;
|
||||
#else
|
||||
return NO;
|
||||
#endif
|
||||
}
|
||||
|
||||
NSOrderedSet *FBSnapshotTestCaseDefaultSuffixes(void)
|
||||
{
|
||||
NSMutableOrderedSet *suffixesSet = [[NSMutableOrderedSet alloc] init];
|
||||
[suffixesSet addObject:@"_32"];
|
||||
[suffixesSet addObject:@"_64"];
|
||||
if (FBSnapshotTestCaseIs64Bit()) {
|
||||
return [suffixesSet reversedOrderedSet];
|
||||
}
|
||||
return [suffixesSet copy];
|
||||
}
|
||||
|
||||
NSString *FBDeviceAgnosticNormalizedFileName(NSString *fileName)
|
||||
{
|
||||
UIDevice *device = [UIDevice currentDevice];
|
||||
UIWindow *keyWindow = [[UIApplication sharedApplication] fb_strictKeyWindow];
|
||||
CGSize screenSize = keyWindow.bounds.size;
|
||||
NSString *os = device.systemVersion;
|
||||
|
||||
fileName = [NSString stringWithFormat:@"%@_%@%@_%.0fx%.0f", fileName, device.model, os, screenSize.width, screenSize.height];
|
||||
|
||||
NSMutableCharacterSet *invalidCharacters = [NSMutableCharacterSet new];
|
||||
[invalidCharacters formUnionWithCharacterSet:[NSCharacterSet whitespaceCharacterSet]];
|
||||
[invalidCharacters formUnionWithCharacterSet:[NSCharacterSet punctuationCharacterSet]];
|
||||
NSArray *validComponents = [fileName componentsSeparatedByCharactersInSet:invalidCharacters];
|
||||
fileName = [validComponents componentsJoinedByString:@"_"];
|
||||
|
||||
return fileName;
|
||||
}
|
||||
-166
@@ -1,166 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
typedef NS_ENUM(NSInteger, FBSnapshotTestControllerErrorCode) {
|
||||
FBSnapshotTestControllerErrorCodeUnknown,
|
||||
FBSnapshotTestControllerErrorCodeNeedsRecord,
|
||||
FBSnapshotTestControllerErrorCodePNGCreationFailed,
|
||||
FBSnapshotTestControllerErrorCodeImagesDifferentSizes,
|
||||
FBSnapshotTestControllerErrorCodeImagesDifferent,
|
||||
};
|
||||
/**
|
||||
Errors returned by the methods of FBSnapshotTestController use this domain.
|
||||
*/
|
||||
extern NSString *const FBSnapshotTestControllerErrorDomain;
|
||||
|
||||
/**
|
||||
Errors returned by the methods of FBSnapshotTestController sometimes contain this key in the `userInfo` dictionary.
|
||||
*/
|
||||
extern NSString *const FBReferenceImageFilePathKey;
|
||||
|
||||
/**
|
||||
Errors returned by the methods of FBSnapshotTestController sometimes contain this key in the `userInfo` dictionary.
|
||||
*/
|
||||
extern NSString *const FBReferenceImageKey;
|
||||
|
||||
/**
|
||||
Errors returned by the methods of FBSnapshotTestController sometimes contain this key in the `userInfo` dictionary.
|
||||
*/
|
||||
extern NSString *const FBCapturedImageKey;
|
||||
|
||||
/**
|
||||
Errors returned by the methods of FBSnapshotTestController sometimes contain this key in the `userInfo` dictionary.
|
||||
*/
|
||||
extern NSString *const FBDiffedImageKey;
|
||||
|
||||
/**
|
||||
Provides the heavy-lifting for FBSnapshotTestCase. It loads and saves images, along with performing the actual pixel-
|
||||
by-pixel comparison of images.
|
||||
Instances are initialized with the test class, and directories to read and write to.
|
||||
*/
|
||||
@interface FBSnapshotTestController : NSObject
|
||||
|
||||
/**
|
||||
Record snapshots.
|
||||
*/
|
||||
@property (readwrite, nonatomic, assign) BOOL recordMode;
|
||||
|
||||
/**
|
||||
When @c YES appends the name of the device model and OS to the snapshot file name.
|
||||
The default value is @c NO.
|
||||
*/
|
||||
@property (readwrite, nonatomic, assign, getter=isDeviceAgnostic) BOOL deviceAgnostic;
|
||||
|
||||
/**
|
||||
Uses drawViewHierarchyInRect:afterScreenUpdates: to draw the image instead of renderInContext:
|
||||
*/
|
||||
@property (readwrite, nonatomic, assign) BOOL usesDrawViewHierarchyInRect;
|
||||
|
||||
/**
|
||||
The directory in which referfence images are stored.
|
||||
*/
|
||||
@property (readwrite, nonatomic, copy) NSString *referenceImagesDirectory;
|
||||
|
||||
/**
|
||||
@param testClass The subclass of FBSnapshotTestCase that is using this controller.
|
||||
@returns An instance of FBSnapshotTestController.
|
||||
*/
|
||||
- (instancetype)initWithTestClass:(Class)testClass;
|
||||
|
||||
/**
|
||||
Designated initializer.
|
||||
@param testName The name of the tests.
|
||||
@returns An instance of FBSnapshotTestController.
|
||||
*/
|
||||
- (instancetype)initWithTestName:(NSString *)testName;
|
||||
|
||||
/**
|
||||
Performs the comparison of the layer.
|
||||
@param layer The Layer to snapshot.
|
||||
@param selector The test method being run.
|
||||
@param identifier An optional identifier, used is there are muliptle snapshot tests in a given -test method.
|
||||
@param error An error to log in an XCTAssert() macro if the method fails (missing reference image, images differ, etc).
|
||||
@returns YES if the comparison (or saving of the reference image) succeeded.
|
||||
*/
|
||||
- (BOOL)compareSnapshotOfLayer:(CALayer *)layer
|
||||
selector:(SEL)selector
|
||||
identifier:(NSString *)identifier
|
||||
error:(NSError **)errorPtr;
|
||||
|
||||
/**
|
||||
Performs the comparison of the view.
|
||||
@param view The view to snapshot.
|
||||
@param selector The test method being run.
|
||||
@param identifier An optional identifier, used is there are muliptle snapshot tests in a given -test method.
|
||||
@param error An error to log in an XCTAssert() macro if the method fails (missing reference image, images differ, etc).
|
||||
@returns YES if the comparison (or saving of the reference image) succeeded.
|
||||
*/
|
||||
- (BOOL)compareSnapshotOfView:(UIView *)view
|
||||
selector:(SEL)selector
|
||||
identifier:(NSString *)identifier
|
||||
error:(NSError **)errorPtr;
|
||||
|
||||
/**
|
||||
Performs the comparison of a view or layer.
|
||||
@param view The view or layer to snapshot.
|
||||
@param selector The test method being run.
|
||||
@param identifier An optional identifier, used is there are muliptle snapshot tests in a given -test method.
|
||||
@param tolerance The percentage of pixels that can differ and still be considered 'identical'
|
||||
@param error An error to log in an XCTAssert() macro if the method fails (missing reference image, images differ, etc).
|
||||
@returns YES if the comparison (or saving of the reference image) succeeded.
|
||||
*/
|
||||
- (BOOL)compareSnapshotOfViewOrLayer:(id)viewOrLayer
|
||||
selector:(SEL)selector
|
||||
identifier:(NSString *)identifier
|
||||
tolerance:(CGFloat)tolerance
|
||||
error:(NSError **)errorPtr;
|
||||
|
||||
/**
|
||||
Loads a reference image.
|
||||
@param selector The test method being run.
|
||||
@param identifier The optional identifier, used when multiple images are tested in a single -test method.
|
||||
@param errorPtr An error, if this methods returns nil, the error will be something useful.
|
||||
@returns An image.
|
||||
*/
|
||||
- (UIImage *)referenceImageForSelector:(SEL)selector
|
||||
identifier:(NSString *)identifier
|
||||
error:(NSError **)errorPtr;
|
||||
|
||||
/**
|
||||
Performs a pixel-by-pixel comparison of the two images with an allowable margin of error.
|
||||
@param referenceImage The reference (correct) image.
|
||||
@param image The image to test against the reference.
|
||||
@param tolerance The percentage of pixels that can differ and still be considered 'identical'
|
||||
@param errorPtr An error that indicates why the comparison failed if it does.
|
||||
@returns YES if the comparison succeeded and the images are the same(ish).
|
||||
*/
|
||||
- (BOOL)compareReferenceImage:(UIImage *)referenceImage
|
||||
toImage:(UIImage *)image
|
||||
tolerance:(CGFloat)tolerance
|
||||
error:(NSError **)errorPtr;
|
||||
|
||||
/**
|
||||
Saves the reference image and the test image to `failedOutputDirectory`.
|
||||
@param referenceImage The reference (correct) image.
|
||||
@param testImage The image to test against the reference.
|
||||
@param selector The test method being run.
|
||||
@param identifier The optional identifier, used when multiple images are tested in a single -test method.
|
||||
@param errorPtr An error that indicates why the comparison failed if it does.
|
||||
@returns YES if the save succeeded.
|
||||
*/
|
||||
- (BOOL)saveFailedReferenceImage:(UIImage *)referenceImage
|
||||
testImage:(UIImage *)testImage
|
||||
selector:(SEL)selector
|
||||
identifier:(NSString *)identifier
|
||||
error:(NSError **)errorPtr;
|
||||
@end
|
||||
-358
@@ -1,358 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
*/
|
||||
|
||||
#import <FBSnapshotTestCase/FBSnapshotTestController.h>
|
||||
#import <FBSnapshotTestCase/FBSnapshotTestCasePlatform.h>
|
||||
#import <FBSnapshotTestCase/UIImage+Compare.h>
|
||||
#import <FBSnapshotTestCase/UIImage+Diff.h>
|
||||
#import <FBSnapshotTestCase/UIImage+Snapshot.h>
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NSString *const FBSnapshotTestControllerErrorDomain = @"FBSnapshotTestControllerErrorDomain";
|
||||
NSString *const FBReferenceImageFilePathKey = @"FBReferenceImageFilePathKey";
|
||||
NSString *const FBReferenceImageKey = @"FBReferenceImageKey";
|
||||
NSString *const FBCapturedImageKey = @"FBCapturedImageKey";
|
||||
NSString *const FBDiffedImageKey = @"FBDiffedImageKey";
|
||||
|
||||
typedef NS_ENUM(NSUInteger, FBTestSnapshotFileNameType) {
|
||||
FBTestSnapshotFileNameTypeReference,
|
||||
FBTestSnapshotFileNameTypeFailedReference,
|
||||
FBTestSnapshotFileNameTypeFailedTest,
|
||||
FBTestSnapshotFileNameTypeFailedTestDiff,
|
||||
};
|
||||
|
||||
@implementation FBSnapshotTestController
|
||||
{
|
||||
NSString *_testName;
|
||||
NSFileManager *_fileManager;
|
||||
}
|
||||
|
||||
#pragma mark - Initializers
|
||||
|
||||
- (instancetype)initWithTestClass:(Class)testClass;
|
||||
{
|
||||
return [self initWithTestName:NSStringFromClass(testClass)];
|
||||
}
|
||||
|
||||
- (instancetype)initWithTestName:(NSString *)testName
|
||||
{
|
||||
if (self = [super init]) {
|
||||
_testName = [testName copy];
|
||||
_deviceAgnostic = NO;
|
||||
|
||||
_fileManager = [[NSFileManager alloc] init];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
#pragma mark - Overrides
|
||||
|
||||
- (NSString *)description
|
||||
{
|
||||
return [NSString stringWithFormat:@"%@ %@", [super description], _referenceImagesDirectory];
|
||||
}
|
||||
|
||||
#pragma mark - Public API
|
||||
|
||||
- (BOOL)compareSnapshotOfLayer:(CALayer *)layer
|
||||
selector:(SEL)selector
|
||||
identifier:(NSString *)identifier
|
||||
error:(NSError **)errorPtr
|
||||
{
|
||||
return [self compareSnapshotOfViewOrLayer:layer
|
||||
selector:selector
|
||||
identifier:identifier
|
||||
tolerance:0
|
||||
error:errorPtr];
|
||||
}
|
||||
|
||||
- (BOOL)compareSnapshotOfView:(UIView *)view
|
||||
selector:(SEL)selector
|
||||
identifier:(NSString *)identifier
|
||||
error:(NSError **)errorPtr
|
||||
{
|
||||
return [self compareSnapshotOfViewOrLayer:view
|
||||
selector:selector
|
||||
identifier:identifier
|
||||
tolerance:0
|
||||
error:errorPtr];
|
||||
}
|
||||
|
||||
- (BOOL)compareSnapshotOfViewOrLayer:(id)viewOrLayer
|
||||
selector:(SEL)selector
|
||||
identifier:(NSString *)identifier
|
||||
tolerance:(CGFloat)tolerance
|
||||
error:(NSError **)errorPtr
|
||||
{
|
||||
if (self.recordMode) {
|
||||
return [self _recordSnapshotOfViewOrLayer:viewOrLayer selector:selector identifier:identifier error:errorPtr];
|
||||
} else {
|
||||
return [self _performPixelComparisonWithViewOrLayer:viewOrLayer selector:selector identifier:identifier tolerance:tolerance error:errorPtr];
|
||||
}
|
||||
}
|
||||
|
||||
- (UIImage *)referenceImageForSelector:(SEL)selector
|
||||
identifier:(NSString *)identifier
|
||||
error:(NSError **)errorPtr
|
||||
{
|
||||
NSString *filePath = [self _referenceFilePathForSelector:selector identifier:identifier];
|
||||
UIImage *image = [UIImage imageWithContentsOfFile:filePath];
|
||||
if (nil == image && NULL != errorPtr) {
|
||||
BOOL exists = [_fileManager fileExistsAtPath:filePath];
|
||||
if (!exists) {
|
||||
*errorPtr = [NSError errorWithDomain:FBSnapshotTestControllerErrorDomain
|
||||
code:FBSnapshotTestControllerErrorCodeNeedsRecord
|
||||
userInfo:@{
|
||||
FBReferenceImageFilePathKey: filePath,
|
||||
NSLocalizedDescriptionKey: @"Unable to load reference image.",
|
||||
NSLocalizedFailureReasonErrorKey: @"Reference image not found. You need to run the test in record mode",
|
||||
}];
|
||||
} else {
|
||||
*errorPtr = [NSError errorWithDomain:FBSnapshotTestControllerErrorDomain
|
||||
code:FBSnapshotTestControllerErrorCodeUnknown
|
||||
userInfo:nil];
|
||||
}
|
||||
}
|
||||
return image;
|
||||
}
|
||||
|
||||
- (BOOL)compareReferenceImage:(UIImage *)referenceImage
|
||||
toImage:(UIImage *)image
|
||||
tolerance:(CGFloat)tolerance
|
||||
error:(NSError **)errorPtr
|
||||
{
|
||||
BOOL sameImageDimensions = CGSizeEqualToSize(referenceImage.size, image.size);
|
||||
if (sameImageDimensions && [referenceImage fb_compareWithImage:image tolerance:tolerance]) {
|
||||
return YES;
|
||||
}
|
||||
|
||||
if (NULL != errorPtr) {
|
||||
NSString *errorDescription = sameImageDimensions ? @"Images different" : @"Images different sizes";
|
||||
NSString *errorReason = sameImageDimensions ? [NSString stringWithFormat:@"image pixels differed by more than %.2f%% from the reference image", tolerance * 100]
|
||||
: [NSString stringWithFormat:@"referenceImage:%@, image:%@", NSStringFromCGSize(referenceImage.size), NSStringFromCGSize(image.size)];
|
||||
FBSnapshotTestControllerErrorCode errorCode = sameImageDimensions ? FBSnapshotTestControllerErrorCodeImagesDifferent : FBSnapshotTestControllerErrorCodeImagesDifferentSizes;
|
||||
|
||||
*errorPtr = [NSError errorWithDomain:FBSnapshotTestControllerErrorDomain
|
||||
code:errorCode
|
||||
userInfo:@{
|
||||
NSLocalizedDescriptionKey: errorDescription,
|
||||
NSLocalizedFailureReasonErrorKey: errorReason,
|
||||
FBReferenceImageKey: referenceImage,
|
||||
FBCapturedImageKey: image,
|
||||
FBDiffedImageKey: [referenceImage fb_diffWithImage:image],
|
||||
}];
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (BOOL)saveFailedReferenceImage:(UIImage *)referenceImage
|
||||
testImage:(UIImage *)testImage
|
||||
selector:(SEL)selector
|
||||
identifier:(NSString *)identifier
|
||||
error:(NSError **)errorPtr
|
||||
{
|
||||
NSData *referencePNGData = UIImagePNGRepresentation(referenceImage);
|
||||
NSData *testPNGData = UIImagePNGRepresentation(testImage);
|
||||
|
||||
NSString *referencePath = [self _failedFilePathForSelector:selector
|
||||
identifier:identifier
|
||||
fileNameType:FBTestSnapshotFileNameTypeFailedReference];
|
||||
|
||||
NSError *creationError = nil;
|
||||
BOOL didCreateDir = [_fileManager createDirectoryAtPath:[referencePath stringByDeletingLastPathComponent]
|
||||
withIntermediateDirectories:YES
|
||||
attributes:nil
|
||||
error:&creationError];
|
||||
if (!didCreateDir) {
|
||||
if (NULL != errorPtr) {
|
||||
*errorPtr = creationError;
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
if (![referencePNGData writeToFile:referencePath options:NSDataWritingAtomic error:errorPtr]) {
|
||||
return NO;
|
||||
}
|
||||
|
||||
NSString *testPath = [self _failedFilePathForSelector:selector
|
||||
identifier:identifier
|
||||
fileNameType:FBTestSnapshotFileNameTypeFailedTest];
|
||||
|
||||
if (![testPNGData writeToFile:testPath options:NSDataWritingAtomic error:errorPtr]) {
|
||||
return NO;
|
||||
}
|
||||
|
||||
NSString *diffPath = [self _failedFilePathForSelector:selector
|
||||
identifier:identifier
|
||||
fileNameType:FBTestSnapshotFileNameTypeFailedTestDiff];
|
||||
|
||||
UIImage *diffImage = [referenceImage fb_diffWithImage:testImage];
|
||||
NSData *diffImageData = UIImagePNGRepresentation(diffImage);
|
||||
|
||||
if (![diffImageData writeToFile:diffPath options:NSDataWritingAtomic error:errorPtr]) {
|
||||
return NO;
|
||||
}
|
||||
|
||||
NSLog(@"If you have Kaleidoscope installed you can run this command to see an image diff:\n"
|
||||
@"ksdiff \"%@\" \"%@\"", referencePath, testPath);
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
#pragma mark - Private API
|
||||
|
||||
- (NSString *)_fileNameForSelector:(SEL)selector
|
||||
identifier:(NSString *)identifier
|
||||
fileNameType:(FBTestSnapshotFileNameType)fileNameType
|
||||
{
|
||||
NSString *fileName = nil;
|
||||
switch (fileNameType) {
|
||||
case FBTestSnapshotFileNameTypeFailedReference:
|
||||
fileName = @"reference_";
|
||||
break;
|
||||
case FBTestSnapshotFileNameTypeFailedTest:
|
||||
fileName = @"failed_";
|
||||
break;
|
||||
case FBTestSnapshotFileNameTypeFailedTestDiff:
|
||||
fileName = @"diff_";
|
||||
break;
|
||||
default:
|
||||
fileName = @"";
|
||||
break;
|
||||
}
|
||||
fileName = [fileName stringByAppendingString:NSStringFromSelector(selector)];
|
||||
if (0 < identifier.length) {
|
||||
fileName = [fileName stringByAppendingFormat:@"_%@", identifier];
|
||||
}
|
||||
|
||||
if (self.isDeviceAgnostic) {
|
||||
fileName = FBDeviceAgnosticNormalizedFileName(fileName);
|
||||
}
|
||||
|
||||
if ([[UIScreen mainScreen] scale] > 1) {
|
||||
fileName = [fileName stringByAppendingFormat:@"@%.fx", [[UIScreen mainScreen] scale]];
|
||||
}
|
||||
fileName = [fileName stringByAppendingPathExtension:@"png"];
|
||||
return fileName;
|
||||
}
|
||||
|
||||
- (NSString *)_referenceFilePathForSelector:(SEL)selector
|
||||
identifier:(NSString *)identifier
|
||||
{
|
||||
NSString *fileName = [self _fileNameForSelector:selector
|
||||
identifier:identifier
|
||||
fileNameType:FBTestSnapshotFileNameTypeReference];
|
||||
NSString *filePath = [_referenceImagesDirectory stringByAppendingPathComponent:_testName];
|
||||
filePath = [filePath stringByAppendingPathComponent:fileName];
|
||||
return filePath;
|
||||
}
|
||||
|
||||
- (NSString *)_failedFilePathForSelector:(SEL)selector
|
||||
identifier:(NSString *)identifier
|
||||
fileNameType:(FBTestSnapshotFileNameType)fileNameType
|
||||
{
|
||||
NSString *fileName = [self _fileNameForSelector:selector
|
||||
identifier:identifier
|
||||
fileNameType:fileNameType];
|
||||
NSString *folderPath = NSTemporaryDirectory();
|
||||
if (getenv("IMAGE_DIFF_DIR")) {
|
||||
folderPath = @(getenv("IMAGE_DIFF_DIR"));
|
||||
}
|
||||
NSString *filePath = [folderPath stringByAppendingPathComponent:_testName];
|
||||
filePath = [filePath stringByAppendingPathComponent:fileName];
|
||||
return filePath;
|
||||
}
|
||||
|
||||
- (BOOL)_performPixelComparisonWithViewOrLayer:(id)viewOrLayer
|
||||
selector:(SEL)selector
|
||||
identifier:(NSString *)identifier
|
||||
tolerance:(CGFloat)tolerance
|
||||
error:(NSError **)errorPtr
|
||||
{
|
||||
UIImage *referenceImage = [self referenceImageForSelector:selector identifier:identifier error:errorPtr];
|
||||
if (nil != referenceImage) {
|
||||
UIImage *snapshot = [self _imageForViewOrLayer:viewOrLayer];
|
||||
BOOL imagesSame = [self compareReferenceImage:referenceImage toImage:snapshot tolerance:tolerance error:errorPtr];
|
||||
if (!imagesSame) {
|
||||
NSError *saveError = nil;
|
||||
if ([self saveFailedReferenceImage:referenceImage testImage:snapshot selector:selector identifier:identifier error:&saveError] == NO) {
|
||||
NSLog(@"Error saving test images: %@", saveError);
|
||||
}
|
||||
}
|
||||
return imagesSame;
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (BOOL)_recordSnapshotOfViewOrLayer:(id)viewOrLayer
|
||||
selector:(SEL)selector
|
||||
identifier:(NSString *)identifier
|
||||
error:(NSError **)errorPtr
|
||||
{
|
||||
UIImage *snapshot = [self _imageForViewOrLayer:viewOrLayer];
|
||||
return [self _saveReferenceImage:snapshot selector:selector identifier:identifier error:errorPtr];
|
||||
}
|
||||
|
||||
- (BOOL)_saveReferenceImage:(UIImage *)image
|
||||
selector:(SEL)selector
|
||||
identifier:(NSString *)identifier
|
||||
error:(NSError **)errorPtr
|
||||
{
|
||||
BOOL didWrite = NO;
|
||||
if (nil != image) {
|
||||
NSString *filePath = [self _referenceFilePathForSelector:selector identifier:identifier];
|
||||
NSData *pngData = UIImagePNGRepresentation(image);
|
||||
if (nil != pngData) {
|
||||
NSError *creationError = nil;
|
||||
BOOL didCreateDir = [_fileManager createDirectoryAtPath:[filePath stringByDeletingLastPathComponent]
|
||||
withIntermediateDirectories:YES
|
||||
attributes:nil
|
||||
error:&creationError];
|
||||
if (!didCreateDir) {
|
||||
if (NULL != errorPtr) {
|
||||
*errorPtr = creationError;
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
didWrite = [pngData writeToFile:filePath options:NSDataWritingAtomic error:errorPtr];
|
||||
if (didWrite) {
|
||||
NSLog(@"Reference image save at: %@", filePath);
|
||||
}
|
||||
} else {
|
||||
if (nil != errorPtr) {
|
||||
*errorPtr = [NSError errorWithDomain:FBSnapshotTestControllerErrorDomain
|
||||
code:FBSnapshotTestControllerErrorCodePNGCreationFailed
|
||||
userInfo:@{
|
||||
FBReferenceImageFilePathKey: filePath,
|
||||
}];
|
||||
}
|
||||
}
|
||||
}
|
||||
return didWrite;
|
||||
}
|
||||
|
||||
- (UIImage *)_imageForViewOrLayer:(id)viewOrLayer
|
||||
{
|
||||
if ([viewOrLayer isKindOfClass:[UIView class]]) {
|
||||
if (_usesDrawViewHierarchyInRect) {
|
||||
return [UIImage fb_imageForView:viewOrLayer];
|
||||
} else {
|
||||
return [UIImage fb_imageForViewLayer:viewOrLayer];
|
||||
}
|
||||
} else if ([viewOrLayer isKindOfClass:[CALayer class]]) {
|
||||
return [UIImage fb_imageForLayer:viewOrLayer];
|
||||
} else {
|
||||
[NSException raise:@"Only UIView and CALayer classes can be snapshotted" format:@"%@", viewOrLayer];
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,125 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
*/
|
||||
|
||||
#if swift(>=3)
|
||||
public extension FBSnapshotTestCase {
|
||||
public func FBSnapshotVerifyView(_ view: UIView, identifier: String = "", suffixes: NSOrderedSet = FBSnapshotTestCaseDefaultSuffixes(), tolerance: CGFloat = 0, file: StaticString = #file, line: UInt = #line) {
|
||||
FBSnapshotVerifyViewOrLayer(view, identifier: identifier, suffixes: suffixes, tolerance: tolerance, file: file, line: line)
|
||||
}
|
||||
|
||||
public func FBSnapshotVerifyLayer(_ layer: CALayer, identifier: String = "", suffixes: NSOrderedSet = FBSnapshotTestCaseDefaultSuffixes(), tolerance: CGFloat = 0, file: StaticString = #file, line: UInt = #line) {
|
||||
FBSnapshotVerifyViewOrLayer(layer, identifier: identifier, suffixes: suffixes, tolerance: tolerance, file: file, line: line)
|
||||
}
|
||||
|
||||
private func FBSnapshotVerifyViewOrLayer(_ viewOrLayer: AnyObject, identifier: String = "", suffixes: NSOrderedSet = FBSnapshotTestCaseDefaultSuffixes(), tolerance: CGFloat = 0, file: StaticString = #file, line: UInt = #line) {
|
||||
let envReferenceImageDirectory = self.getReferenceImageDirectory(withDefault: FB_REFERENCE_IMAGE_DIR)
|
||||
var error: NSError?
|
||||
var comparisonSuccess = false
|
||||
|
||||
if let envReferenceImageDirectory = envReferenceImageDirectory {
|
||||
for suffix in suffixes {
|
||||
let referenceImagesDirectory = "\(envReferenceImageDirectory)\(suffix)"
|
||||
if viewOrLayer.isKind(of: UIView.self) {
|
||||
do {
|
||||
try compareSnapshot(of: viewOrLayer as! UIView, referenceImagesDirectory: referenceImagesDirectory, identifier: identifier, tolerance: tolerance)
|
||||
comparisonSuccess = true
|
||||
} catch let error1 as NSError {
|
||||
error = error1
|
||||
comparisonSuccess = false
|
||||
}
|
||||
} else if viewOrLayer.isKind(of: CALayer.self) {
|
||||
do {
|
||||
try compareSnapshot(of: viewOrLayer as! CALayer, referenceImagesDirectory: referenceImagesDirectory, identifier: identifier, tolerance: tolerance)
|
||||
comparisonSuccess = true
|
||||
} catch let error1 as NSError {
|
||||
error = error1
|
||||
comparisonSuccess = false
|
||||
}
|
||||
} else {
|
||||
assertionFailure("Only UIView and CALayer classes can be snapshotted")
|
||||
}
|
||||
|
||||
assert(recordMode == false, message: "Test ran in record mode. Reference image is now saved. Disable record mode to perform an actual snapshot comparison!", file: file, line: line)
|
||||
|
||||
if comparisonSuccess || recordMode {
|
||||
break
|
||||
}
|
||||
|
||||
assert(comparisonSuccess, message: "Snapshot comparison failed: \(error)", file: file, line: line)
|
||||
}
|
||||
} else {
|
||||
XCTFail("Missing value for referenceImagesDirectory - Set FB_REFERENCE_IMAGE_DIR as Environment variable in your scheme.")
|
||||
}
|
||||
}
|
||||
|
||||
func assert(_ assertion: Bool, message: String, file: StaticString, line: UInt) {
|
||||
if !assertion {
|
||||
XCTFail(message, file: file, line: line)
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
public extension FBSnapshotTestCase {
|
||||
public func FBSnapshotVerifyView(view: UIView, identifier: String = "", suffixes: NSOrderedSet = FBSnapshotTestCaseDefaultSuffixes(), tolerance: CGFloat = 0, file: StaticString = #file, line: UInt = #line) {
|
||||
FBSnapshotVerifyViewOrLayer(view, identifier: identifier, suffixes: suffixes, tolerance: tolerance, file: file, line: line)
|
||||
}
|
||||
|
||||
public func FBSnapshotVerifyLayer(layer: CALayer, identifier: String = "", suffixes: NSOrderedSet = FBSnapshotTestCaseDefaultSuffixes(), tolerance: CGFloat = 0, file: StaticString = #file, line: UInt = #line) {
|
||||
FBSnapshotVerifyViewOrLayer(layer, identifier: identifier, suffixes: suffixes, tolerance: tolerance, file: file, line: line)
|
||||
}
|
||||
|
||||
private func FBSnapshotVerifyViewOrLayer(viewOrLayer: AnyObject, identifier: String = "", suffixes: NSOrderedSet = FBSnapshotTestCaseDefaultSuffixes(), tolerance: CGFloat = 0, file: StaticString = #file, line: UInt = #line) {
|
||||
let envReferenceImageDirectory = self.getReferenceImageDirectoryWithDefault(FB_REFERENCE_IMAGE_DIR)
|
||||
var error: NSError?
|
||||
var comparisonSuccess = false
|
||||
|
||||
if let envReferenceImageDirectory = envReferenceImageDirectory {
|
||||
for suffix in suffixes {
|
||||
let referenceImagesDirectory = "\(envReferenceImageDirectory)\(suffix)"
|
||||
if viewOrLayer.isKindOfClass(UIView) {
|
||||
do {
|
||||
try compareSnapshotOfView(viewOrLayer as! UIView, referenceImagesDirectory: referenceImagesDirectory, identifier: identifier, tolerance: tolerance)
|
||||
comparisonSuccess = true
|
||||
} catch let error1 as NSError {
|
||||
error = error1
|
||||
comparisonSuccess = false
|
||||
}
|
||||
} else if viewOrLayer.isKindOfClass(CALayer) {
|
||||
do {
|
||||
try compareSnapshotOfLayer(viewOrLayer as! CALayer, referenceImagesDirectory: referenceImagesDirectory, identifier: identifier, tolerance: tolerance)
|
||||
comparisonSuccess = true
|
||||
} catch let error1 as NSError {
|
||||
error = error1
|
||||
comparisonSuccess = false
|
||||
}
|
||||
} else {
|
||||
assertionFailure("Only UIView and CALayer classes can be snapshotted")
|
||||
}
|
||||
|
||||
assert(recordMode == false, message: "Test ran in record mode. Reference image is now saved. Disable record mode to perform an actual snapshot comparison!", file: file, line: line)
|
||||
|
||||
if comparisonSuccess || recordMode {
|
||||
break
|
||||
}
|
||||
|
||||
assert(comparisonSuccess, message: "Snapshot comparison failed: \(error)", file: file, line: line)
|
||||
}
|
||||
} else {
|
||||
XCTFail("Missing value for referenceImagesDirectory - Set FB_REFERENCE_IMAGE_DIR as Environment variable in your scheme.")
|
||||
}
|
||||
}
|
||||
|
||||
func assert(assertion: Bool, message: String, file: StaticString, line: UInt) {
|
||||
if !assertion {
|
||||
XCTFail(message, file: file, line: line)
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
Generated
-29
@@ -1,29 +0,0 @@
|
||||
BSD License
|
||||
|
||||
For the FBSnapshotTestCase software
|
||||
|
||||
Copyright (c) 2013, Facebook, Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name Facebook nor the names of its contributors may be used to
|
||||
endorse or promote products derived from this software without specific
|
||||
prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
-97
@@ -1,97 +0,0 @@
|
||||
FBSnapshotTestCase
|
||||
======================
|
||||
|
||||
[](https://travis-ci.org/facebook/ios-snapshot-test-case) [](http://cocoadocs.org/docsets/FBSnapshotTestCase/)
|
||||
|
||||
What it does
|
||||
------------
|
||||
|
||||
A "snapshot test case" takes a configured `UIView` or `CALayer` and uses the
|
||||
`renderInContext:` method to get an image snapshot of its contents. It
|
||||
compares this snapshot to a "reference image" stored in your source code
|
||||
repository and fails the test if the two images don't match.
|
||||
|
||||
Why?
|
||||
----
|
||||
|
||||
At Facebook we write a lot of UI code. As you might imagine, each type of
|
||||
feed story is rendered using a subclass of `UIView`. There are a lot of edge
|
||||
cases that we want to handle correctly:
|
||||
|
||||
- What if there is more text than can fit in the space available?
|
||||
- What if an image doesn't match the size of an image view?
|
||||
- What should the highlighted state look like?
|
||||
|
||||
It's straightforward to test logic code, but less obvious how you should test
|
||||
views. You can do a lot of rectangle asserts, but these are hard to understand
|
||||
or visualize. Looking at an image diff shows you exactly what changed and how
|
||||
it will look to users.
|
||||
|
||||
We developed `FBSnapshotTestCase` to make snapshot tests easy.
|
||||
|
||||
Installation with CocoaPods
|
||||
---------------------------
|
||||
|
||||
1. Add the following lines to your Podfile:
|
||||
|
||||
```
|
||||
target "Tests" do
|
||||
pod 'FBSnapshotTestCase'
|
||||
end
|
||||
```
|
||||
|
||||
If you support iOS 7 use `FBSnapshotTestCase/Core` instead, which doesn't contain Swift support.
|
||||
|
||||
Replace "Tests" with the name of your test project.
|
||||
|
||||
2. There are [three ways](https://github.com/facebook/ios-snapshot-test-case/blob/master/FBSnapshotTestCase/FBSnapshotTestCase.h#L19-L29) of setting reference image directories, the recommended one is to define `FB_REFERENCE_IMAGE_DIR` in your scheme. This should point to the directory where you want reference images to be stored. At Facebook, we normally use this:
|
||||
|
||||
|Name|Value|
|
||||
|:---|:----|
|
||||
|`FB_REFERENCE_IMAGE_DIR`|`$(SOURCE_ROOT)/$(PROJECT_NAME)Tests/ReferenceImages`|
|
||||
|
||||
|
||||

|
||||
|
||||
Creating a snapshot test
|
||||
------------------------
|
||||
|
||||
1. Subclass `FBSnapshotTestCase` instead of `XCTestCase`.
|
||||
2. From within your test, use `FBSnapshotVerifyView`.
|
||||
3. Run the test once with `self.recordMode = YES;` in the test's `-setUp`
|
||||
method. (This creates the reference images on disk.)
|
||||
4. Remove the line enabling record mode and run the test.
|
||||
|
||||
Features
|
||||
--------
|
||||
|
||||
- Automatically names reference images on disk according to test class and
|
||||
selector.
|
||||
- Prints a descriptive error message to the console on failure. (Bonus:
|
||||
failure message includes a one-line command to see an image diff if
|
||||
you have [Kaleidoscope](http://www.kaleidoscopeapp.com) installed.)
|
||||
- Supply an optional "identifier" if you want to perform multiple snapshots
|
||||
in a single test method.
|
||||
- Support for `CALayer` via `FBSnapshotVerifyLayer`.
|
||||
- `usesDrawViewHierarchyInRect` to handle cases like `UIVisualEffect`, `UIAppearance` and Size Classes.
|
||||
- `isDeviceAgnostic` to allow appending the device model (`iPhone`, `iPad`, `iPod Touch`, etc), OS version and screen size to the images (allowing to have multiple tests for the same «snapshot» for different `OS`s and devices).
|
||||
|
||||
Notes
|
||||
-----
|
||||
|
||||
Your unit test must be an "application test", not a "logic test." (That is, it
|
||||
must be run within the Simulator so that it has access to UIKit.) In Xcode 5
|
||||
and later new projects only offer application tests, but older projects will
|
||||
have separate targets for the two types.
|
||||
|
||||
Authors
|
||||
-------
|
||||
|
||||
`FBSnapshotTestCase` was written at Facebook by
|
||||
[Jonathan Dann](https://facebook.com/j.p.dann) with significant contributions by
|
||||
[Todd Krabach](https://facebook.com/toddkrabach).
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
`FBSnapshotTestCase` is BSD-licensed. See `LICENSE`.
|
||||
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"name": "ContainerControllerSwift",
|
||||
"version": "0.1.0",
|
||||
"summary": "A short description of ContainerControllerSwift.",
|
||||
"description": "TODO: Add long description of the pod here.",
|
||||
"homepage": "https://github.com/rustamburger@gmail.com/ContainerControllerSwift",
|
||||
"license": {
|
||||
"type": "MIT",
|
||||
"file": "LICENSE"
|
||||
},
|
||||
"authors": {
|
||||
"rustamburger@gmail.com": "rustamburger@gmail.com"
|
||||
},
|
||||
"source": {
|
||||
"git": "https://github.com/rustamburger@gmail.com/ContainerControllerSwift.git",
|
||||
"tag": "0.1.0"
|
||||
},
|
||||
"platforms": {
|
||||
"ios": "8.0"
|
||||
},
|
||||
"source_files": "ContainerControllerSwift/Classes/**/*"
|
||||
}
|
||||
Generated
-27
@@ -1,27 +0,0 @@
|
||||
PODS:
|
||||
- ContainerControllerSwift (0.1.0)
|
||||
- FBSnapshotTestCase (2.1.4):
|
||||
- FBSnapshotTestCase/SwiftSupport (= 2.1.4)
|
||||
- FBSnapshotTestCase/Core (2.1.4)
|
||||
- FBSnapshotTestCase/SwiftSupport (2.1.4):
|
||||
- FBSnapshotTestCase/Core
|
||||
|
||||
DEPENDENCIES:
|
||||
- ContainerControllerSwift (from `../`)
|
||||
- FBSnapshotTestCase (~> 2.1.4)
|
||||
|
||||
SPEC REPOS:
|
||||
https://cdn.cocoapods.org/:
|
||||
- FBSnapshotTestCase
|
||||
|
||||
EXTERNAL SOURCES:
|
||||
ContainerControllerSwift:
|
||||
:path: "../"
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
ContainerControllerSwift: d9165e33edebeea0b8e0992717b0811328400d3c
|
||||
FBSnapshotTestCase: 094f9f314decbabe373b87cc339bea235a63e07a
|
||||
|
||||
PODFILE CHECKSUM: 748541873723babe6decea03fbfa834df5db1b55
|
||||
|
||||
COCOAPODS: 1.9.3
|
||||
-1119
File diff suppressed because it is too large
Load Diff
Generated
-26
@@ -1,26 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>${PRODUCT_BUNDLE_IDENTIFIER}</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>${PRODUCT_NAME}</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>${CURRENT_PROJECT_VERSION}</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string></string>
|
||||
</dict>
|
||||
</plist>
|
||||
Generated
-5
@@ -1,5 +0,0 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
@interface PodsDummy_ContainerControllerSwift : NSObject
|
||||
@end
|
||||
@implementation PodsDummy_ContainerControllerSwift
|
||||
@end
|
||||
Generated
-12
@@ -1,12 +0,0 @@
|
||||
#ifdef __OBJC__
|
||||
#import <UIKit/UIKit.h>
|
||||
#else
|
||||
#ifndef FOUNDATION_EXPORT
|
||||
#if defined(__cplusplus)
|
||||
#define FOUNDATION_EXPORT extern "C"
|
||||
#else
|
||||
#define FOUNDATION_EXPORT extern
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Generated
-16
@@ -1,16 +0,0 @@
|
||||
#ifdef __OBJC__
|
||||
#import <UIKit/UIKit.h>
|
||||
#else
|
||||
#ifndef FOUNDATION_EXPORT
|
||||
#if defined(__cplusplus)
|
||||
#define FOUNDATION_EXPORT extern "C"
|
||||
#else
|
||||
#define FOUNDATION_EXPORT extern
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
FOUNDATION_EXPORT double ContainerControllerSwiftVersionNumber;
|
||||
FOUNDATION_EXPORT const unsigned char ContainerControllerSwiftVersionString[];
|
||||
|
||||
Generated
-10
@@ -1,10 +0,0 @@
|
||||
CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/ContainerControllerSwift
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||
OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
|
||||
PODS_BUILD_DIR = ${BUILD_DIR}
|
||||
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||
PODS_ROOT = ${SRCROOT}
|
||||
PODS_TARGET_SRCROOT = ${PODS_ROOT}/../..
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
|
||||
SKIP_INSTALL = YES
|
||||
USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES
|
||||
Generated
-6
@@ -1,6 +0,0 @@
|
||||
framework module ContainerControllerSwift {
|
||||
umbrella header "ContainerControllerSwift-umbrella.h"
|
||||
|
||||
export *
|
||||
module * { export * }
|
||||
}
|
||||
Example/Pods/Target Support Files/ContainerControllerSwift/ContainerControllerSwift.release.xcconfig
Generated
-10
@@ -1,10 +0,0 @@
|
||||
CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/ContainerControllerSwift
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||
OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
|
||||
PODS_BUILD_DIR = ${BUILD_DIR}
|
||||
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||
PODS_ROOT = ${SRCROOT}
|
||||
PODS_TARGET_SRCROOT = ${PODS_ROOT}/../..
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
|
||||
SKIP_INSTALL = YES
|
||||
USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES
|
||||
-26
@@ -1,26 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>${PRODUCT_BUNDLE_IDENTIFIER}</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>${PRODUCT_NAME}</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>2.1.4</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>${CURRENT_PROJECT_VERSION}</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string></string>
|
||||
</dict>
|
||||
</plist>
|
||||
-5
@@ -1,5 +0,0 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
@interface PodsDummy_FBSnapshotTestCase : NSObject
|
||||
@end
|
||||
@implementation PodsDummy_FBSnapshotTestCase
|
||||
@end
|
||||
-12
@@ -1,12 +0,0 @@
|
||||
#ifdef __OBJC__
|
||||
#import <UIKit/UIKit.h>
|
||||
#else
|
||||
#ifndef FOUNDATION_EXPORT
|
||||
#if defined(__cplusplus)
|
||||
#define FOUNDATION_EXPORT extern "C"
|
||||
#else
|
||||
#define FOUNDATION_EXPORT extern
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
-19
@@ -1,19 +0,0 @@
|
||||
#ifdef __OBJC__
|
||||
#import <UIKit/UIKit.h>
|
||||
#else
|
||||
#ifndef FOUNDATION_EXPORT
|
||||
#if defined(__cplusplus)
|
||||
#define FOUNDATION_EXPORT extern "C"
|
||||
#else
|
||||
#define FOUNDATION_EXPORT extern
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#import "FBSnapshotTestCase.h"
|
||||
#import "FBSnapshotTestCasePlatform.h"
|
||||
#import "FBSnapshotTestController.h"
|
||||
|
||||
FOUNDATION_EXPORT double FBSnapshotTestCaseVersionNumber;
|
||||
FOUNDATION_EXPORT const unsigned char FBSnapshotTestCaseVersionString[];
|
||||
|
||||
-16
@@ -1,16 +0,0 @@
|
||||
CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/FBSnapshotTestCase
|
||||
ENABLE_BITCODE = NO
|
||||
FRAMEWORK_SEARCH_PATHS = $(inherited) "$(PLATFORM_DIR)/Developer/Library/Frameworks"
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||
LIBRARY_SEARCH_PATHS = $(inherited) "$(PLATFORM_DIR)/Developer/usr/lib"
|
||||
OTHER_LDFLAGS = $(inherited) -framework "Foundation" -framework "QuartzCore" -framework "UIKit" -framework "XCTest"
|
||||
OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
|
||||
PODS_BUILD_DIR = ${BUILD_DIR}
|
||||
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||
PODS_ROOT = ${SRCROOT}
|
||||
PODS_TARGET_SRCROOT = ${PODS_ROOT}/FBSnapshotTestCase
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
|
||||
SKIP_INSTALL = YES
|
||||
SWIFT_INCLUDE_PATHS = $(inherited) "$(PLATFORM_DIR)/Developer/usr/lib"
|
||||
SYSTEM_FRAMEWORK_SEARCH_PATHS = $(inherited) "$(PLATFORM_DIR)/Developer/Library/Frameworks"
|
||||
USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES
|
||||
-6
@@ -1,6 +0,0 @@
|
||||
framework module FBSnapshotTestCase {
|
||||
umbrella header "FBSnapshotTestCase-umbrella.h"
|
||||
|
||||
export *
|
||||
module * { export * }
|
||||
}
|
||||
-16
@@ -1,16 +0,0 @@
|
||||
CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/FBSnapshotTestCase
|
||||
ENABLE_BITCODE = NO
|
||||
FRAMEWORK_SEARCH_PATHS = $(inherited) "$(PLATFORM_DIR)/Developer/Library/Frameworks"
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||
LIBRARY_SEARCH_PATHS = $(inherited) "$(PLATFORM_DIR)/Developer/usr/lib"
|
||||
OTHER_LDFLAGS = $(inherited) -framework "Foundation" -framework "QuartzCore" -framework "UIKit" -framework "XCTest"
|
||||
OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
|
||||
PODS_BUILD_DIR = ${BUILD_DIR}
|
||||
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||
PODS_ROOT = ${SRCROOT}
|
||||
PODS_TARGET_SRCROOT = ${PODS_ROOT}/FBSnapshotTestCase
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
|
||||
SKIP_INSTALL = YES
|
||||
SWIFT_INCLUDE_PATHS = $(inherited) "$(PLATFORM_DIR)/Developer/usr/lib"
|
||||
SYSTEM_FRAMEWORK_SEARCH_PATHS = $(inherited) "$(PLATFORM_DIR)/Developer/Library/Frameworks"
|
||||
USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES
|
||||
-26
@@ -1,26 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>${PRODUCT_BUNDLE_IDENTIFIER}</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>${PRODUCT_NAME}</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>${CURRENT_PROJECT_VERSION}</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string></string>
|
||||
</dict>
|
||||
</plist>
|
||||
-26
@@ -1,26 +0,0 @@
|
||||
# Acknowledgements
|
||||
This application makes use of the following third party libraries:
|
||||
|
||||
## ContainerControllerSwift
|
||||
|
||||
Copyright (c) 2020 rustamburger@gmail.com <rustamburger@gmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
Generated by CocoaPods - https://cocoapods.org
|
||||
-58
@@ -1,58 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>PreferenceSpecifiers</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>FooterText</key>
|
||||
<string>This application makes use of the following third party libraries:</string>
|
||||
<key>Title</key>
|
||||
<string>Acknowledgements</string>
|
||||
<key>Type</key>
|
||||
<string>PSGroupSpecifier</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>FooterText</key>
|
||||
<string>Copyright (c) 2020 rustamburger@gmail.com <rustamburger@gmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
</string>
|
||||
<key>License</key>
|
||||
<string>MIT</string>
|
||||
<key>Title</key>
|
||||
<string>ContainerControllerSwift</string>
|
||||
<key>Type</key>
|
||||
<string>PSGroupSpecifier</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>FooterText</key>
|
||||
<string>Generated by CocoaPods - https://cocoapods.org</string>
|
||||
<key>Title</key>
|
||||
<string></string>
|
||||
<key>Type</key>
|
||||
<string>PSGroupSpecifier</string>
|
||||
</dict>
|
||||
</array>
|
||||
<key>StringsTable</key>
|
||||
<string>Acknowledgements</string>
|
||||
<key>Title</key>
|
||||
<string>Acknowledgements</string>
|
||||
</dict>
|
||||
</plist>
|
||||
-5
@@ -1,5 +0,0 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
@interface PodsDummy_Pods_ContainerControllerSwift_Example : NSObject
|
||||
@end
|
||||
@implementation PodsDummy_Pods_ContainerControllerSwift_Example
|
||||
@end
|
||||
-207
@@ -1,207 +0,0 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
set -u
|
||||
set -o pipefail
|
||||
|
||||
function on_error {
|
||||
echo "$(realpath -mq "${0}"):$1: error: Unexpected failure"
|
||||
}
|
||||
trap 'on_error $LINENO' ERR
|
||||
|
||||
if [ -z ${FRAMEWORKS_FOLDER_PATH+x} ]; then
|
||||
# If FRAMEWORKS_FOLDER_PATH is not set, then there's nowhere for us to copy
|
||||
# frameworks to, so exit 0 (signalling the script phase was successful).
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
|
||||
mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
|
||||
|
||||
COCOAPODS_PARALLEL_CODE_SIGN="${COCOAPODS_PARALLEL_CODE_SIGN:-false}"
|
||||
SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}"
|
||||
|
||||
# Used as a return value for each invocation of `strip_invalid_archs` function.
|
||||
STRIP_BINARY_RETVAL=0
|
||||
|
||||
# This protects against multiple targets copying the same framework dependency at the same time. The solution
|
||||
# was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html
|
||||
RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????")
|
||||
|
||||
# Copies and strips a vendored framework
|
||||
install_framework()
|
||||
{
|
||||
if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then
|
||||
local source="${BUILT_PRODUCTS_DIR}/$1"
|
||||
elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then
|
||||
local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")"
|
||||
elif [ -r "$1" ]; then
|
||||
local source="$1"
|
||||
fi
|
||||
|
||||
local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
|
||||
|
||||
if [ -L "${source}" ]; then
|
||||
echo "Symlinked..."
|
||||
source="$(readlink "${source}")"
|
||||
fi
|
||||
|
||||
# Use filter instead of exclude so missing patterns don't throw errors.
|
||||
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\""
|
||||
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}"
|
||||
|
||||
local basename
|
||||
basename="$(basename -s .framework "$1")"
|
||||
binary="${destination}/${basename}.framework/${basename}"
|
||||
|
||||
if ! [ -r "$binary" ]; then
|
||||
binary="${destination}/${basename}"
|
||||
elif [ -L "${binary}" ]; then
|
||||
echo "Destination binary is symlinked..."
|
||||
dirname="$(dirname "${binary}")"
|
||||
binary="${dirname}/$(readlink "${binary}")"
|
||||
fi
|
||||
|
||||
# Strip invalid architectures so "fat" simulator / device frameworks work on device
|
||||
if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then
|
||||
strip_invalid_archs "$binary"
|
||||
fi
|
||||
|
||||
# Resign the code if required by the build settings to avoid unstable apps
|
||||
code_sign_if_enabled "${destination}/$(basename "$1")"
|
||||
|
||||
# Embed linked Swift runtime libraries. No longer necessary as of Xcode 7.
|
||||
if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then
|
||||
local swift_runtime_libs
|
||||
swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u)
|
||||
for lib in $swift_runtime_libs; do
|
||||
echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\""
|
||||
rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}"
|
||||
code_sign_if_enabled "${destination}/${lib}"
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
# Copies and strips a vendored dSYM
|
||||
install_dsym() {
|
||||
local source="$1"
|
||||
warn_missing_arch=${2:-true}
|
||||
if [ -r "$source" ]; then
|
||||
# Copy the dSYM into the targets temp dir.
|
||||
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${DERIVED_FILES_DIR}\""
|
||||
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${DERIVED_FILES_DIR}"
|
||||
|
||||
local basename
|
||||
basename="$(basename -s .dSYM "$source")"
|
||||
binary_name="$(ls "$source/Contents/Resources/DWARF")"
|
||||
binary="${DERIVED_FILES_DIR}/${basename}.dSYM/Contents/Resources/DWARF/${binary_name}"
|
||||
|
||||
# Strip invalid architectures so "fat" simulator / device frameworks work on device
|
||||
if [[ "$(file "$binary")" == *"Mach-O "*"dSYM companion"* ]]; then
|
||||
strip_invalid_archs "$binary" "$warn_missing_arch"
|
||||
fi
|
||||
|
||||
if [[ $STRIP_BINARY_RETVAL == 1 ]]; then
|
||||
# Move the stripped file into its final destination.
|
||||
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${DERIVED_FILES_DIR}/${basename}.framework.dSYM\" \"${DWARF_DSYM_FOLDER_PATH}\""
|
||||
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${DERIVED_FILES_DIR}/${basename}.dSYM" "${DWARF_DSYM_FOLDER_PATH}"
|
||||
else
|
||||
# The dSYM was not stripped at all, in this case touch a fake folder so the input/output paths from Xcode do not reexecute this script because the file is missing.
|
||||
touch "${DWARF_DSYM_FOLDER_PATH}/${basename}.dSYM"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Copies the bcsymbolmap files of a vendored framework
|
||||
install_bcsymbolmap() {
|
||||
local bcsymbolmap_path="$1"
|
||||
local destination="${BUILT_PRODUCTS_DIR}"
|
||||
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${bcsymbolmap_path}" "${destination}""
|
||||
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${bcsymbolmap_path}" "${destination}"
|
||||
}
|
||||
|
||||
# Signs a framework with the provided identity
|
||||
code_sign_if_enabled() {
|
||||
if [ -n "${EXPANDED_CODE_SIGN_IDENTITY:-}" -a "${CODE_SIGNING_REQUIRED:-}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then
|
||||
# Use the current code_sign_identity
|
||||
echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}"
|
||||
local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS:-} --preserve-metadata=identifier,entitlements '$1'"
|
||||
|
||||
if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then
|
||||
code_sign_cmd="$code_sign_cmd &"
|
||||
fi
|
||||
echo "$code_sign_cmd"
|
||||
eval "$code_sign_cmd"
|
||||
fi
|
||||
}
|
||||
|
||||
# Strip invalid architectures
|
||||
strip_invalid_archs() {
|
||||
binary="$1"
|
||||
warn_missing_arch=${2:-true}
|
||||
# Get architectures for current target binary
|
||||
binary_archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | awk '{$1=$1;print}' | rev)"
|
||||
# Intersect them with the architectures we are building for
|
||||
intersected_archs="$(echo ${ARCHS[@]} ${binary_archs[@]} | tr ' ' '\n' | sort | uniq -d)"
|
||||
# If there are no archs supported by this binary then warn the user
|
||||
if [[ -z "$intersected_archs" ]]; then
|
||||
if [[ "$warn_missing_arch" == "true" ]]; then
|
||||
echo "warning: [CP] Vendored binary '$binary' contains architectures ($binary_archs) none of which match the current build architectures ($ARCHS)."
|
||||
fi
|
||||
STRIP_BINARY_RETVAL=0
|
||||
return
|
||||
fi
|
||||
stripped=""
|
||||
for arch in $binary_archs; do
|
||||
if ! [[ "${ARCHS}" == *"$arch"* ]]; then
|
||||
# Strip non-valid architectures in-place
|
||||
lipo -remove "$arch" -output "$binary" "$binary"
|
||||
stripped="$stripped $arch"
|
||||
fi
|
||||
done
|
||||
if [[ "$stripped" ]]; then
|
||||
echo "Stripped $binary of architectures:$stripped"
|
||||
fi
|
||||
STRIP_BINARY_RETVAL=1
|
||||
}
|
||||
|
||||
install_artifact() {
|
||||
artifact="$1"
|
||||
base="$(basename "$artifact")"
|
||||
case $base in
|
||||
*.framework)
|
||||
install_framework "$artifact"
|
||||
;;
|
||||
*.dSYM)
|
||||
# Suppress arch warnings since XCFrameworks will include many dSYM files
|
||||
install_dsym "$artifact" "false"
|
||||
;;
|
||||
*.bcsymbolmap)
|
||||
install_bcsymbolmap "$artifact"
|
||||
;;
|
||||
*)
|
||||
echo "error: Unrecognized artifact "$artifact""
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
copy_artifacts() {
|
||||
file_list="$1"
|
||||
while read artifact; do
|
||||
install_artifact "$artifact"
|
||||
done <$file_list
|
||||
}
|
||||
|
||||
ARTIFACT_LIST_FILE="${BUILT_PRODUCTS_DIR}/cocoapods-artifacts-${CONFIGURATION}.txt"
|
||||
if [ -r "${ARTIFACT_LIST_FILE}" ]; then
|
||||
copy_artifacts "${ARTIFACT_LIST_FILE}"
|
||||
fi
|
||||
|
||||
if [[ "$CONFIGURATION" == "Debug" ]]; then
|
||||
install_framework "${BUILT_PRODUCTS_DIR}/ContainerControllerSwift/ContainerControllerSwift.framework"
|
||||
fi
|
||||
if [[ "$CONFIGURATION" == "Release" ]]; then
|
||||
install_framework "${BUILT_PRODUCTS_DIR}/ContainerControllerSwift/ContainerControllerSwift.framework"
|
||||
fi
|
||||
if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then
|
||||
wait
|
||||
fi
|
||||
-16
@@ -1,16 +0,0 @@
|
||||
#ifdef __OBJC__
|
||||
#import <UIKit/UIKit.h>
|
||||
#else
|
||||
#ifndef FOUNDATION_EXPORT
|
||||
#if defined(__cplusplus)
|
||||
#define FOUNDATION_EXPORT extern "C"
|
||||
#else
|
||||
#define FOUNDATION_EXPORT extern
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
FOUNDATION_EXPORT double Pods_ContainerControllerSwift_ExampleVersionNumber;
|
||||
FOUNDATION_EXPORT const unsigned char Pods_ContainerControllerSwift_ExampleVersionString[];
|
||||
|
||||
-12
@@ -1,12 +0,0 @@
|
||||
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES
|
||||
FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/ContainerControllerSwift"
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||
HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/ContainerControllerSwift/ContainerControllerSwift.framework/Headers"
|
||||
LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
|
||||
OTHER_LDFLAGS = $(inherited) -framework "ContainerControllerSwift"
|
||||
OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
|
||||
PODS_BUILD_DIR = ${BUILD_DIR}
|
||||
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||
PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
|
||||
PODS_ROOT = ${SRCROOT}/Pods
|
||||
USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES
|
||||
-6
@@ -1,6 +0,0 @@
|
||||
framework module Pods_ContainerControllerSwift_Example {
|
||||
umbrella header "Pods-ContainerControllerSwift_Example-umbrella.h"
|
||||
|
||||
export *
|
||||
module * { export * }
|
||||
}
|
||||
-12
@@ -1,12 +0,0 @@
|
||||
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES
|
||||
FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/ContainerControllerSwift"
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||
HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/ContainerControllerSwift/ContainerControllerSwift.framework/Headers"
|
||||
LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
|
||||
OTHER_LDFLAGS = $(inherited) -framework "ContainerControllerSwift"
|
||||
OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
|
||||
PODS_BUILD_DIR = ${BUILD_DIR}
|
||||
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||
PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
|
||||
PODS_ROOT = ${SRCROOT}/Pods
|
||||
USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES
|
||||
-26
@@ -1,26 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>${PRODUCT_BUNDLE_IDENTIFIER}</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>${PRODUCT_NAME}</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>${CURRENT_PROJECT_VERSION}</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string></string>
|
||||
</dict>
|
||||
</plist>
|
||||
-36
@@ -1,36 +0,0 @@
|
||||
# Acknowledgements
|
||||
This application makes use of the following third party libraries:
|
||||
|
||||
## FBSnapshotTestCase
|
||||
|
||||
BSD License
|
||||
|
||||
For the FBSnapshotTestCase software
|
||||
|
||||
Copyright (c) 2013, Facebook, Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name Facebook nor the names of its contributors may be used to
|
||||
endorse or promote products derived from this software without specific
|
||||
prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
Generated by CocoaPods - https://cocoapods.org
|
||||
-68
@@ -1,68 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>PreferenceSpecifiers</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>FooterText</key>
|
||||
<string>This application makes use of the following third party libraries:</string>
|
||||
<key>Title</key>
|
||||
<string>Acknowledgements</string>
|
||||
<key>Type</key>
|
||||
<string>PSGroupSpecifier</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>FooterText</key>
|
||||
<string>BSD License
|
||||
|
||||
For the FBSnapshotTestCase software
|
||||
|
||||
Copyright (c) 2013, Facebook, Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name Facebook nor the names of its contributors may be used to
|
||||
endorse or promote products derived from this software without specific
|
||||
prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
</string>
|
||||
<key>License</key>
|
||||
<string>BSD</string>
|
||||
<key>Title</key>
|
||||
<string>FBSnapshotTestCase</string>
|
||||
<key>Type</key>
|
||||
<string>PSGroupSpecifier</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>FooterText</key>
|
||||
<string>Generated by CocoaPods - https://cocoapods.org</string>
|
||||
<key>Title</key>
|
||||
<string></string>
|
||||
<key>Type</key>
|
||||
<string>PSGroupSpecifier</string>
|
||||
</dict>
|
||||
</array>
|
||||
<key>StringsTable</key>
|
||||
<string>Acknowledgements</string>
|
||||
<key>Title</key>
|
||||
<string>Acknowledgements</string>
|
||||
</dict>
|
||||
</plist>
|
||||
-5
@@ -1,5 +0,0 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
@interface PodsDummy_Pods_ContainerControllerSwift_Tests : NSObject
|
||||
@end
|
||||
@implementation PodsDummy_Pods_ContainerControllerSwift_Tests
|
||||
@end
|
||||
-207
@@ -1,207 +0,0 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
set -u
|
||||
set -o pipefail
|
||||
|
||||
function on_error {
|
||||
echo "$(realpath -mq "${0}"):$1: error: Unexpected failure"
|
||||
}
|
||||
trap 'on_error $LINENO' ERR
|
||||
|
||||
if [ -z ${FRAMEWORKS_FOLDER_PATH+x} ]; then
|
||||
# If FRAMEWORKS_FOLDER_PATH is not set, then there's nowhere for us to copy
|
||||
# frameworks to, so exit 0 (signalling the script phase was successful).
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
|
||||
mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
|
||||
|
||||
COCOAPODS_PARALLEL_CODE_SIGN="${COCOAPODS_PARALLEL_CODE_SIGN:-false}"
|
||||
SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}"
|
||||
|
||||
# Used as a return value for each invocation of `strip_invalid_archs` function.
|
||||
STRIP_BINARY_RETVAL=0
|
||||
|
||||
# This protects against multiple targets copying the same framework dependency at the same time. The solution
|
||||
# was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html
|
||||
RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????")
|
||||
|
||||
# Copies and strips a vendored framework
|
||||
install_framework()
|
||||
{
|
||||
if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then
|
||||
local source="${BUILT_PRODUCTS_DIR}/$1"
|
||||
elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then
|
||||
local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")"
|
||||
elif [ -r "$1" ]; then
|
||||
local source="$1"
|
||||
fi
|
||||
|
||||
local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
|
||||
|
||||
if [ -L "${source}" ]; then
|
||||
echo "Symlinked..."
|
||||
source="$(readlink "${source}")"
|
||||
fi
|
||||
|
||||
# Use filter instead of exclude so missing patterns don't throw errors.
|
||||
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\""
|
||||
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}"
|
||||
|
||||
local basename
|
||||
basename="$(basename -s .framework "$1")"
|
||||
binary="${destination}/${basename}.framework/${basename}"
|
||||
|
||||
if ! [ -r "$binary" ]; then
|
||||
binary="${destination}/${basename}"
|
||||
elif [ -L "${binary}" ]; then
|
||||
echo "Destination binary is symlinked..."
|
||||
dirname="$(dirname "${binary}")"
|
||||
binary="${dirname}/$(readlink "${binary}")"
|
||||
fi
|
||||
|
||||
# Strip invalid architectures so "fat" simulator / device frameworks work on device
|
||||
if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then
|
||||
strip_invalid_archs "$binary"
|
||||
fi
|
||||
|
||||
# Resign the code if required by the build settings to avoid unstable apps
|
||||
code_sign_if_enabled "${destination}/$(basename "$1")"
|
||||
|
||||
# Embed linked Swift runtime libraries. No longer necessary as of Xcode 7.
|
||||
if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then
|
||||
local swift_runtime_libs
|
||||
swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u)
|
||||
for lib in $swift_runtime_libs; do
|
||||
echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\""
|
||||
rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}"
|
||||
code_sign_if_enabled "${destination}/${lib}"
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
# Copies and strips a vendored dSYM
|
||||
install_dsym() {
|
||||
local source="$1"
|
||||
warn_missing_arch=${2:-true}
|
||||
if [ -r "$source" ]; then
|
||||
# Copy the dSYM into the targets temp dir.
|
||||
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${DERIVED_FILES_DIR}\""
|
||||
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${DERIVED_FILES_DIR}"
|
||||
|
||||
local basename
|
||||
basename="$(basename -s .dSYM "$source")"
|
||||
binary_name="$(ls "$source/Contents/Resources/DWARF")"
|
||||
binary="${DERIVED_FILES_DIR}/${basename}.dSYM/Contents/Resources/DWARF/${binary_name}"
|
||||
|
||||
# Strip invalid architectures so "fat" simulator / device frameworks work on device
|
||||
if [[ "$(file "$binary")" == *"Mach-O "*"dSYM companion"* ]]; then
|
||||
strip_invalid_archs "$binary" "$warn_missing_arch"
|
||||
fi
|
||||
|
||||
if [[ $STRIP_BINARY_RETVAL == 1 ]]; then
|
||||
# Move the stripped file into its final destination.
|
||||
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${DERIVED_FILES_DIR}/${basename}.framework.dSYM\" \"${DWARF_DSYM_FOLDER_PATH}\""
|
||||
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${DERIVED_FILES_DIR}/${basename}.dSYM" "${DWARF_DSYM_FOLDER_PATH}"
|
||||
else
|
||||
# The dSYM was not stripped at all, in this case touch a fake folder so the input/output paths from Xcode do not reexecute this script because the file is missing.
|
||||
touch "${DWARF_DSYM_FOLDER_PATH}/${basename}.dSYM"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Copies the bcsymbolmap files of a vendored framework
|
||||
install_bcsymbolmap() {
|
||||
local bcsymbolmap_path="$1"
|
||||
local destination="${BUILT_PRODUCTS_DIR}"
|
||||
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${bcsymbolmap_path}" "${destination}""
|
||||
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${bcsymbolmap_path}" "${destination}"
|
||||
}
|
||||
|
||||
# Signs a framework with the provided identity
|
||||
code_sign_if_enabled() {
|
||||
if [ -n "${EXPANDED_CODE_SIGN_IDENTITY:-}" -a "${CODE_SIGNING_REQUIRED:-}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then
|
||||
# Use the current code_sign_identity
|
||||
echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}"
|
||||
local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS:-} --preserve-metadata=identifier,entitlements '$1'"
|
||||
|
||||
if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then
|
||||
code_sign_cmd="$code_sign_cmd &"
|
||||
fi
|
||||
echo "$code_sign_cmd"
|
||||
eval "$code_sign_cmd"
|
||||
fi
|
||||
}
|
||||
|
||||
# Strip invalid architectures
|
||||
strip_invalid_archs() {
|
||||
binary="$1"
|
||||
warn_missing_arch=${2:-true}
|
||||
# Get architectures for current target binary
|
||||
binary_archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | awk '{$1=$1;print}' | rev)"
|
||||
# Intersect them with the architectures we are building for
|
||||
intersected_archs="$(echo ${ARCHS[@]} ${binary_archs[@]} | tr ' ' '\n' | sort | uniq -d)"
|
||||
# If there are no archs supported by this binary then warn the user
|
||||
if [[ -z "$intersected_archs" ]]; then
|
||||
if [[ "$warn_missing_arch" == "true" ]]; then
|
||||
echo "warning: [CP] Vendored binary '$binary' contains architectures ($binary_archs) none of which match the current build architectures ($ARCHS)."
|
||||
fi
|
||||
STRIP_BINARY_RETVAL=0
|
||||
return
|
||||
fi
|
||||
stripped=""
|
||||
for arch in $binary_archs; do
|
||||
if ! [[ "${ARCHS}" == *"$arch"* ]]; then
|
||||
# Strip non-valid architectures in-place
|
||||
lipo -remove "$arch" -output "$binary" "$binary"
|
||||
stripped="$stripped $arch"
|
||||
fi
|
||||
done
|
||||
if [[ "$stripped" ]]; then
|
||||
echo "Stripped $binary of architectures:$stripped"
|
||||
fi
|
||||
STRIP_BINARY_RETVAL=1
|
||||
}
|
||||
|
||||
install_artifact() {
|
||||
artifact="$1"
|
||||
base="$(basename "$artifact")"
|
||||
case $base in
|
||||
*.framework)
|
||||
install_framework "$artifact"
|
||||
;;
|
||||
*.dSYM)
|
||||
# Suppress arch warnings since XCFrameworks will include many dSYM files
|
||||
install_dsym "$artifact" "false"
|
||||
;;
|
||||
*.bcsymbolmap)
|
||||
install_bcsymbolmap "$artifact"
|
||||
;;
|
||||
*)
|
||||
echo "error: Unrecognized artifact "$artifact""
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
copy_artifacts() {
|
||||
file_list="$1"
|
||||
while read artifact; do
|
||||
install_artifact "$artifact"
|
||||
done <$file_list
|
||||
}
|
||||
|
||||
ARTIFACT_LIST_FILE="${BUILT_PRODUCTS_DIR}/cocoapods-artifacts-${CONFIGURATION}.txt"
|
||||
if [ -r "${ARTIFACT_LIST_FILE}" ]; then
|
||||
copy_artifacts "${ARTIFACT_LIST_FILE}"
|
||||
fi
|
||||
|
||||
if [[ "$CONFIGURATION" == "Debug" ]]; then
|
||||
install_framework "${BUILT_PRODUCTS_DIR}/FBSnapshotTestCase/FBSnapshotTestCase.framework"
|
||||
fi
|
||||
if [[ "$CONFIGURATION" == "Release" ]]; then
|
||||
install_framework "${BUILT_PRODUCTS_DIR}/FBSnapshotTestCase/FBSnapshotTestCase.framework"
|
||||
fi
|
||||
if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then
|
||||
wait
|
||||
fi
|
||||
-16
@@ -1,16 +0,0 @@
|
||||
#ifdef __OBJC__
|
||||
#import <UIKit/UIKit.h>
|
||||
#else
|
||||
#ifndef FOUNDATION_EXPORT
|
||||
#if defined(__cplusplus)
|
||||
#define FOUNDATION_EXPORT extern "C"
|
||||
#else
|
||||
#define FOUNDATION_EXPORT extern
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
FOUNDATION_EXPORT double Pods_ContainerControllerSwift_TestsVersionNumber;
|
||||
FOUNDATION_EXPORT const unsigned char Pods_ContainerControllerSwift_TestsVersionString[];
|
||||
|
||||
-12
@@ -1,12 +0,0 @@
|
||||
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES
|
||||
FRAMEWORK_SEARCH_PATHS = $(inherited) "$(PLATFORM_DIR)/Developer/Library/Frameworks" "${PODS_CONFIGURATION_BUILD_DIR}/ContainerControllerSwift" "${PODS_CONFIGURATION_BUILD_DIR}/FBSnapshotTestCase"
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||
HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/ContainerControllerSwift/ContainerControllerSwift.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/FBSnapshotTestCase/FBSnapshotTestCase.framework/Headers"
|
||||
LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
|
||||
OTHER_LDFLAGS = $(inherited) -framework "ContainerControllerSwift" -framework "FBSnapshotTestCase" -framework "Foundation" -framework "QuartzCore" -framework "UIKit" -framework "XCTest"
|
||||
OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
|
||||
PODS_BUILD_DIR = ${BUILD_DIR}
|
||||
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||
PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
|
||||
PODS_ROOT = ${SRCROOT}/Pods
|
||||
USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES
|
||||
-6
@@ -1,6 +0,0 @@
|
||||
framework module Pods_ContainerControllerSwift_Tests {
|
||||
umbrella header "Pods-ContainerControllerSwift_Tests-umbrella.h"
|
||||
|
||||
export *
|
||||
module * { export * }
|
||||
}
|
||||
-12
@@ -1,12 +0,0 @@
|
||||
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES
|
||||
FRAMEWORK_SEARCH_PATHS = $(inherited) "$(PLATFORM_DIR)/Developer/Library/Frameworks" "${PODS_CONFIGURATION_BUILD_DIR}/ContainerControllerSwift" "${PODS_CONFIGURATION_BUILD_DIR}/FBSnapshotTestCase"
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||
HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/ContainerControllerSwift/ContainerControllerSwift.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/FBSnapshotTestCase/FBSnapshotTestCase.framework/Headers"
|
||||
LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
|
||||
OTHER_LDFLAGS = $(inherited) -framework "ContainerControllerSwift" -framework "FBSnapshotTestCase" -framework "Foundation" -framework "QuartzCore" -framework "UIKit" -framework "XCTest"
|
||||
OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
|
||||
PODS_BUILD_DIR = ${BUILD_DIR}
|
||||
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||
PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
|
||||
PODS_ROOT = ${SRCROOT}/Pods
|
||||
USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES
|
||||
@@ -1,28 +0,0 @@
|
||||
import XCTest
|
||||
import ContainerControllerSwift
|
||||
|
||||
class Tests: XCTestCase {
|
||||
|
||||
override func setUp() {
|
||||
super.setUp()
|
||||
// Put setup code here. This method is called before the invocation of each test method in the class.
|
||||
}
|
||||
|
||||
override func tearDown() {
|
||||
// Put teardown code here. This method is called after the invocation of each test method in the class.
|
||||
super.tearDown()
|
||||
}
|
||||
|
||||
func testExample() {
|
||||
// This is an example of a functional test case.
|
||||
XCTAssert(true, "Pass")
|
||||
}
|
||||
|
||||
func testPerformanceExample() {
|
||||
// This is an example of a performance test case.
|
||||
self.measure() {
|
||||
// Put the code you want to measure the time of here.
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
// swift-tools-version:5.2
|
||||
// The swift-tools-version declares the minimum version of Swift required to build this package.
|
||||
|
||||
import PackageDescription
|
||||
|
||||
let package = Package(
|
||||
name: "ContainerController",
|
||||
platforms: [
|
||||
.iOS(.v13),
|
||||
],
|
||||
products: [
|
||||
// Products define the executables and libraries produced by a package, and make them visible to other packages.
|
||||
.library(
|
||||
name: "ContainerController",
|
||||
targets: ["ContainerController"]),
|
||||
],
|
||||
dependencies: [
|
||||
// Dependencies declare other packages that this package depends on.
|
||||
// .package(url: /* package url */, from: "1.0.0"),
|
||||
],
|
||||
targets: [
|
||||
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
|
||||
// Targets can depend on other targets in this package, and on products in packages which this package depends on.
|
||||
.target(
|
||||
name: "ContainerController",
|
||||
dependencies: []),
|
||||
.testTarget(
|
||||
name: "ContainerControllerTests",
|
||||
dependencies: ["ContainerController"]),
|
||||
]
|
||||
)
|
||||
@@ -1,29 +1,480 @@
|
||||
# ContainerControllerSwift
|
||||

|
||||
|
||||
# ContainerController
|
||||
|
||||
[](https://travis-ci.org/rustamburger@gmail.com/ContainerControllerSwift)
|
||||
[](https://cocoapods.org/pods/ContainerControllerSwift)
|
||||
[](https://cocoapods.org/pods/ContainerControllerSwift)
|
||||
[](https://cocoapods.org/pods/ContainerControllerSwift)
|
||||
[](https://swift.org/)
|
||||
[](https://swift.org/)
|
||||
[](https://swift.org/)
|
||||
|
||||
## Example
|
||||
UI Component. This is a copy swipe-panel from app: https://www.apple.com/ios/maps/
|
||||
|
||||
To run the example project, clone the repo, and run `pod install` from the Example directory first.
|
||||
## Preview
|
||||

|
||||

|
||||

|
||||
|
||||
## Requirements
|
||||
<!-- TOC -->
|
||||
|
||||
## Installation
|
||||
- [Requirements](#requirements)
|
||||
- [Installation](#installation)
|
||||
- [CocoaPods](#cocoapods)
|
||||
- [Swift Package Manager with Xcode 11](#swift-package-manager-with-xcode-11)
|
||||
- [Getting Started](#getting-started)
|
||||
- [Action](#action)
|
||||
- [Move position with an animation](#move-position-with-an-animation)
|
||||
- [Adding possible custom subviews in ContainerController view](#adding-possible-custom-subviews-in-containercontroller-view)
|
||||
- [Add `ScrollView`📃](#add-scrollview)
|
||||
- [`Delegate` to self 👆](#delegate-to-self-)
|
||||
- [Add `HeaderView`](#add-headerview)
|
||||
- [Add `FooterView`](#add-footerview)
|
||||
- [Add Custom `View`](#add-custom-view)
|
||||
- [Settings ⚙️](#settings-)
|
||||
- [Layout](#layout)
|
||||
- [Customize the layout with create subclass `ContainerLayout` on initialization](#customize-the-layout-with-create-subclass-containerlayout-on-initialization)
|
||||
- [Or create object `ContainerLayout`](#or-create-object-containerlayout)
|
||||
- [Change settings right away](#change-settings-right-away)
|
||||
- [ContainerController `View`](#containercontroller-view)
|
||||
- [Use a ready-made solution](#use-a-ready-made-solution)
|
||||
- [Change `CornerRadius`](#change-cornerradius)
|
||||
- [Add Layer `Shadow`](#add-layer-shadow)
|
||||
- [Add Background `Blur`](#add-background-blur)
|
||||
- [More details](#more-details)
|
||||
- [Change positions on screen Top Middle Bottom](#change-positions-on-screen-top-middle-bottom)
|
||||
- [Customize indentations for View](#customize-indentations-for-view)
|
||||
- [Customize for landscape orientation](#customize-for-landscape-orientation)
|
||||
- [Parameters for control footerView](#parameters-for-control-footerview)
|
||||
- [ContainerController `Delegate`](#containercontroller-delegate)
|
||||
- [Author](#author)
|
||||
- [License](#license)
|
||||
|
||||
<!-- /TOC -->
|
||||
|
||||
## Requirements
|
||||
|
||||
✏️ ContainerController is written in Swift 5.0+. It can be built by Xcode 11 or later. Compatible with iOS 13.0+.
|
||||
|
||||
## Installation
|
||||
|
||||
### CocoaPods
|
||||
|
||||
ContainerControllerSwift is available through [CocoaPods](https://cocoapods.org). To install
|
||||
it, simply add the following line to your Podfile:
|
||||
|
||||
```ruby
|
||||
pod 'ContainerControllerSwift'
|
||||
```
|
||||
### Swift Package Manager with Xcode 11
|
||||
|
||||
Follow [this doc](https://developer.apple.com/documentation/swift_packages/adding_package_dependencies_to_your_app).
|
||||
|
||||
## Getting Started
|
||||
|
||||
```swift
|
||||
|
||||
import UIKit
|
||||
import ContainerControllerSwift
|
||||
|
||||
class ViewController: UIViewController, ContainerControllerDelegate {
|
||||
|
||||
var container: ContainerController!
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
// Create ContainerController Layout object
|
||||
let layout = ContainerLayout()
|
||||
layout.startPosition = .hide
|
||||
layout.backgroundShadowShow = true
|
||||
layout.positions = ContainerPosition(top: 70, middle: 250, bottom: 70)
|
||||
|
||||
// Create ContainerController object, along with the container.view
|
||||
// Pass the current UIViewController
|
||||
let container = ContainerController(addTo: self, layout: layout)
|
||||
container.view.cornerRadius = 15
|
||||
container.view.addShadow()
|
||||
|
||||
// Create subclass scrollView
|
||||
let tableView = UITableView()
|
||||
tableView.register(UITableViewCell.self, forCellReuseIdentifier: "cell")
|
||||
tableView.delegate = self
|
||||
tableView.dataSource = self
|
||||
|
||||
// Add scrollView to container
|
||||
container.add(scrollView: tableView)
|
||||
|
||||
// Finishing settings ContainerController,
|
||||
// Animated move position Top
|
||||
container.move(type: .top)
|
||||
}
|
||||
|
||||
override func viewDidDisappear(_ animated: Bool) {
|
||||
super.viewDidDisappear(animated)
|
||||
|
||||
// Remove the subviews ContainerController
|
||||
container.remove()
|
||||
container = nil
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Action
|
||||
|
||||
### Move position with an animation
|
||||
|
||||
```swift
|
||||
|
||||
container.move(type: .top)
|
||||
container.move(type: .middle)
|
||||
container.move(type: .bottom)
|
||||
|
||||
```
|
||||
|
||||
## Adding possible custom subviews in ContainerController view
|
||||
|
||||
### Add `ScrollView`
|
||||
|
||||
```swift
|
||||
|
||||
let tableView = UITableView()
|
||||
tableView.register(UITableViewCell.self, forCellReuseIdentifier: "cell")
|
||||
tableView.backgroundColor = .clear
|
||||
tableView.tableFooterView = UIView()
|
||||
tableView.delegate = self
|
||||
tableView.dataSource = self
|
||||
|
||||
// Add scrollView to container
|
||||
container.add(scrollView: tableView)
|
||||
|
||||
```
|
||||
|
||||
|
||||
#### `Delegate` to self 👆
|
||||
#### If you implement delegate ScrollView (TableView, CollectionView, TextView) to `self`, then you need to call 4 functions in ContainerController
|
||||
|
||||
```swift
|
||||
extension ViewController: UIScrollViewDelegate {
|
||||
|
||||
func scrollViewDidScroll(_ scrollView: UIScrollView) {
|
||||
container.scrollViewDidScroll(scrollView)
|
||||
}
|
||||
|
||||
func scrollViewWillBeginDragging(_ scrollView: UIScrollView) {
|
||||
container.scrollViewWillBeginDragging(scrollView)
|
||||
}
|
||||
|
||||
func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
|
||||
container.scrollViewDidEndDecelerating(scrollView)
|
||||
}
|
||||
|
||||
func scrollViewDidEndDragging(_ scrollView: UIScrollView, willDecelerate decelerate: Bool) {
|
||||
container.scrollViewDidEndDragging(scrollView, willDecelerate: decelerate)
|
||||
}
|
||||
}
|
||||
|
||||
extension ViewController: UITableViewDelegate {
|
||||
...
|
||||
}
|
||||
|
||||
extension ViewController: UITableViewDataSource {
|
||||
...
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
### Add `HeaderView`
|
||||
|
||||
```swift
|
||||
|
||||
let headerView = ExampleHeaderGripView()
|
||||
headerView.height = 20
|
||||
|
||||
container.add(headerView: headerView)
|
||||
|
||||
```
|
||||
|
||||
### Add `FooterView`
|
||||
|
||||
```swift
|
||||
|
||||
let tabBarView = HeaderTabBarView()
|
||||
tabBarView.height = 49.0
|
||||
|
||||
container.add(footerView: tabBarView)
|
||||
|
||||
```
|
||||
### Add Custom `View`
|
||||
|
||||
```swift
|
||||
|
||||
// Add custom shadow
|
||||
let layer = container.view.layer
|
||||
layer.shadowOpacity = 0.5
|
||||
layer.shadowColor = UIColor.red.cgColor
|
||||
layer.shadowOffset = CGSize(width: 1, height: 4)
|
||||
layer.shadowRadius = 5
|
||||
|
||||
// Add view in container.view
|
||||
let viewRed = UIView(frame: CGRect(x: 50, y: 50, width: 50, height: 50))
|
||||
viewRed.backgroundColor = .systemRed
|
||||
container.view.addSubview(viewRed)
|
||||
|
||||
// Add view under scrollView container.view
|
||||
let viewGreen = UIView(frame: CGRect(x: 25, y: 25, width: 50, height: 50))
|
||||
viewGreen.backgroundColor = .systemGreen
|
||||
container.view.insertSubview(viewGreen, at: 0)
|
||||
|
||||
```
|
||||
|
||||
## Settings ⚙️
|
||||
|
||||
### Layout
|
||||
|
||||
#### Customize the layout with create subclass `ContainerLayout` on initialization
|
||||
|
||||
```swift
|
||||
|
||||
class NewContainerLayout: ContainerLayout {
|
||||
|
||||
override init() {
|
||||
super.init()
|
||||
|
||||
// Initialization start position.
|
||||
startPosition = .hide
|
||||
|
||||
// Disables any moving with gestures.
|
||||
movingEnabled = true
|
||||
|
||||
// Sets the new value for positions of animated movement (top, middle, bottom).
|
||||
positions = ContainerPosition(top: 70, middle: 250, bottom: 70)
|
||||
|
||||
// Sets insets container.view (left, right).
|
||||
insets = ContainerInsets(right: 20, left: 20)
|
||||
}
|
||||
}
|
||||
|
||||
class ViewController: UIViewController {
|
||||
|
||||
var container: ContainerController!
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
container = ContainerController(addTo: self, layout: NewContainerLayout())
|
||||
container.move(type: .top)
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
#### Or create object `ContainerLayout`
|
||||
|
||||
```swift
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
// Create ContainerController Layout object
|
||||
let layout = ContainerLayout()
|
||||
layout.startPosition = .hide
|
||||
layout.backgroundShadowShow = true
|
||||
layout.positions = ContainerPosition(top: 70, middle: 250, bottom: 70)
|
||||
|
||||
container = ContainerController(addTo: self, layout: layout)
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
### Change settings right away
|
||||
|
||||
|
||||
```swift
|
||||
|
||||
// Properties
|
||||
container.set(movingEnabled: true)
|
||||
container.set(trackingPosition: false)
|
||||
container.set(footerPadding: 100)
|
||||
|
||||
// Add ScrollInsets Top/Bottom
|
||||
container.set(scrollIndicatorTop: 5) // ↓
|
||||
container.set(scrollIndicatorBottom: 5) // ↑
|
||||
|
||||
// Positions
|
||||
container.set(top: 70) // ↓
|
||||
container.set(middle: 250) // ↑
|
||||
container.set(bottom: 80) // ↑
|
||||
|
||||
// Middle Enable/Disable
|
||||
container.set(middle: 250)
|
||||
container.set(middle: nil)
|
||||
|
||||
// Background Shadow
|
||||
container.set(backgroundShadowShow: true)
|
||||
|
||||
// Insets View
|
||||
container.set(left: 5) // →
|
||||
container.set(right: 5) // ←
|
||||
|
||||
// Landscape params
|
||||
container.setLandscape(top: 30)
|
||||
container.setLandscape(middle: 150)
|
||||
container.setLandscape(bottom: 70)
|
||||
container.setLandscape(middle: nil)
|
||||
|
||||
container.setLandscape(backgroundShadowShow: false)
|
||||
|
||||
container.setLandscape(left: 10)
|
||||
container.setLandscape(right: 100)
|
||||
|
||||
```
|
||||
|
||||
## ContainerController `View`
|
||||
|
||||
#### Use a ready-made solution
|
||||
|
||||
`ContainerView` is generated automatically when you create ContainerController
|
||||
Use a ready-made solution to change the radius, add shadow, and blur.
|
||||
|
||||
#### Change `CornerRadius`
|
||||
|
||||
```swift
|
||||
// Change cornerRadius global for all subviews
|
||||
container.view.cornerRadius = 15
|
||||
```
|
||||
#### Add Layer `Shadow`
|
||||
|
||||
```swift
|
||||
container.view.addShadow(opacity: 0.1)
|
||||
```
|
||||
#### Add Background `Blur`
|
||||
|
||||
```swift
|
||||
// add blur UIVisualEffectView
|
||||
container.view.addBlur(style: .dark)
|
||||
|
||||
```
|
||||
|
||||
### More details
|
||||
|
||||
#### Change positions on screen Top Middle Bottom
|
||||
|
||||
```swift
|
||||
|
||||
// These parameters set the new position value.
|
||||
container.layout.positions = ContainerPosition(top: 70, middle: 250, bottom: 70)
|
||||
|
||||
// Change settings right away
|
||||
container.set(top: 70) // ↓
|
||||
container.set(middle: 250) // ↑
|
||||
container.set(bottom: 80) // ↑
|
||||
|
||||
```
|
||||
|
||||
#### Customize indentations for View
|
||||
|
||||
```swift
|
||||
|
||||
// Sets insets container.view (left, right).
|
||||
container.layout.insets = ContainerInsets(right: 20, left: 20)
|
||||
|
||||
container.layout.landscapeInsets = ContainerInsets(right: 20, left: 100)
|
||||
|
||||
|
||||
// Change settings right away
|
||||
container.set(left: 5) // →
|
||||
container.set(right: 5) // ←
|
||||
|
||||
container.setLandscape(left: 10)
|
||||
container.setLandscape(right: 100)
|
||||
|
||||
```
|
||||
|
||||
#### Customize for landscape orientation
|
||||
|
||||
```swift
|
||||
|
||||
// Sets the background shadow under container. (Default: backgroundShadowShow).
|
||||
container.layout.landscapeBackgroundShadowShow = false
|
||||
|
||||
// Sets the new value for positions of animated movement (top, middle, bottom). (Default: positions).
|
||||
container.layout.landscapePositions = ContainerPosition(top: 20, middle: 150, bottom: 70)
|
||||
|
||||
// Sets insets container.view (left, right). (Default: insets).
|
||||
container.layout.landscapeInsets = ContainerInsets(right: 20, left: 100)
|
||||
|
||||
|
||||
// Change settings right away
|
||||
|
||||
container.setLandscape(top: 30)
|
||||
container.setLandscape(middle: 150)
|
||||
container.setLandscape(bottom: 70)
|
||||
container.setLandscape(middle: nil)
|
||||
|
||||
container.setLandscape(backgroundShadowShow: false)
|
||||
|
||||
container.setLandscape(left: 10)
|
||||
container.setLandscape(right: 100)
|
||||
|
||||
```
|
||||
|
||||
#### Parameters for control footerView
|
||||
|
||||
```swift
|
||||
|
||||
// Padding-top from container.view, if headerView is added, then its + height is summed.
|
||||
container.layout.footerPadding = 100
|
||||
|
||||
// Tracking position container.view during animated movement.
|
||||
container.layout.trackingPosition = false
|
||||
|
||||
// Change settings right away
|
||||
|
||||
container.set(footerPadding: 100)
|
||||
container.set(trackingPosition: false)
|
||||
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||
## ContainerController `Delegate`
|
||||
|
||||
```swift
|
||||
|
||||
class ViewController: UIViewController, ContainerControllerDelegate {
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
let container = ContainerController(addTo: self, layout: layout)
|
||||
container.delegate = self
|
||||
}
|
||||
}
|
||||
|
||||
/// Reports rotation and orientation changes
|
||||
func containerControllerRotation(_ containerController: ContainerController) {
|
||||
...
|
||||
}
|
||||
|
||||
/// Reports a click on the background shadow
|
||||
func containerControllerShadowClick(_ containerController: ContainerController) {
|
||||
...
|
||||
}
|
||||
|
||||
/// Reports the changes current position of the container, after its use
|
||||
func containerControllerMove(_ containerController: ContainerController, position: CGFloat, type: ContainerMoveType, animation: Bool) {
|
||||
...
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## Author
|
||||
|
||||
rustamburger@gmail.com, rustamburger@gmail.com
|
||||
<motionrustam@gmail.com> 📩| [mrustaa](https://github.com/mrustaa/)
|
||||
|
||||
## License
|
||||
|
||||
ContainerControllerSwift is available under the MIT license. See the LICENSE file for more info.
|
||||
ContainerController is available under the MIT license. See the LICENSE file for more info.
|
||||
|
||||
|
||||
+7
-7
@@ -1,14 +1,14 @@
|
||||
//
|
||||
// ColletionAdapterCell.swift
|
||||
// CollectionAdapterCell.swift
|
||||
// PatternsSwift
|
||||
//
|
||||
// Created by Рустам Мотыгуллин on 01/05/2020.
|
||||
// Copyright © 2020 mrusta. All rights reserved.
|
||||
// Created by mrustaa on 01/05/2020.
|
||||
// Copyright © 2020 mrustaa. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class CollectionAdapterCell: UICollectionViewCell {
|
||||
open class CollectionAdapterCell: UICollectionViewCell {
|
||||
|
||||
@IBInspectable var hideAnimation: Bool = false
|
||||
var selectedView: UIView?
|
||||
@@ -24,7 +24,7 @@ class CollectionAdapterCell: UICollectionViewCell {
|
||||
setupCommonProperties()
|
||||
}
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
required public init?(coder: NSCoder) {
|
||||
super.init(coder: coder)
|
||||
setupCommonProperties()
|
||||
}
|
||||
@@ -49,7 +49,7 @@ class CollectionAdapterCell: UICollectionViewCell {
|
||||
let selAlpha: CGFloat = 0.2 // 0.15
|
||||
|
||||
|
||||
override var isSelected: Bool {
|
||||
open override var isSelected: Bool {
|
||||
set {
|
||||
super.isSelected = newValue
|
||||
|
||||
@@ -85,7 +85,7 @@ class CollectionAdapterCell: UICollectionViewCell {
|
||||
}
|
||||
}
|
||||
|
||||
override var isHighlighted: Bool {
|
||||
open override var isHighlighted: Bool {
|
||||
set {
|
||||
super.isHighlighted = newValue
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// CollectionAdapterCellData.swift
|
||||
// PatternsSwift
|
||||
//
|
||||
// Created by mrustaa on 01/05/2020.
|
||||
// Copyright © 2020 mrustaa. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
open class CollectionAdapterCellData: NSObject {
|
||||
|
||||
public var selectCallback: (() -> Void)?
|
||||
|
||||
open func size() -> CGSize {
|
||||
return CGSize.zero
|
||||
}
|
||||
|
||||
}
|
||||
+5
-5
@@ -1,14 +1,14 @@
|
||||
//
|
||||
// ColletionAdapterItem.swift
|
||||
// CollectionAdapterItem.swift
|
||||
// PatternsSwift
|
||||
//
|
||||
// Created by Рустам Мотыгуллин on 01/05/2020.
|
||||
// Copyright © 2020 mrusta. All rights reserved.
|
||||
// Created by mrustaa on 01/05/2020.
|
||||
// Copyright © 2020 mrustaa. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class CollectionAdapterItem: NSObject {
|
||||
open class CollectionAdapterItem: NSObject {
|
||||
|
||||
public let cellClass: AnyClass
|
||||
public let cellData: CollectionAdapterCellData?
|
||||
@@ -17,7 +17,7 @@ class CollectionAdapterItem: NSObject {
|
||||
return String(describing: cellClass)
|
||||
}
|
||||
|
||||
init(cellClass: AnyClass, cellData: CollectionAdapterCellData? = nil) {
|
||||
public init(cellClass: AnyClass, cellData: CollectionAdapterCellData? = nil) {
|
||||
self.cellClass = cellClass
|
||||
self.cellData = cellData
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
//
|
||||
// CollectionAdapterTypes.swift
|
||||
// PatternsSwift
|
||||
//
|
||||
// Created by mrustaa on 01/05/2020.
|
||||
// Copyright © 2020 mrustaa. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
public typealias CollectionAdapterCountCallback = () -> Int
|
||||
public typealias CollectionAdapterCellIndexCallback = (_ index: Int) -> UICollectionViewCell
|
||||
public typealias CollectionAdapterSizeIndexCallback = (_ index: Int) -> CGSize
|
||||
public typealias CollectionAdapterSelectIndexCallback = (_ index: Int) -> ()
|
||||
+14
-14
@@ -2,32 +2,32 @@
|
||||
// CollectionAdapterView.swift
|
||||
// PatternsSwift
|
||||
//
|
||||
// Created by Рустам Мотыгуллин on 01/05/2020.
|
||||
// Copyright © 2020 mrusta. All rights reserved.
|
||||
// Created by mrustaa on 01/05/2020.
|
||||
// Copyright © 2020 mrustaa. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class CollectionAdapterView: UICollectionView {
|
||||
open class CollectionAdapterView: UICollectionView {
|
||||
|
||||
var countCallback: CollectionAdapterCountCallback?
|
||||
var cellIndexCallback: CollectionAdapterCellIndexCallback?
|
||||
var sizeIndexCallback: CollectionAdapterSizeIndexCallback?
|
||||
var selectIndexCallback: CollectionAdapterSelectIndexCallback?
|
||||
public var countCallback: CollectionAdapterCountCallback?
|
||||
public var cellIndexCallback: CollectionAdapterCellIndexCallback?
|
||||
public var sizeIndexCallback: CollectionAdapterSizeIndexCallback?
|
||||
public var selectIndexCallback: CollectionAdapterSelectIndexCallback?
|
||||
|
||||
var items: [CollectionAdapterItem] = []
|
||||
public var items: [CollectionAdapterItem] = []
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
required public init?(coder: NSCoder) {
|
||||
super.init(coder: coder)
|
||||
update()
|
||||
}
|
||||
|
||||
override init(frame: CGRect, collectionViewLayout layout: UICollectionViewLayout) {
|
||||
public override init(frame: CGRect, collectionViewLayout layout: UICollectionViewLayout) {
|
||||
super.init(frame: frame, collectionViewLayout: layout)
|
||||
update()
|
||||
}
|
||||
|
||||
func update() {
|
||||
public func update() {
|
||||
delegate = self
|
||||
dataSource = self
|
||||
backgroundColor = .clear
|
||||
@@ -64,7 +64,7 @@ class CollectionAdapterView: UICollectionView {
|
||||
|
||||
extension CollectionAdapterView: UICollectionViewDelegate {
|
||||
|
||||
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
|
||||
public func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
|
||||
if !items.isEmpty {
|
||||
let item = items[indexPath.row]
|
||||
item.cellData?.selectCallback?()
|
||||
@@ -78,7 +78,7 @@ extension CollectionAdapterView: UICollectionViewDelegate {
|
||||
|
||||
extension CollectionAdapterView: UICollectionViewDataSource {
|
||||
|
||||
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
|
||||
public func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
|
||||
if !items.isEmpty {
|
||||
return items.count
|
||||
}
|
||||
@@ -88,7 +88,7 @@ extension CollectionAdapterView: UICollectionViewDataSource {
|
||||
return 0
|
||||
}
|
||||
|
||||
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
|
||||
public func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
|
||||
if !items.isEmpty {
|
||||
let item = items[indexPath.row]
|
||||
let cell = cellAt(indexPath)
|
||||
+66
-49
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// ContainerView.swift
|
||||
// ContainerController.swift
|
||||
// PatternsSwift
|
||||
//
|
||||
// Created by mrustaa on 21/04/2020.
|
||||
@@ -8,7 +8,8 @@
|
||||
|
||||
import UIKit
|
||||
|
||||
class ContainerController: NSObject {
|
||||
@available(iOS 13.0, *)
|
||||
open class ContainerController: NSObject {
|
||||
|
||||
// MARK: Views
|
||||
|
||||
@@ -210,20 +211,12 @@ class ContainerController: NSObject {
|
||||
|
||||
@objc func rotated() {
|
||||
|
||||
let orint = UIDevice.current.orientation
|
||||
if orint == .faceUp || orint == .faceDown { return }
|
||||
if !UIDevice.current.orientation.isRotateAllowed { return }
|
||||
|
||||
if ContainerDevice.orientation == oldOrientation { return }
|
||||
oldOrientation = ContainerDevice.orientation
|
||||
|
||||
if isPortrait {
|
||||
shadowButton.isHidden = !layout.backgroundShadowShow
|
||||
} else {
|
||||
if let landscapeShadowShow = layout.landscapeBackgroundShadowShow {
|
||||
shadowButton.isHidden = !landscapeShadowShow
|
||||
} else {
|
||||
shadowButton.isHidden = !layout.backgroundShadowShow
|
||||
}
|
||||
}
|
||||
shadowHiddenCheck()
|
||||
|
||||
delegate?.containerControllerRotation(self)
|
||||
|
||||
@@ -235,82 +228,82 @@ class ContainerController: NSObject {
|
||||
|
||||
// MARK: - Update Layout
|
||||
|
||||
func set(layout: ContainerLayout) {
|
||||
public func set(layout: ContainerLayout) {
|
||||
self.layout = layout
|
||||
calculationViews()
|
||||
}
|
||||
|
||||
// MARK: Set
|
||||
|
||||
func set(movingEnabled: Bool) {
|
||||
public func set(movingEnabled: Bool) {
|
||||
layout.movingEnabled = movingEnabled
|
||||
scrollView?.isScrollEnabled = movingEnabled
|
||||
panGesture?.isEnabled = movingEnabled
|
||||
}
|
||||
|
||||
func set(trackingPosition: Bool) {
|
||||
public func set(trackingPosition: Bool) {
|
||||
layout.trackingPosition = trackingPosition
|
||||
}
|
||||
|
||||
func set(footerPadding: CGFloat) {
|
||||
public func set(footerPadding: CGFloat) {
|
||||
layout.footerPadding = footerPadding
|
||||
calculationViews()
|
||||
}
|
||||
|
||||
// MARK: Scroll Insets
|
||||
|
||||
func set(scrollIndicatorTop: CGFloat) {
|
||||
public func set(scrollIndicatorTop: CGFloat) {
|
||||
layout.scrollIndicatorInsets = UIEdgeInsets(top: scrollIndicatorTop, left: 0, bottom: layout.scrollIndicatorInsets.bottom, right: 0)
|
||||
calculationViews()
|
||||
}
|
||||
|
||||
func set(scrollIndicatorBottom: CGFloat) {
|
||||
public func set(scrollIndicatorBottom: CGFloat) {
|
||||
layout.scrollIndicatorInsets = UIEdgeInsets(top: layout.scrollIndicatorInsets.top, left: 0, bottom: scrollIndicatorBottom, right: 0)
|
||||
calculationViews()
|
||||
}
|
||||
|
||||
func set(scrollInsetsTop: CGFloat) {
|
||||
public func set(scrollInsetsTop: CGFloat) {
|
||||
layout.scrollInsets = UIEdgeInsets(top: scrollInsetsTop, left: 0, bottom: layout.scrollInsets.bottom, right: 0)
|
||||
calculationViews()
|
||||
}
|
||||
|
||||
func set(scrollInsetsBottom: CGFloat) {
|
||||
public func set(scrollInsetsBottom: CGFloat) {
|
||||
layout.scrollInsets = UIEdgeInsets(top: layout.scrollInsets.top, left: 0, bottom: scrollInsetsBottom, right: 0)
|
||||
calculationViews()
|
||||
}
|
||||
|
||||
// MARK: Portrait
|
||||
|
||||
func set(top: CGFloat) {
|
||||
public func set(top: CGFloat) {
|
||||
layout.positions.top = top
|
||||
}
|
||||
|
||||
func set(middle: CGFloat?) {
|
||||
public func set(middle: CGFloat?) {
|
||||
layout.positions.middle = middle
|
||||
}
|
||||
|
||||
func set(bottom: CGFloat) {
|
||||
public func set(bottom: CGFloat) {
|
||||
layout.positions.bottom = bottom
|
||||
}
|
||||
|
||||
func set(right: CGFloat) {
|
||||
public func set(right: CGFloat) {
|
||||
layout.insets.right = right
|
||||
if isPortrait { calculationViews() }
|
||||
}
|
||||
|
||||
func set(left: CGFloat) {
|
||||
public func set(left: CGFloat) {
|
||||
layout.insets.left = left
|
||||
if isPortrait { calculationViews() }
|
||||
}
|
||||
|
||||
func set(backgroundShadowShow: Bool) {
|
||||
public func set(backgroundShadowShow: Bool) {
|
||||
layout.backgroundShadowShow = backgroundShadowShow
|
||||
if isPortrait { move(type: moveType) }
|
||||
}
|
||||
|
||||
// MARK: Landscape
|
||||
|
||||
func updateLandscapeLayout() {
|
||||
public func updateLandscapeLayout() {
|
||||
if layout.landscapePositions == nil {
|
||||
layout.landscapePositions = ContainerPosition.zero
|
||||
}
|
||||
@@ -319,34 +312,34 @@ class ContainerController: NSObject {
|
||||
}
|
||||
}
|
||||
|
||||
func setLandscape(top: CGFloat) {
|
||||
public func setLandscape(top: CGFloat) {
|
||||
updateLandscapeLayout()
|
||||
layout.landscapePositions?.top = top
|
||||
}
|
||||
|
||||
func setLandscape(middle: CGFloat?) {
|
||||
public func setLandscape(middle: CGFloat?) {
|
||||
updateLandscapeLayout()
|
||||
layout.landscapePositions?.middle = middle
|
||||
}
|
||||
|
||||
func setLandscape(bottom: CGFloat) {
|
||||
public func setLandscape(bottom: CGFloat) {
|
||||
updateLandscapeLayout()
|
||||
layout.landscapePositions?.bottom = bottom
|
||||
}
|
||||
|
||||
func setLandscape(right: CGFloat) {
|
||||
public func setLandscape(right: CGFloat) {
|
||||
updateLandscapeLayout()
|
||||
layout.landscapeInsets?.right = right
|
||||
if !isPortrait { calculationViews() }
|
||||
}
|
||||
|
||||
func setLandscape(left: CGFloat) {
|
||||
public func setLandscape(left: CGFloat) {
|
||||
updateLandscapeLayout()
|
||||
layout.landscapeInsets?.left = left
|
||||
if !isPortrait { calculationViews() }
|
||||
}
|
||||
|
||||
func setLandscape(backgroundShadowShow: Bool) {
|
||||
public func setLandscape(backgroundShadowShow: Bool) {
|
||||
layout.landscapeBackgroundShadowShow = backgroundShadowShow
|
||||
if !isPortrait { move(type: moveType) }
|
||||
}
|
||||
@@ -372,7 +365,7 @@ class ContainerController: NSObject {
|
||||
private func createContainerView() {
|
||||
let frame = CGRect(x: 0, y: 0, width: deviceWidth, height: deviceHeight * 2)
|
||||
view = ContainerView(frame: frame)
|
||||
view.backgroundColor = .white
|
||||
view.backgroundColor = .systemBackground
|
||||
controller?.view.addSubview(view)
|
||||
|
||||
panGesture = UIPanGestureRecognizer(target: self, action: #selector(handlePan(_:)))
|
||||
@@ -870,7 +863,7 @@ class ContainerController: NSObject {
|
||||
|
||||
}
|
||||
|
||||
func shadowLevelAlpha(positionY: CGFloat) {
|
||||
func shadowHiddenCheck() {
|
||||
|
||||
if isPortrait {
|
||||
shadowButton.isHidden = !layout.backgroundShadowShow
|
||||
@@ -881,6 +874,11 @@ class ContainerController: NSObject {
|
||||
shadowButton.isHidden = !layout.backgroundShadowShow
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func shadowLevelAlpha(positionY: CGFloat) {
|
||||
|
||||
shadowHiddenCheck()
|
||||
|
||||
let alphaMax: CGFloat = 0.45
|
||||
|
||||
@@ -1092,9 +1090,10 @@ class ContainerController: NSObject {
|
||||
|
||||
// MARK: - Gesture Delegate
|
||||
|
||||
@available(iOS 13.0, *)
|
||||
extension ContainerController: UIGestureRecognizerDelegate {
|
||||
|
||||
func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool {
|
||||
public func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool {
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -1102,16 +1101,17 @@ extension ContainerController: UIGestureRecognizerDelegate {
|
||||
|
||||
// MARK: - Table Delegate
|
||||
|
||||
@available(iOS 13.0, *)
|
||||
extension ContainerController: UITableViewDelegate {
|
||||
|
||||
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
|
||||
public func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
|
||||
if let tableAdapterView = scrollView as? TableAdapterView {
|
||||
return tableAdapterView.tableView(tableView, heightForRowAt: indexPath)
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
|
||||
public func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
|
||||
if let tableAdapterView = scrollView as? TableAdapterView {
|
||||
return tableAdapterView.tableView(tableView, didSelectRowAt: indexPath)
|
||||
}
|
||||
@@ -1121,29 +1121,43 @@ extension ContainerController: UITableViewDelegate {
|
||||
|
||||
// MARK: - Table DataSource
|
||||
|
||||
@available(iOS 13.0, *)
|
||||
extension ContainerController: UITableViewDataSource {
|
||||
|
||||
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
||||
public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
||||
if let tableAdapterView = scrollView as? TableAdapterView {
|
||||
return tableAdapterView.tableView(tableView, numberOfRowsInSection: section)
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
||||
public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
||||
if let tableAdapterView = scrollView as? TableAdapterView {
|
||||
return tableAdapterView.tableView(tableView, cellForRowAt: indexPath)
|
||||
}
|
||||
return UITableViewCell()
|
||||
}
|
||||
|
||||
|
||||
public func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
|
||||
if let tableAdapterView = scrollView as? TableAdapterView {
|
||||
return tableAdapterView.tableView(tableView, canEditRowAt: indexPath)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
public func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) {
|
||||
if let tableAdapterView = scrollView as? TableAdapterView {
|
||||
return tableAdapterView.tableView(tableView, commit: editingStyle, forRowAt: indexPath)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Collection Delegate
|
||||
|
||||
@available(iOS 13.0, *)
|
||||
extension ContainerController: UICollectionViewDelegate {
|
||||
|
||||
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
|
||||
public func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
|
||||
if let collectionAdapterView = scrollView as? CollectionAdapterView {
|
||||
collectionAdapterView.collectionView(collectionView, didSelectItemAt: indexPath)
|
||||
}
|
||||
@@ -1153,16 +1167,17 @@ extension ContainerController: UICollectionViewDelegate {
|
||||
|
||||
// MARK: - Collection DataSource
|
||||
|
||||
@available(iOS 13.0, *)
|
||||
extension ContainerController: UICollectionViewDataSource {
|
||||
|
||||
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
|
||||
public func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
|
||||
if let collectionAdapterView = scrollView as? CollectionAdapterView {
|
||||
return collectionAdapterView.collectionView(collectionView, numberOfItemsInSection: section)
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
|
||||
public func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
|
||||
if let collectionAdapterView = scrollView as? CollectionAdapterView {
|
||||
return collectionAdapterView.collectionView(collectionView, cellForItemAt: indexPath)
|
||||
}
|
||||
@@ -1172,6 +1187,7 @@ extension ContainerController: UICollectionViewDataSource {
|
||||
|
||||
// MARK: - Collection DelegateFlowLayout
|
||||
|
||||
@available(iOS 13.0, *)
|
||||
extension ContainerController: UICollectionViewDelegateFlowLayout {
|
||||
|
||||
public func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
|
||||
@@ -1184,9 +1200,10 @@ extension ContainerController: UICollectionViewDelegateFlowLayout {
|
||||
|
||||
// MARK: - Scroll Delegate
|
||||
|
||||
@available(iOS 13.0, *)
|
||||
extension ContainerController: UIScrollViewDelegate {
|
||||
|
||||
func scrollViewDidScroll(_ scrollView: UIScrollView) {
|
||||
public func scrollViewDidScroll(_ scrollView: UIScrollView) {
|
||||
|
||||
if let tableAdapterView = scrollView as? TableAdapterView {
|
||||
tableAdapterView.scrollViewDidScroll(tableAdapterView)
|
||||
@@ -1296,7 +1313,7 @@ extension ContainerController: UIScrollViewDelegate {
|
||||
|
||||
// MARK: - Scroll Begin/End Dragging
|
||||
|
||||
func scrollViewWillBeginDragging(_ scrollView: UIScrollView) {
|
||||
public func scrollViewWillBeginDragging(_ scrollView: UIScrollView) {
|
||||
|
||||
isScrolling = true
|
||||
|
||||
@@ -1309,11 +1326,11 @@ extension ContainerController: UIScrollViewDelegate {
|
||||
}
|
||||
}
|
||||
|
||||
func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
|
||||
public func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
|
||||
isScrolling = false
|
||||
}
|
||||
|
||||
func scrollViewDidEndDragging(_ scrollView: UIScrollView, willDecelerate decelerate: Bool) {
|
||||
public func scrollViewDidEndDragging(_ scrollView: UIScrollView, willDecelerate decelerate: Bool) {
|
||||
|
||||
if !decelerate {
|
||||
isScrolling = false
|
||||
+5
-3
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// ContainerView.swift
|
||||
// ContainerControllerDelegate.swift
|
||||
// PatternsSwift
|
||||
//
|
||||
// Created by mrustaa on 21/04/2020.
|
||||
@@ -8,7 +8,8 @@
|
||||
|
||||
import UIKit
|
||||
|
||||
protocol ContainerControllerDelegate {
|
||||
@available(iOS 13.0, *)
|
||||
public protocol ContainerControllerDelegate {
|
||||
|
||||
/// Reports rotation and orientation changes
|
||||
func containerControllerRotation(_ containerController: ContainerController)
|
||||
@@ -21,7 +22,8 @@ protocol ContainerControllerDelegate {
|
||||
|
||||
}
|
||||
|
||||
extension ContainerControllerDelegate {
|
||||
@available(iOS 13.0, *)
|
||||
public extension ContainerControllerDelegate {
|
||||
|
||||
func containerControllerRotation(_ containerController: ContainerController) {
|
||||
}
|
||||
+28
-15
@@ -1,18 +1,23 @@
|
||||
|
||||
//
|
||||
// ContainerDevice.swift
|
||||
// PatternsSwift
|
||||
//
|
||||
// Created by mrustaa on 21/04/2020.
|
||||
// Copyright © 2020 mrustaa. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
|
||||
|
||||
extension ContainerDevice {
|
||||
|
||||
public enum Orientation {
|
||||
@available(iOS 13.0, *)
|
||||
public extension ContainerDevice {
|
||||
enum Orientation {
|
||||
case portrait
|
||||
case landscapeLeft
|
||||
case landscapeRight
|
||||
}
|
||||
}
|
||||
|
||||
@available(iOS 13.0, *)
|
||||
open class ContainerDevice {
|
||||
|
||||
// MARK: - Size
|
||||
@@ -58,12 +63,8 @@ open class ContainerDevice {
|
||||
|
||||
class public var statusBarHeight: CGFloat {
|
||||
var height: CGFloat = 0
|
||||
if #available(iOS 13.0, *) {
|
||||
let window = UIApplication.shared.windows.filter {$0.isKeyWindow}.first
|
||||
height = window?.windowScene?.statusBarManager?.statusBarFrame.height ?? 0
|
||||
} else {
|
||||
height = UIApplication.shared.statusBarFrame.height
|
||||
}
|
||||
let window = UIApplication.shared.windows.filter {$0.isKeyWindow}.first
|
||||
height = window?.windowScene?.statusBarManager?.statusBarFrame.height ?? 0
|
||||
return height
|
||||
}
|
||||
|
||||
@@ -83,7 +84,7 @@ open class ContainerDevice {
|
||||
switch UIDevice.current.orientation {
|
||||
case .landscapeLeft, .landscapeRight:
|
||||
portrait = false
|
||||
case .portrait, .portraitUpsideDown:
|
||||
case .portrait:
|
||||
portrait = true
|
||||
default: break
|
||||
}
|
||||
@@ -118,6 +119,18 @@ open class ContainerDevice {
|
||||
return .landscapeLeft
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public extension UIDeviceOrientation {
|
||||
|
||||
var isRotateAllowed: Bool {
|
||||
return !(face || self == .portraitUpsideDown)
|
||||
}
|
||||
|
||||
var face: Bool {
|
||||
switch self {
|
||||
case .faceUp, .faceDown: return true
|
||||
default: return false
|
||||
}
|
||||
}
|
||||
}
|
||||
+27
-23
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// ContainerView.swift
|
||||
// ContainerLayout.swift
|
||||
// PatternsSwift
|
||||
//
|
||||
// Created by mrustaa on 21/04/2020.
|
||||
@@ -10,17 +10,17 @@ import UIKit
|
||||
|
||||
// MARK: - Position
|
||||
|
||||
class ContainerPosition {
|
||||
open class ContainerPosition {
|
||||
|
||||
var top: CGFloat
|
||||
public var top: CGFloat
|
||||
|
||||
var middle: CGFloat?
|
||||
public var middle: CGFloat?
|
||||
|
||||
var bottom: CGFloat
|
||||
public var bottom: CGFloat
|
||||
|
||||
static let zero = ContainerPosition(top: 0, bottom: 0)
|
||||
|
||||
init(top: CGFloat, middle: CGFloat? = nil, bottom: CGFloat) {
|
||||
public init(top: CGFloat, middle: CGFloat? = nil, bottom: CGFloat) {
|
||||
self.top = top
|
||||
self.middle = middle
|
||||
self.bottom = bottom
|
||||
@@ -30,15 +30,15 @@ class ContainerPosition {
|
||||
|
||||
// MARK: - Insets
|
||||
|
||||
struct ContainerInsets {
|
||||
public struct ContainerInsets {
|
||||
|
||||
var right: CGFloat
|
||||
public var right: CGFloat
|
||||
|
||||
var left: CGFloat
|
||||
public var left: CGFloat
|
||||
|
||||
static let zero = ContainerInsets(right: 0, left: 0)
|
||||
|
||||
init(right: CGFloat, left: CGFloat) {
|
||||
public init(right: CGFloat, left: CGFloat) {
|
||||
self.right = right
|
||||
self.left = left
|
||||
}
|
||||
@@ -46,75 +46,79 @@ struct ContainerInsets {
|
||||
|
||||
// MARK: - Layout
|
||||
|
||||
class ContainerLayout {
|
||||
open class ContainerLayout {
|
||||
|
||||
/**
|
||||
Initialization start position.
|
||||
*/
|
||||
var startPosition: ContainerMoveType = .hide
|
||||
public var startPosition: ContainerMoveType = .hide
|
||||
|
||||
/**
|
||||
Disables any moving with gestures.
|
||||
*/
|
||||
var movingEnabled: Bool = true
|
||||
public var movingEnabled: Bool = true
|
||||
|
||||
/**
|
||||
This is parameters for control footerView.
|
||||
Padding-top from containerView, if headerView is added, then its + height is summed.
|
||||
*/
|
||||
var footerPadding: CGFloat = 0.0
|
||||
public var footerPadding: CGFloat = 0.0
|
||||
|
||||
/**
|
||||
This is parameters for control FooterView.
|
||||
Tracking position ContainerView during animated movement.
|
||||
*/
|
||||
var trackingPosition: Bool = false
|
||||
public var trackingPosition: Bool = false
|
||||
|
||||
/**
|
||||
This is parameter contentInsets for transmission scrollView added containerView.
|
||||
*/
|
||||
var scrollInsets: UIEdgeInsets = UIEdgeInsets.zero
|
||||
public var scrollInsets: UIEdgeInsets = UIEdgeInsets.zero
|
||||
|
||||
/**
|
||||
This is parameter scrollIndicatorInsets for transmission scrollView added containerView.
|
||||
*/
|
||||
var scrollIndicatorInsets: UIEdgeInsets = UIEdgeInsets.zero
|
||||
public var scrollIndicatorInsets: UIEdgeInsets = UIEdgeInsets.zero
|
||||
|
||||
/**
|
||||
This parameter for portrait orientation.
|
||||
Sets the background shadow under container.
|
||||
*/
|
||||
var backgroundShadowShow: Bool = false
|
||||
public var backgroundShadowShow: Bool = false
|
||||
|
||||
/**
|
||||
This parameter for Portrait orientation
|
||||
Sets the new value for positions of animated movement (top, middle, bottom).
|
||||
*/
|
||||
var positions: ContainerPosition = ContainerPosition.zero
|
||||
public var positions: ContainerPosition = ContainerPosition.zero
|
||||
|
||||
/**
|
||||
This parameter for Portrait orientation.
|
||||
Insets for containerView (left, right).
|
||||
*/
|
||||
var insets: ContainerInsets = ContainerInsets.zero
|
||||
public var insets: ContainerInsets = ContainerInsets.zero
|
||||
|
||||
/**
|
||||
This parameter for Landscape orientation.
|
||||
Sets the background shadow under container. (Default: portrait backgroundShadowShow).
|
||||
*/
|
||||
var landscapeBackgroundShadowShow: Bool?
|
||||
public var landscapeBackgroundShadowShow: Bool?
|
||||
|
||||
/**
|
||||
This parameter for Landscape orientation.
|
||||
Sets the new value for positions of animated movement (top, middle, bottom). (Default: portrait positions).
|
||||
*/
|
||||
var landscapePositions: ContainerPosition?
|
||||
public var landscapePositions: ContainerPosition?
|
||||
|
||||
/**
|
||||
This parameter for Landscape orientation.
|
||||
Insets for containerView (left, right). (Default: portrait insets).
|
||||
*/
|
||||
var landscapeInsets: ContainerInsets?
|
||||
public var landscapeInsets: ContainerInsets?
|
||||
|
||||
public init() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+7
-7
@@ -2,18 +2,18 @@
|
||||
// TableAdapterCell.swift
|
||||
// PatternsSwift
|
||||
//
|
||||
// Created by Рустам Мотыгуллин on 17/04/2020.
|
||||
// Copyright © 2020 mrusta. All rights reserved.
|
||||
// Created by mrustaa on 17/04/2020.
|
||||
// Copyright © 2020 mrustaa. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class TableAdapterCell: UITableViewCell {
|
||||
open class TableAdapterCell: UITableViewCell {
|
||||
|
||||
@IBInspectable var hideAnimation: Bool = false
|
||||
var selectedView: UIView?
|
||||
open var selectedView: UIView?
|
||||
|
||||
var cellData: TableAdapterCellData?
|
||||
public var cellData: TableAdapterCellData?
|
||||
|
||||
public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
|
||||
super.init(style: style, reuseIdentifier: reuseIdentifier)
|
||||
@@ -35,7 +35,7 @@ class TableAdapterCell: UITableViewCell {
|
||||
|
||||
let selAlpha: CGFloat = 0.2 // 0.15
|
||||
|
||||
override func setSelected(_ selected: Bool, animated: Bool) {
|
||||
open override func setSelected(_ selected: Bool, animated: Bool) {
|
||||
|
||||
if hideAnimation {
|
||||
|
||||
@@ -65,7 +65,7 @@ class TableAdapterCell: UITableViewCell {
|
||||
|
||||
}
|
||||
|
||||
override func setHighlighted(_ highlighted: Bool, animated: Bool) {
|
||||
open override func setHighlighted(_ highlighted: Bool, animated: Bool) {
|
||||
|
||||
if hideAnimation {
|
||||
if highlighted {
|
||||
@@ -0,0 +1,21 @@
|
||||
//
|
||||
// TableAdapterCellData.swift
|
||||
// PatternsSwift
|
||||
//
|
||||
// Created by mrustaa on 17/04/2020.
|
||||
// Copyright © 2020 mrustaa. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
open class TableAdapterCellData: NSObject {
|
||||
|
||||
open func cellHeight() -> CGFloat {
|
||||
return UITableView.automaticDimension
|
||||
}
|
||||
|
||||
open func canEditing() -> Bool {
|
||||
return false
|
||||
}
|
||||
|
||||
}
|
||||
+5
-5
@@ -2,13 +2,13 @@
|
||||
// TableAdapterItem.swift
|
||||
// PatternsSwift
|
||||
//
|
||||
// Created by Рустам Мотыгуллин on 17/04/2020.
|
||||
// Copyright © 2020 mrusta. All rights reserved.
|
||||
// Created by mrustaa on 17/04/2020.
|
||||
// Copyright © 2020 mrustaa. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class TableAdapterItem: NSObject {
|
||||
open class TableAdapterItem: NSObject {
|
||||
|
||||
public let cellClass: AnyClass
|
||||
|
||||
@@ -18,7 +18,7 @@ class TableAdapterItem: NSObject {
|
||||
return String(describing: cellClass)
|
||||
}
|
||||
|
||||
init(cellClass: AnyClass, cellData: TableAdapterCellData? = nil) {
|
||||
public init(cellClass: AnyClass, cellData: TableAdapterCellData? = nil) {
|
||||
self.cellClass = cellClass
|
||||
self.cellData = cellData
|
||||
}
|
||||
@@ -27,7 +27,7 @@ class TableAdapterItem: NSObject {
|
||||
return cellData?.cellHeight() ?? UITableView.automaticDimension
|
||||
}
|
||||
|
||||
func canEditing() -> Bool {
|
||||
public func canEditing() -> Bool {
|
||||
return cellData?.canEditing() ?? false
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// TableAdapterTypes.swift
|
||||
// PatternsSwift
|
||||
//
|
||||
// Created by mrustaa on 21/04/2020.
|
||||
// Copyright © 2020 mrustaa. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
public typealias TableAdapterCountCallback = () -> Int
|
||||
public typealias TableAdapterCellIndexCallback = (_ index: Int) -> UITableViewCell
|
||||
public typealias TableAdapterHeightIndexCallback = (_ index: Int) -> CGFloat
|
||||
public typealias TableAdapterSelectIndexCallback = (_ index: Int) -> ()
|
||||
public typealias TableAdapterDidScrollCallback = () -> ()
|
||||
public typealias TableAdapterDeleteIndexCallback = (_ index: Int) -> ()
|
||||
+22
-22
@@ -1,44 +1,44 @@
|
||||
//
|
||||
// BlockTableView.swift
|
||||
// TableAdapterView.swift
|
||||
// PatternsSwift
|
||||
//
|
||||
// Created by Рустам Мотыгуллин on 16/04/2020.
|
||||
// Copyright © 2020 mrusta. All rights reserved.
|
||||
// Created by mrustaa on 16/04/2020.
|
||||
// Copyright © 2020 mrustaa. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class TableAdapterView: UITableView {
|
||||
open class TableAdapterView: UITableView {
|
||||
|
||||
@IBInspectable var separatorClr: UIColor?
|
||||
|
||||
var countCallback: TableAdapterCountCallback?
|
||||
var cellIndexCallback: TableAdapterCellIndexCallback?
|
||||
var heightIndexCallback: TableAdapterHeightIndexCallback?
|
||||
var selectIndexCallback: TableAdapterSelectIndexCallback?
|
||||
var deleteIndexCallback: TableAdapterDeleteIndexCallback?
|
||||
var didScrollCallback: TableAdapterDidScrollCallback?
|
||||
public var countCallback: TableAdapterCountCallback?
|
||||
public var cellIndexCallback: TableAdapterCellIndexCallback?
|
||||
public var heightIndexCallback: TableAdapterHeightIndexCallback?
|
||||
public var selectIndexCallback: TableAdapterSelectIndexCallback?
|
||||
public var deleteIndexCallback: TableAdapterDeleteIndexCallback?
|
||||
public var didScrollCallback: TableAdapterDidScrollCallback?
|
||||
|
||||
|
||||
var items: [TableAdapterItem] = []
|
||||
public var items: [TableAdapterItem] = []
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
required public init?(coder: NSCoder) {
|
||||
super.init(coder: coder)
|
||||
update()
|
||||
}
|
||||
|
||||
override init(frame: CGRect, style: UITableView.Style) {
|
||||
public override init(frame: CGRect, style: UITableView.Style) {
|
||||
super.init(frame: frame, style: style)
|
||||
update()
|
||||
}
|
||||
|
||||
override func draw(_ rect: CGRect) {
|
||||
open override func draw(_ rect: CGRect) {
|
||||
if let color = separatorClr {
|
||||
separatorColor = color
|
||||
}
|
||||
}
|
||||
|
||||
func update() {
|
||||
public func update() {
|
||||
delegate = self
|
||||
dataSource = self
|
||||
|
||||
@@ -46,7 +46,7 @@ class TableAdapterView: UITableView {
|
||||
backgroundColor = .clear
|
||||
}
|
||||
|
||||
func set(items: [TableAdapterItem], animated: Bool = false, reload: Bool = true) {
|
||||
public func set(items: [TableAdapterItem], animated: Bool = false, reload: Bool = true) {
|
||||
self.clear()
|
||||
items.forEach {
|
||||
self.unsafeAdd(item: $0)
|
||||
@@ -96,7 +96,7 @@ class TableAdapterView: UITableView {
|
||||
|
||||
extension TableAdapterView: UITableViewDataSource {
|
||||
|
||||
/// колличество
|
||||
/// count
|
||||
public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
||||
if !items.isEmpty {
|
||||
return items.count
|
||||
@@ -107,7 +107,7 @@ extension TableAdapterView: UITableViewDataSource {
|
||||
return 0
|
||||
}
|
||||
|
||||
/// ячейка
|
||||
/// cell
|
||||
public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
||||
if !items.isEmpty {
|
||||
let item = items[indexPath.row]
|
||||
@@ -122,7 +122,7 @@ extension TableAdapterView: UITableViewDataSource {
|
||||
}
|
||||
|
||||
|
||||
func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
|
||||
public func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
|
||||
if !items.isEmpty {
|
||||
let item = items[indexPath.row]
|
||||
return item.canEditing()
|
||||
@@ -130,7 +130,7 @@ extension TableAdapterView: UITableViewDataSource {
|
||||
return false
|
||||
}
|
||||
|
||||
func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) {
|
||||
public func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) {
|
||||
if editingStyle == .delete {
|
||||
|
||||
items.remove(at: indexPath.row)
|
||||
@@ -147,7 +147,7 @@ extension TableAdapterView: UITableViewDataSource {
|
||||
|
||||
extension TableAdapterView: UITableViewDelegate {
|
||||
|
||||
/// высота
|
||||
/// height
|
||||
public func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
|
||||
if !items.isEmpty {
|
||||
return items[indexPath.row].height()
|
||||
@@ -158,7 +158,7 @@ extension TableAdapterView: UITableViewDelegate {
|
||||
return 0
|
||||
}
|
||||
|
||||
/// нажал
|
||||
/// select
|
||||
public func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
|
||||
tableView.deselectRow(at: indexPath, animated: true)
|
||||
selectIndexCallback?(indexPath.row)
|
||||
+3
-1
@@ -6,6 +6,8 @@
|
||||
// Copyright © 2020 mrustaa. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
typealias ContainerCompletion = () -> Void
|
||||
|
||||
public enum ContainerMoveType {
|
||||
@@ -16,7 +18,7 @@ public enum ContainerMoveType {
|
||||
case custom
|
||||
}
|
||||
|
||||
enum ContainerFromType {
|
||||
public enum ContainerFromType {
|
||||
case pan
|
||||
case scroll
|
||||
case scrollBorder
|
||||
+12
-11
@@ -8,15 +8,16 @@
|
||||
|
||||
import UIKit
|
||||
|
||||
class ContainerView: UIView {
|
||||
@available(iOS 13.0, *)
|
||||
open class ContainerView: UIView {
|
||||
|
||||
var contentView: UIView?
|
||||
public var contentView: UIView?
|
||||
|
||||
var visualEffectView: UIVisualEffectView?
|
||||
public var visualEffectView: UIVisualEffectView?
|
||||
|
||||
// MARK: CornerRadius
|
||||
|
||||
var cornerRadius: CGFloat = 0 {
|
||||
public var cornerRadius: CGFloat = 0 {
|
||||
didSet {
|
||||
let r = radius()
|
||||
layer.cornerRadius = r
|
||||
@@ -26,7 +27,7 @@ class ContainerView: UIView {
|
||||
}
|
||||
}
|
||||
|
||||
func radius() -> CGFloat {
|
||||
public func radius() -> CGFloat {
|
||||
let minSize = min(frame.width, frame.height)
|
||||
let radius = (((minSize / 2) < cornerRadius) ? (minSize / 2) : cornerRadius)
|
||||
return radius
|
||||
@@ -34,7 +35,7 @@ class ContainerView: UIView {
|
||||
|
||||
// MARK: Init
|
||||
|
||||
override init(frame: CGRect) {
|
||||
public override init(frame: CGRect) {
|
||||
super.init(frame: frame)
|
||||
|
||||
let contentView = UIView(frame: CGRect(x: 0, y: 0, width: frame.width, height: frame.height))
|
||||
@@ -44,13 +45,13 @@ class ContainerView: UIView {
|
||||
self.contentView = contentView
|
||||
}
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
required public init?(coder: NSCoder) {
|
||||
super.init(coder: coder)
|
||||
}
|
||||
|
||||
// MARK: Add Custom Shadow
|
||||
|
||||
func addShadow(opacity: CGFloat = 0.1) {
|
||||
public func addShadow(opacity: CGFloat = 0.1) {
|
||||
layer.shadowOpacity = Float(opacity)
|
||||
layer.shadowColor = UIColor.black.cgColor
|
||||
layer.shadowRadius = 3
|
||||
@@ -58,13 +59,13 @@ class ContainerView: UIView {
|
||||
|
||||
// MARK: Add Blur
|
||||
|
||||
func addBlur(darkStyle: Bool) {
|
||||
public func addBlur(darkStyle: Bool) {
|
||||
let style: UIBlurEffect.Style = darkStyle ? .systemThinMaterialDark : .systemChromeMaterialLight
|
||||
backgroundColor = .clear
|
||||
addBlur(style: style)
|
||||
}
|
||||
|
||||
func addBlur(style: UIBlurEffect.Style) {
|
||||
public func addBlur(style: UIBlurEffect.Style) {
|
||||
|
||||
if visualEffectView == nil {
|
||||
let blurView = UIVisualEffectView(effect: UIBlurEffect(style: style))
|
||||
@@ -84,7 +85,7 @@ class ContainerView: UIView {
|
||||
|
||||
// MARK: Remove Blur
|
||||
|
||||
func removeBlur() {
|
||||
public func removeBlur() {
|
||||
if let visualEffectView = visualEffectView {
|
||||
visualEffectView.removeFromSuperview()
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import XCTest
|
||||
@testable import ContainerController
|
||||
|
||||
final class ContainerControllerTests: XCTestCase {
|
||||
func testExample() {
|
||||
// This is an example of a functional test case.
|
||||
// Use XCTAssert and related functions to verify your tests produce the correct
|
||||
// results.
|
||||
// XCTAssertEqual(ContainerController().text, "Hello, World!")
|
||||
}
|
||||
|
||||
static var allTests = [
|
||||
("testExample", testExample),
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import XCTest
|
||||
|
||||
#if !canImport(ObjectiveC)
|
||||
public func allTests() -> [XCTestCaseEntry] {
|
||||
return [
|
||||
testCase(ContainerControllerTests.allTests),
|
||||
]
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,7 @@
|
||||
import XCTest
|
||||
|
||||
import ContainerControllerTests
|
||||
|
||||
var tests = [XCTestCaseEntry]()
|
||||
tests += ContainerControllerTests.allTests()
|
||||
XCTMain(tests)
|
||||
@@ -1 +0,0 @@
|
||||
Example/Pods/Pods.xcodeproj
|
||||
Reference in New Issue
Block a user