Compare commits
65 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1b16b2bb74 | |||
| 32c45514c8 | |||
| e73f58ced5 | |||
| 54b73d3cc0 | |||
| 8fc34e8d12 | |||
| 6af9321ea9 | |||
| 1584281c41 | |||
| 5ac3f8ae18 | |||
| 5d93293649 | |||
| a4f113d066 | |||
| 41436d8083 | |||
| 22785514bd | |||
| d8f6836c0f | |||
| 20ea9e3e1c | |||
| 64dee3b6bc | |||
| 911d0c5df8 | |||
| cc85786658 | |||
| 3b695da3ee | |||
| 5a73ca4c6b | |||
| 90d31b75ca | |||
| 9d6d6e3798 | |||
| 81e13530aa | |||
| f11af83808 | |||
| 162f6d29c3 | |||
| cb97450102 | |||
| 9de5f16735 | |||
| 418da11c82 | |||
| 90fe59ffc6 | |||
| 422b23b4c2 | |||
| 08a4c284f4 | |||
| b775f12fe5 | |||
| 9f75ddffdf | |||
| 225fac033a | |||
| fe3229278d | |||
| de0d273258 | |||
| d1231f19ff | |||
| 20f927f338 | |||
| 8144d96129 | |||
| 0d9e3ef7ab | |||
| 888067cae0 | |||
| 0180ca76c7 | |||
| 951b95b0fb | |||
| 1803722b6a | |||
| 4f5ee72f97 | |||
| 9e17ebb58f | |||
| 28acb5a8d6 | |||
| 5c6fa430e0 | |||
| 5108f3651f | |||
| 05ec840ffd | |||
| 5189d880c4 | |||
| 308051a898 | |||
| 56481d5f8a | |||
| 3882befd7b | |||
| cf88115eb6 | |||
| 663bafce52 | |||
| 6911104a98 | |||
| 369252ee7c | |||
| 3322107688 | |||
| 7731adc79c | |||
| 5c48b2482a | |||
| 83416d6870 | |||
| 4f9540b4df | |||
| 304c3e61f6 | |||
| 026153f502 | |||
| 6e53ee01c7 |
+1
-1
@@ -1 +1 @@
|
||||
4.0
|
||||
4.2
|
||||
|
||||
@@ -41,4 +41,7 @@ variable_name:
|
||||
- id
|
||||
- URL
|
||||
- GlobalAPIKey
|
||||
- i
|
||||
- lb
|
||||
- rb
|
||||
reporter: "xcode" # reporter type (xcode, json, csv, checkstyle)
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
github "hyperoslo/Hue" ~> 3.0
|
||||
github "hyperoslo/Imaginary" ~> 3.0
|
||||
github "hyperoslo/Imaginary" ~> 4.0
|
||||
+2
-4
@@ -1,4 +1,2 @@
|
||||
github "hyperoslo/Cache" "4.0.2"
|
||||
github "hyperoslo/Hue" "3.0.0"
|
||||
github "hyperoslo/Imaginary" "3.0.0"
|
||||
github "onmyway133/SwiftHash" "2.0.1"
|
||||
github "hyperoslo/Cache" "5.2.0"
|
||||
github "hyperoslo/Imaginary" "4.2.0"
|
||||
|
||||
@@ -56,7 +56,9 @@
|
||||
B1B2B3DADEEC7FD14D4A9FF8 /* Frameworks */,
|
||||
0C8887567644E86396B8D885 /* Pods */,
|
||||
);
|
||||
indentWidth = 4;
|
||||
sourceTree = "<group>";
|
||||
tabWidth = 4;
|
||||
};
|
||||
29B4A42A1C43A4320060ED52 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
@@ -99,7 +101,6 @@
|
||||
29B4A4261C43A4320060ED52 /* Frameworks */,
|
||||
29B4A4271C43A4320060ED52 /* Resources */,
|
||||
F162948C45248BBD677112BF /* [CP] Embed Pods Frameworks */,
|
||||
D1AB0C213924D367899FA1A2 /* [CP] Copy Pods Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
@@ -117,7 +118,7 @@
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastSwiftUpdateCheck = 0720;
|
||||
LastUpgradeCheck = 0900;
|
||||
LastUpgradeCheck = 1000;
|
||||
ORGANIZATIONNAME = "Hyper Interaktiv AS";
|
||||
TargetAttributes = {
|
||||
29B4A4281C43A4320060ED52 = {
|
||||
@@ -176,45 +177,26 @@
|
||||
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;
|
||||
};
|
||||
D1AB0C213924D367899FA1A2 /* [CP] Copy Pods Resources */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "[CP] Copy Pods Resources";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-DemoLightbox/Pods-DemoLightbox-resources.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
F162948C45248BBD677112BF /* [CP] Embed Pods Frameworks */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${SRCROOT}/Pods/Target Support Files/Pods-DemoLightbox/Pods-DemoLightbox-frameworks.sh",
|
||||
"${PODS_ROOT}/Target Support Files/Pods-DemoLightbox/Pods-DemoLightbox-frameworks.sh",
|
||||
"${BUILT_PRODUCTS_DIR}/Cache/Cache.framework",
|
||||
"${BUILT_PRODUCTS_DIR}/Hue/Hue.framework",
|
||||
"${BUILT_PRODUCTS_DIR}/Imaginary/Imaginary.framework",
|
||||
"${BUILT_PRODUCTS_DIR}/Lightbox/Lightbox.framework",
|
||||
"${BUILT_PRODUCTS_DIR}/SwiftHash/SwiftHash.framework",
|
||||
);
|
||||
name = "[CP] Embed Pods Frameworks";
|
||||
outputPaths = (
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Cache.framework",
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Hue.framework",
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Imaginary.framework",
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Lightbox.framework",
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SwiftHash.framework",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-DemoLightbox/Pods-DemoLightbox-frameworks.sh\"\n";
|
||||
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-DemoLightbox/Pods-DemoLightbox-frameworks.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
@@ -255,12 +237,14 @@
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = 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_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
@@ -292,7 +276,7 @@
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 4.0;
|
||||
SWIFT_VERSION = 4.2;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@@ -308,12 +292,14 @@
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = 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_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
@@ -338,7 +324,7 @@
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
|
||||
SWIFT_VERSION = 4.0;
|
||||
SWIFT_VERSION = 4.2;
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
name = Release;
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<?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>
|
||||
@@ -7,7 +7,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
||||
|
||||
var window: UIWindow?
|
||||
|
||||
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
|
||||
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
|
||||
window = UIWindow()
|
||||
window?.rootViewController = controller
|
||||
window?.makeKeyAndVisible()
|
||||
|
||||
@@ -6,18 +6,18 @@ class ViewController: UIViewController {
|
||||
lazy var showButton: UIButton = { [unowned self] in
|
||||
let button = UIButton()
|
||||
button.addTarget(self, action: #selector(showLightbox), for: .touchUpInside)
|
||||
button.setTitle("Show me the lightbox", for: UIControlState())
|
||||
button.setTitleColor(UIColor(red:0.47, green:0.6, blue:0.13, alpha:1), for: UIControlState())
|
||||
button.setTitle("Show me the lightbox", for: UIControl.State())
|
||||
button.setTitleColor(UIColor(red:0.47, green:0.6, blue:0.13, alpha:1), for: UIControl.State())
|
||||
button.titleLabel?.font = UIFont(name: "AvenirNextCondensed-DemiBold", size: 30)
|
||||
button.frame = UIScreen.main.bounds
|
||||
button.autoresizingMask = [.flexibleTopMargin, .flexibleLeftMargin, .flexibleRightMargin, .flexibleBottomMargin]
|
||||
|
||||
return button
|
||||
}()
|
||||
}()
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
|
||||
view.autoresizingMask = [.flexibleTopMargin, .flexibleLeftMargin, .flexibleRightMargin, .flexibleBottomMargin]
|
||||
view.backgroundColor = UIColor.white
|
||||
view.addSubview(showButton)
|
||||
@@ -30,16 +30,16 @@ class ViewController: UIViewController {
|
||||
LightboxImage(imageURL: URL(string: "https://cdn.arstechnica.net/2011/10/05/iphone4s_sample_apple-4e8c706-intro.jpg")!),
|
||||
LightboxImage(
|
||||
image: UIImage(named: "photo1")!,
|
||||
text: "Some very long lorem ipsum text. Some very long lorem ipsum text. Some very long lorem ipsum text. Some very long lorem ipsum text"
|
||||
text: "Photography is the science, art, application and practice of creating durable images by recording light or other electromagnetic radiation, either electronically by means of an image sensor, or chemically by means of a light-sensitive material such as photographic film"
|
||||
),
|
||||
LightboxImage(
|
||||
image: UIImage(named: "photo2")!,
|
||||
text: "🌲 🌲 🌲 🌲 🌲 🌲 🌲 🌲 🌲 🌲 🌲 🏃 🌲 🏃♀️ 🌲 🌲 🌲 🌲 🌲 🌲 🌲 🌲\n\nSuspendisse massa massa, maximus et finibus ac, auctor volutpat diam.\n\nPellentesque consequat magna condimentum mauris bibendum, nec ornare nisl hendrerit. Phasellus nec ultrices sem. Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n\nSuspendisse sit amet facilisis ante, ac suscipit sem. Integer feugiat sit amet erat sit amet mattis. Donec tristique, nunc ut varius elementum, nisi elit viverra ipsum, vitae aliquam justo libero in arcu. Quisque tempor et justo at malesuada. Curabitur justo dolor, ornare convallis sollicitudin sed, consectetur eu turpis. \n\nNulla et dui condimentum, laoreet lacus eu, ultrices nisl. Vivamus in ante volutpat, gravida nunc scelerisque, sagittis tellus. Nullam justo purus, sagittis a tincidunt a, maximus nec sem.",
|
||||
text: "Emoji 😍 (/ɪˈmoʊdʒi/; singular emoji, plural emoji or emojis;[4] from the Japanese 絵文字えもじ, pronounced [emodʑi]) are ideograms and smileys used in electronic messages and web pages. Emoji are used much like emoticons and exist in various genres, including facial expressions, common objects, places and types of weather 🌅☔️💦, and animals 🐶🐱",
|
||||
videoURL: URL(string: "https://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4")
|
||||
),
|
||||
LightboxImage(
|
||||
image: UIImage(named: "photo3")!,
|
||||
text: "Some very long lorem ipsum text."
|
||||
text: "A lightbox is a translucent surface illuminated from behind, used for situations where a shape laid upon the surface needs to be seen with high contrast."
|
||||
)
|
||||
]
|
||||
|
||||
|
||||
@@ -1,28 +1,27 @@
|
||||
PODS:
|
||||
- Cache (4.0.2):
|
||||
- SwiftHash (~> 2.0.0)
|
||||
- Hue (3.0.0)
|
||||
- Imaginary (3.0.0):
|
||||
- Cache (~> 4.0)
|
||||
- Lightbox (2.0.0):
|
||||
- Hue (~> 3.0)
|
||||
- Imaginary (~> 3.0)
|
||||
- SwiftHash (2.0.0)
|
||||
- Cache (5.2.0)
|
||||
- Imaginary (4.2.0):
|
||||
- Cache (~> 5.0)
|
||||
- Lightbox (2.2.0):
|
||||
- Imaginary (~> 4.0)
|
||||
|
||||
DEPENDENCIES:
|
||||
- Lightbox (from `../../`)
|
||||
|
||||
SPEC REPOS:
|
||||
https://github.com/cocoapods/specs.git:
|
||||
- Cache
|
||||
- Imaginary
|
||||
|
||||
EXTERNAL SOURCES:
|
||||
Lightbox:
|
||||
:path: ../../
|
||||
:path: "../../"
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
Cache: 363b6899cee63c82ccbd291e64a6c202abc17a88
|
||||
Hue: b8fe1e43eef13631331eebecb2198b68e2622f95
|
||||
Imaginary: 2765d293d425cbed3b07fa11642554cbaebe913d
|
||||
Lightbox: f7f1cc942d81e84d85095531208f5fe1bfd9c639
|
||||
SwiftHash: d2e09b13495447178cdfb8e46e54a5c46f15f5a9
|
||||
Cache: 807c5d86d01a177f06ede9865add3aea269bbfd4
|
||||
Imaginary: dae33d06dbc2ada22f98afef5eb45cc061311a2c
|
||||
Lightbox: af4d61903506aa3151a314daa853f7cb3ad39301
|
||||
|
||||
PODFILE CHECKSUM: 408ae3477507a1d4b7ff06ffb3f162eda443424f
|
||||
|
||||
COCOAPODS: 1.3.1
|
||||
COCOAPODS: 1.6.0.beta.1
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 290 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 296 KiB |
@@ -0,0 +1,22 @@
|
||||
<?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>$(DEVELOPMENT_LANGUAGE)</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>BNDL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,13 @@
|
||||
import XCTest
|
||||
@testable import Lightbox
|
||||
|
||||
class InfoLabelTests: XCTestCase {
|
||||
func testTruncating() {
|
||||
let label = InfoLabel(text: "", expanded: false)
|
||||
label.frame.size = CGSize(width: 10, height: 10)
|
||||
|
||||
let text = Array(repeating: "A", count: 4).joined(separator: "")
|
||||
label.fullText = text
|
||||
_ = label.truncatedText
|
||||
}
|
||||
}
|
||||
+3
-4
@@ -1,7 +1,7 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = "Lightbox"
|
||||
s.summary = "A a convenient and easy to use image viewer for your iOS app, packed with all the features you expect"
|
||||
s.version = "2.0.0"
|
||||
s.version = "2.3.0"
|
||||
s.homepage = "https://github.com/hyperoslo/Lightbox"
|
||||
s.license = 'MIT'
|
||||
s.author = { "Hyper Interaktiv AS" => "ios@hyper.no" }
|
||||
@@ -13,8 +13,7 @@ Pod::Spec.new do |s|
|
||||
s.ios.resource = 'Resources/Lightbox.bundle'
|
||||
|
||||
s.frameworks = 'UIKit', 'AVFoundation', 'AVKit'
|
||||
s.dependency 'Hue', '~> 3.0'
|
||||
s.dependency 'Imaginary', '~> 3.0'
|
||||
s.dependency 'Imaginary', '~> 4.0'
|
||||
|
||||
s.pod_target_xcconfig = { 'SWIFT_VERSION' => '4.0' }
|
||||
s.pod_target_xcconfig = { 'SWIFT_VERSION' => '4.2' }
|
||||
end
|
||||
|
||||
@@ -7,7 +7,11 @@
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
166E3BA920333E04006799C1 /* LightboxImageStub.swift in Sources */ = {isa = PBXBuildFile; fileRef = 166E3BA820333E04006799C1 /* LightboxImageStub.swift */; };
|
||||
D22006741DFB4D9700E92898 /* Lightbox.bundle in Resources */ = {isa = PBXBuildFile; fileRef = D22006731DFB4D9700E92898 /* Lightbox.bundle */; };
|
||||
D2258CC4215CD035005A9A1C /* Color+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2258CC3215CD035005A9A1C /* Color+Extensions.swift */; };
|
||||
D229B5E61FC3123F00F04123 /* Lightbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D523B0A91C43AA2A001AD1EC /* Lightbox.framework */; };
|
||||
D229B5ED1FC3125D00F04123 /* InfoLabelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D229B5EC1FC3125D00F04123 /* InfoLabelTests.swift */; };
|
||||
D2A58F5E1F7943A30064F14E /* Imaginary.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D2A58F5D1F7943A30064F14E /* Imaginary.framework */; };
|
||||
D2D71BBC1D54DA77006AB907 /* AssetManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2D71BBB1D54DA77006AB907 /* AssetManager.swift */; };
|
||||
D5026B3C1C5BF3FD003BC1A3 /* LightboxImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5026B3B1C5BF3FD003BC1A3 /* LightboxImage.swift */; };
|
||||
@@ -15,7 +19,6 @@
|
||||
D523B0BE1C43AA8B001AD1EC /* LightboxController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D523B0B71C43AA8A001AD1EC /* LightboxController.swift */; };
|
||||
D54DFCBE1C5AAAD600ADEA0E /* InfoLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D54DFCBC1C5AAAD600ADEA0E /* InfoLabel.swift */; };
|
||||
D54DFCBF1C5AAAD600ADEA0E /* PageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D54DFCBD1C5AAAD600ADEA0E /* PageView.swift */; };
|
||||
D54DFCC21C5AAAF100ADEA0E /* Hue.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D54DFCC01C5AAAF100ADEA0E /* Hue.framework */; };
|
||||
D56F15C81E0AB79800F128AF /* LoadingIndicator.swift in Sources */ = {isa = PBXBuildFile; fileRef = D56F15C71E0AB79800F128AF /* LoadingIndicator.swift */; };
|
||||
D573A2F01C5B5605006053DD /* HeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D573A2EF1C5B5605006053DD /* HeaderView.swift */; };
|
||||
D573A2F31C5B5C7B006053DD /* LayoutConfigurable.swift in Sources */ = {isa = PBXBuildFile; fileRef = D573A2F21C5B5C7B006053DD /* LayoutConfigurable.swift */; };
|
||||
@@ -24,8 +27,23 @@
|
||||
D58A18CB1C5ABF8F000024BB /* FooterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D58A18CA1C5ABF8F000024BB /* FooterView.swift */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
D229B5E71FC3123F00F04123 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = D523B0A01C43AA2A001AD1EC /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = D523B0A81C43AA2A001AD1EC;
|
||||
remoteInfo = "Lightbox-iOS";
|
||||
};
|
||||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
166E3BA820333E04006799C1 /* LightboxImageStub.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LightboxImageStub.swift; sourceTree = "<group>"; };
|
||||
D22006731DFB4D9700E92898 /* Lightbox.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = Lightbox.bundle; sourceTree = "<group>"; };
|
||||
D2258CC3215CD035005A9A1C /* Color+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Color+Extensions.swift"; sourceTree = "<group>"; };
|
||||
D229B5E11FC3123F00F04123 /* Lightbox-iOS-Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Lightbox-iOS-Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
D229B5E51FC3123F00F04123 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
D229B5EC1FC3125D00F04123 /* InfoLabelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InfoLabelTests.swift; sourceTree = "<group>"; };
|
||||
D2A58F5D1F7943A30064F14E /* Imaginary.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Imaginary.framework; path = Carthage/Build/iOS/Imaginary.framework; sourceTree = "<group>"; };
|
||||
D2D71BBB1D54DA77006AB907 /* AssetManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AssetManager.swift; sourceTree = "<group>"; };
|
||||
D5026B3B1C5BF3FD003BC1A3 /* LightboxImage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LightboxImage.swift; sourceTree = "<group>"; };
|
||||
@@ -45,12 +63,19 @@
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
D229B5DE1FC3123F00F04123 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
D229B5E61FC3123F00F04123 /* Lightbox.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
D523B0A51C43AA2A001AD1EC /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
D2A58F5E1F7943A30064F14E /* Imaginary.framework in Frameworks */,
|
||||
D54DFCC21C5AAAF100ADEA0E /* Hue.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -65,6 +90,15 @@
|
||||
path = Resources;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
D229B5E21FC3123F00F04123 /* Lightbox-iOS-Tests */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
D229B5E51FC3123F00F04123 /* Info.plist */,
|
||||
D229B5EC1FC3125D00F04123 /* InfoLabelTests.swift */,
|
||||
);
|
||||
path = "Lightbox-iOS-Tests";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
D2A58F5C1F7943A30064F14E /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@@ -80,15 +114,19 @@
|
||||
D54DFCC01C5AAAF100ADEA0E /* Hue.framework */,
|
||||
D523B0B41C43AA8A001AD1EC /* Source */,
|
||||
D523B0AB1C43AA2A001AD1EC /* Lightbox */,
|
||||
D229B5E21FC3123F00F04123 /* Lightbox-iOS-Tests */,
|
||||
D523B0AA1C43AA2A001AD1EC /* Products */,
|
||||
D2A58F5C1F7943A30064F14E /* Frameworks */,
|
||||
);
|
||||
indentWidth = 4;
|
||||
sourceTree = "<group>";
|
||||
tabWidth = 4;
|
||||
};
|
||||
D523B0AA1C43AA2A001AD1EC /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
D523B0A91C43AA2A001AD1EC /* Lightbox.framework */,
|
||||
D229B5E11FC3123F00F04123 /* Lightbox-iOS-Tests.xctest */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
@@ -109,6 +147,7 @@
|
||||
D523B0B61C43AA8A001AD1EC /* LightboxConfig.swift */,
|
||||
D523B0B71C43AA8A001AD1EC /* LightboxController.swift */,
|
||||
D5026B3B1C5BF3FD003BC1A3 /* LightboxImage.swift */,
|
||||
166E3BA820333E04006799C1 /* LightboxImageStub.swift */,
|
||||
D2D71BBB1D54DA77006AB907 /* AssetManager.swift */,
|
||||
);
|
||||
path = Source;
|
||||
@@ -132,6 +171,7 @@
|
||||
D573A2F41C5B5CA4006053DD /* LightboxTransition.swift */,
|
||||
D573A2F21C5B5C7B006053DD /* LayoutConfigurable.swift */,
|
||||
D573A2F61C5B5E55006053DD /* UIView+Gradient.swift */,
|
||||
D2258CC3215CD035005A9A1C /* Color+Extensions.swift */,
|
||||
);
|
||||
path = Library;
|
||||
sourceTree = "<group>";
|
||||
@@ -149,6 +189,24 @@
|
||||
/* End PBXHeadersBuildPhase section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
D229B5E01FC3123F00F04123 /* Lightbox-iOS-Tests */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = D229B5E91FC3123F00F04123 /* Build configuration list for PBXNativeTarget "Lightbox-iOS-Tests" */;
|
||||
buildPhases = (
|
||||
D229B5DD1FC3123F00F04123 /* Sources */,
|
||||
D229B5DE1FC3123F00F04123 /* Frameworks */,
|
||||
D229B5DF1FC3123F00F04123 /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
D229B5E81FC3123F00F04123 /* PBXTargetDependency */,
|
||||
);
|
||||
name = "Lightbox-iOS-Tests";
|
||||
productName = "Lightbox-iOS-Tests";
|
||||
productReference = D229B5E11FC3123F00F04123 /* Lightbox-iOS-Tests.xctest */;
|
||||
productType = "com.apple.product-type.bundle.unit-test";
|
||||
};
|
||||
D523B0A81C43AA2A001AD1EC /* Lightbox-iOS */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = D523B0B11C43AA2A001AD1EC /* Build configuration list for PBXNativeTarget "Lightbox-iOS" */;
|
||||
@@ -157,8 +215,6 @@
|
||||
D523B0A51C43AA2A001AD1EC /* Frameworks */,
|
||||
D523B0A61C43AA2A001AD1EC /* Headers */,
|
||||
D523B0A71C43AA2A001AD1EC /* Resources */,
|
||||
D54DFCC41C5AAAF600ADEA0E /* Copy frameworks with Carthage */,
|
||||
5CF8A88D1F50B4EA00C28475 /* ShellScript */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
@@ -175,9 +231,14 @@
|
||||
D523B0A01C43AA2A001AD1EC /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0900;
|
||||
LastSwiftUpdateCheck = 0910;
|
||||
LastUpgradeCheck = 1000;
|
||||
ORGANIZATIONNAME = "Hyper Interaktiv AS";
|
||||
TargetAttributes = {
|
||||
D229B5E01FC3123F00F04123 = {
|
||||
CreatedOnToolsVersion = 9.1;
|
||||
ProvisioningStyle = Automatic;
|
||||
};
|
||||
D523B0A81C43AA2A001AD1EC = {
|
||||
CreatedOnToolsVersion = 7.2;
|
||||
LastSwiftMigration = 0900;
|
||||
@@ -197,11 +258,19 @@
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
D523B0A81C43AA2A001AD1EC /* Lightbox-iOS */,
|
||||
D229B5E01FC3123F00F04123 /* Lightbox-iOS-Tests */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
D229B5DF1FC3123F00F04123 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
D523B0A71C43AA2A001AD1EC /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
@@ -212,41 +281,15 @@
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
5CF8A88D1F50B4EA00C28475 /* ShellScript */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "if which swiftlint >/dev/null; then\nswiftlint\nelse\necho \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi";
|
||||
};
|
||||
D54DFCC41C5AAAF600ADEA0E /* Copy frameworks with Carthage */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
"$(SRCROOT)/Carthage/Build/iOS/Hue.framework",
|
||||
"$(SRCROOT)/Carthage/Build/iOS/Imaginary.framework",
|
||||
"$(SRCROOT)/Carthage/Build/iOS/Cache.framework",
|
||||
"$(SRCROOT)/Carthage/Build/iOS/SwiftHash.framework",
|
||||
);
|
||||
name = "Copy frameworks with Carthage";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "/usr/local/bin/carthage copy-frameworks";
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
D229B5DD1FC3123F00F04123 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
D229B5ED1FC3125D00F04123 /* InfoLabelTests.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
D523B0A41C43AA2A001AD1EC /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
@@ -262,13 +305,64 @@
|
||||
D58A18CB1C5ABF8F000024BB /* FooterView.swift in Sources */,
|
||||
D573A2F01C5B5605006053DD /* HeaderView.swift in Sources */,
|
||||
D573A2F51C5B5CA4006053DD /* LightboxTransition.swift in Sources */,
|
||||
D2258CC4215CD035005A9A1C /* Color+Extensions.swift in Sources */,
|
||||
166E3BA920333E04006799C1 /* LightboxImageStub.swift in Sources */,
|
||||
D2D71BBC1D54DA77006AB907 /* AssetManager.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXTargetDependency section */
|
||||
D229B5E81FC3123F00F04123 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = D523B0A81C43AA2A001AD1EC /* Lightbox-iOS */;
|
||||
targetProxy = D229B5E71FC3123F00F04123 /* PBXContainerItemProxy */;
|
||||
};
|
||||
/* End PBXTargetDependency section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
D229B5EA1FC3123F00F04123 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
INFOPLIST_FILE = "Lightbox-iOS-Tests/Info.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 11.1;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.fantageek.Lightbox-iOS-Tests";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
D229B5EB1FC3123F00F04123 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
INFOPLIST_FILE = "Lightbox-iOS-Tests/Info.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 11.1;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.fantageek.Lightbox-iOS-Tests";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
D523B0AF1C43AA2A001AD1EC /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
@@ -281,12 +375,14 @@
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = 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_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
@@ -319,7 +415,7 @@
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 4.0;
|
||||
SWIFT_VERSION = 4.2;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
VERSION_INFO_PREFIX = "";
|
||||
@@ -338,12 +434,14 @@
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = 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_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
@@ -369,7 +467,7 @@
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
|
||||
SWIFT_VERSION = 4.0;
|
||||
SWIFT_VERSION = 4.2;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
VALIDATE_PRODUCT = YES;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
@@ -424,6 +522,15 @@
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
D229B5E91FC3123F00F04123 /* Build configuration list for PBXNativeTarget "Lightbox-iOS-Tests" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
D229B5EA1FC3123F00F04123 /* Debug */,
|
||||
D229B5EB1FC3123F00F04123 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
D523B0A31C43AA2A001AD1EC /* Build configuration list for PBXProject "Lightbox" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<?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,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0900"
|
||||
LastUpgradeVersion = "1000"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
@@ -26,10 +26,30 @@
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
<TestableReference
|
||||
skipped = "NO"
|
||||
parallelizable = "YES"
|
||||
testExecutionOrdering = "random">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "D229B5E01FC3123F00F04123"
|
||||
BuildableName = "Lightbox-iOS-Tests.xctest"
|
||||
BlueprintName = "Lightbox-iOS-Tests"
|
||||
ReferencedContainer = "container:Lightbox.xcodeproj">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
</Testables>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "D523B0A81C43AA2A001AD1EC"
|
||||
BuildableName = "Lightbox.framework"
|
||||
BlueprintName = "Lightbox-iOS"
|
||||
ReferencedContainer = "container:Lightbox.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
@@ -37,7 +57,6 @@
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
# Lightbox
|
||||
|
||||
[](https://travis-ci.org/hyperoslo/Lightbox)
|
||||
[](https://circleci.com/gh/hyperoslo/Lightbox)
|
||||
[](https://github.com/Carthage/Carthage)
|
||||
[](http://cocoadocs.org/docsets/Lightbox)
|
||||
[](http://cocoadocs.org/docsets/Lightbox)
|
||||

|
||||
|
||||
[Demo](https://appetize.io/app/wfgwc2uvg82m9pzbt17p4rrgh4?device=iphone5s&scale=75&orientation=portrait&osVersion=9.3)
|
||||
|
||||
<img src="https://raw.githubusercontent.com/hyperoslo/Lightbox/master/Images/Icon.png" alt="Lightbox Icon" align="right" />
|
||||
|
||||
**Lightbox** is a convenient and easy to use image viewer for your iOS app,
|
||||
@@ -17,10 +15,16 @@ packed with all the features you expect:
|
||||
- [x] Video support.
|
||||
- [x] Double-tap to zoom.
|
||||
- [x] Image caption.
|
||||
- [x] Dynamic background.
|
||||
- [x] Dynamic background based on [Hue](https://github.com/hyperoslo/Hue)
|
||||
- [x] Remote image loading and caching based on [Imaginary](https://github.com/hyperoslo/Imaginary)
|
||||
- [x] Interactive transition animations.
|
||||
- [x] Powerful configuration.
|
||||
- [x] Demo project.
|
||||
- [x] [Live Demo](https://appetize.io/app/wfgwc2uvg82m9pzbt17p4rrgh4?device=iphone5s&scale=75&orientation=portrait&osVersion=9.3)
|
||||
|
||||
<div align="center">
|
||||
<img src="Images/demo.png" height="500">
|
||||
<img src="Images/demo2.png" height="500">
|
||||
</div>
|
||||
|
||||
## Table of Contents
|
||||
|
||||
@@ -106,9 +110,7 @@ extension ViewController: LightboxControllerDismissalDelegate: class {
|
||||
|
||||
### Image loading
|
||||
|
||||
By default images are loaded using `sendAsynchronousRequest` method of
|
||||
`NSURLConnection`. But it's easy to change this behavior using **Lightbox**
|
||||
configuration.
|
||||
By default images are loaded using [Imaginary](https://github.com/hyperoslo/Imaginary) for reliable loading and caching. But it's easy to change this behavior using **LightboxConfig**
|
||||
|
||||
```swift
|
||||
LightboxConfig.loadImage = {
|
||||
@@ -119,7 +121,7 @@ LightboxConfig.loadImage = {
|
||||
|
||||
### Video
|
||||
|
||||
**Lightbox** has video support out of the box. Configure video by using `videoURL`:
|
||||
**Lightbox** can show and plays video using default `AVPlayerViewController`. Showning video by using `videoURL`:
|
||||
|
||||
```swift
|
||||
LightboxImage(
|
||||
@@ -157,7 +159,7 @@ LightboxConfig.DeleteButton.image = UIImage(named: ImageList.Lightbox.deleteButt
|
||||
LightboxConfig.DeleteButton.textAttributes = TextAttributes.Lightbox.deleteButton
|
||||
LightboxConfig.DeleteButton.text = "Delete"
|
||||
|
||||
LightboxConfig.InfoLabel.ellipsisText = "ShowMore"
|
||||
LightboxConfig.InfoLabel.ellipsisText = "Show more"
|
||||
```
|
||||
|
||||
## Installation
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
import UIKit
|
||||
|
||||
public extension UIColor {
|
||||
/// Constructing color from hex string
|
||||
///
|
||||
/// - Parameter hex: A hex string, can either contain # or not
|
||||
convenience init(hex string: String) {
|
||||
var hex = string.hasPrefix("#")
|
||||
? String(string.dropFirst())
|
||||
: string
|
||||
guard hex.count == 3 || hex.count == 6
|
||||
else {
|
||||
self.init(white: 1.0, alpha: 0.0)
|
||||
return
|
||||
}
|
||||
if hex.count == 3 {
|
||||
for (index, char) in hex.enumerated() {
|
||||
hex.insert(char, at: hex.index(hex.startIndex, offsetBy: index * 2))
|
||||
}
|
||||
}
|
||||
|
||||
self.init(
|
||||
red: CGFloat((Int(hex, radix: 16)! >> 16) & 0xFF) / 255.0,
|
||||
green: CGFloat((Int(hex, radix: 16)! >> 8) & 0xFF) / 255.0,
|
||||
blue: CGFloat((Int(hex, radix: 16)!) & 0xFF) / 255.0, alpha: 1.0)
|
||||
}
|
||||
}
|
||||
@@ -28,14 +28,6 @@ class LightboxTransition: UIPercentDrivenInteractiveTransition {
|
||||
func transition(_ show: Bool) {
|
||||
guard let controller = lightboxController else { return }
|
||||
|
||||
controller.headerView.transform = show
|
||||
? CGAffineTransform.identity
|
||||
: CGAffineTransform(translationX: 0, y: -200)
|
||||
|
||||
controller.footerView.transform = show
|
||||
? CGAffineTransform.identity
|
||||
: CGAffineTransform(translationX: 0, y: 250)
|
||||
|
||||
if interactive {
|
||||
controller.view.backgroundColor = UIColor.black.withAlphaComponent(show ? 1 : 0)
|
||||
} else {
|
||||
@@ -171,7 +163,7 @@ extension LightboxTransition: UIGestureRecognizerDelegate {
|
||||
|
||||
if let panGestureRecognizer = gestureRecognizer as? UIPanGestureRecognizer {
|
||||
let translation = panGestureRecognizer.translation(in: gestureRecognizer.view)
|
||||
if fabs(translation.x) < fabs(translation.y) {
|
||||
if abs(translation.x) < abs(translation.y) {
|
||||
result = true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import UIKit
|
||||
import Hue
|
||||
import AVKit
|
||||
import AVFoundation
|
||||
import Imaginary
|
||||
|
||||
public class LightboxConfig {
|
||||
/// Whether to show status bar while Lightbox is presented
|
||||
@@ -17,16 +17,35 @@ public class LightboxConfig {
|
||||
}
|
||||
}
|
||||
|
||||
/// How to load image onto UIImageView
|
||||
public static var loadImage: (UIImageView, URL, ((UIImage?) -> Void)?) -> Void = { (imageView, imageURL, completion) in
|
||||
|
||||
// Use Imaginary by default
|
||||
imageView.setImage(url: imageURL, placeholder: nil, completion: { result in
|
||||
switch result {
|
||||
case .value(let image):
|
||||
completion?(image)
|
||||
case .error:
|
||||
completion?(nil)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/// Indicator is used to show while image is being fetched
|
||||
public static var makeLoadingIndicator: () -> UIView = {
|
||||
return LoadingIndicator()
|
||||
}
|
||||
|
||||
/// Number of images to preload.
|
||||
///
|
||||
/// 0 - Preload all images (default).
|
||||
public static var preload = 0
|
||||
|
||||
public struct PageIndicator {
|
||||
public static var enabled = true
|
||||
public static var separatorColor = UIColor(hex: "3D4757")
|
||||
|
||||
public static var textAttributes: [NSAttributedStringKey: Any] = [
|
||||
public static var textAttributes: [NSAttributedString.Key: Any] = [
|
||||
.font: UIFont.systemFont(ofSize: 12),
|
||||
.foregroundColor: UIColor(hex: "899AB8"),
|
||||
.paragraphStyle: {
|
||||
@@ -43,7 +62,7 @@ public class LightboxConfig {
|
||||
public static var text = NSLocalizedString("Close", comment: "")
|
||||
public static var image: UIImage?
|
||||
|
||||
public static var textAttributes: [NSAttributedStringKey: Any] = [
|
||||
public static var textAttributes: [NSAttributedString.Key: Any] = [
|
||||
.font: UIFont.boldSystemFont(ofSize: 16),
|
||||
.foregroundColor: UIColor.white,
|
||||
.paragraphStyle: {
|
||||
@@ -60,7 +79,7 @@ public class LightboxConfig {
|
||||
public static var text = NSLocalizedString("Delete", comment: "")
|
||||
public static var image: UIImage?
|
||||
|
||||
public static var textAttributes: [NSAttributedStringKey: Any] = [
|
||||
public static var textAttributes: [NSAttributedString.Key: Any] = [
|
||||
.font: UIFont.boldSystemFont(ofSize: 16),
|
||||
.foregroundColor: UIColor(hex: "FA2F5B"),
|
||||
.paragraphStyle: {
|
||||
@@ -77,7 +96,7 @@ public class LightboxConfig {
|
||||
public static var ellipsisText = NSLocalizedString("Show more", comment: "")
|
||||
public static var ellipsisColor = UIColor(hex: "899AB9")
|
||||
|
||||
public static var textAttributes: [NSAttributedStringKey: Any] = [
|
||||
public static var textAttributes: [NSAttributedString.Key: Any] = [
|
||||
.font: UIFont.systemFont(ofSize: 12),
|
||||
.foregroundColor: UIColor(hex: "DBDBDB")
|
||||
]
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import UIKit
|
||||
import Hue
|
||||
|
||||
public protocol LightboxControllerPageDelegate: class {
|
||||
|
||||
@@ -22,15 +21,13 @@ open class LightboxController: UIViewController {
|
||||
|
||||
lazy var scrollView: UIScrollView = { [unowned self] in
|
||||
let scrollView = UIScrollView()
|
||||
scrollView.frame = self.screenBounds
|
||||
scrollView.isPagingEnabled = false
|
||||
scrollView.delegate = self
|
||||
scrollView.isUserInteractionEnabled = true
|
||||
scrollView.showsHorizontalScrollIndicator = false
|
||||
scrollView.decelerationRate = UIScrollViewDecelerationRateFast
|
||||
scrollView.decelerationRate = UIScrollView.DecelerationRate.fast
|
||||
|
||||
return scrollView
|
||||
}()
|
||||
}()
|
||||
|
||||
lazy var overlayTapGestureRecognizer: UITapGestureRecognizer = { [unowned self] in
|
||||
let gesture = UITapGestureRecognizer()
|
||||
@@ -61,29 +58,25 @@ open class LightboxController: UIViewController {
|
||||
view.delegate = self
|
||||
|
||||
return view
|
||||
}()
|
||||
}()
|
||||
|
||||
open fileprivate(set) lazy var footerView: FooterView = { [unowned self] in
|
||||
let view = FooterView()
|
||||
view.delegate = self
|
||||
|
||||
return view
|
||||
}()
|
||||
}()
|
||||
|
||||
open fileprivate(set) lazy var overlayView: UIView = { [unowned self] in
|
||||
let view = UIView(frame: CGRect.zero)
|
||||
let gradient = CAGradientLayer()
|
||||
let colors = [UIColor(hex: "090909").alpha(0), UIColor(hex: "040404")]
|
||||
let colors = [UIColor(hex: "090909").withAlphaComponent(0), UIColor(hex: "040404")]
|
||||
|
||||
view.addGradientLayer(colors)
|
||||
view.alpha = 0
|
||||
|
||||
return view
|
||||
}()
|
||||
|
||||
var screenBounds: CGRect {
|
||||
return UIApplication.shared.delegate?.window??.bounds ?? .zero
|
||||
}
|
||||
}()
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
@@ -97,6 +90,8 @@ open class LightboxController: UIViewController {
|
||||
seen = true
|
||||
}
|
||||
|
||||
reconfigurePagesForPreload()
|
||||
|
||||
pageDelegate?.lightboxController(self, didMoveToPage: currentPage)
|
||||
|
||||
if let image = pageViews[currentPage].imageView.image, dynamicBackground {
|
||||
@@ -127,7 +122,7 @@ open class LightboxController: UIViewController {
|
||||
|
||||
open var spacing: CGFloat = 20 {
|
||||
didSet {
|
||||
configureLayout()
|
||||
configureLayout(view.bounds.size)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,6 +131,7 @@ open class LightboxController: UIViewController {
|
||||
return pageViews.map { $0.image }
|
||||
}
|
||||
set(value) {
|
||||
initialImages = value
|
||||
configurePages(value)
|
||||
}
|
||||
}
|
||||
@@ -150,7 +146,7 @@ open class LightboxController: UIViewController {
|
||||
var pageViews = [PageView]()
|
||||
var statusBarHidden = false
|
||||
|
||||
fileprivate let initialImages: [LightboxImage]
|
||||
fileprivate var initialImages: [LightboxImage]
|
||||
fileprivate let initialPage: Int
|
||||
|
||||
// MARK: - Initializers
|
||||
@@ -181,19 +177,40 @@ open class LightboxController: UIViewController {
|
||||
overlayView.addGestureRecognizer(overlayTapGestureRecognizer)
|
||||
|
||||
configurePages(initialImages)
|
||||
currentPage = initialPage
|
||||
|
||||
goTo(currentPage, animated: false)
|
||||
goTo(initialPage, animated: false)
|
||||
}
|
||||
|
||||
open override func viewDidAppear(_ animated: Bool) {
|
||||
super.viewDidAppear(animated)
|
||||
if !presented {
|
||||
presented = true
|
||||
configureLayout()
|
||||
configureLayout(view.bounds.size)
|
||||
}
|
||||
}
|
||||
|
||||
open override func viewDidLayoutSubviews() {
|
||||
super.viewDidLayoutSubviews()
|
||||
|
||||
scrollView.frame = view.bounds
|
||||
footerView.frame.size = CGSize(
|
||||
width: view.bounds.width,
|
||||
height: 100
|
||||
)
|
||||
|
||||
footerView.frame.origin = CGPoint(
|
||||
x: 0,
|
||||
y: view.bounds.height - footerView.frame.height
|
||||
)
|
||||
|
||||
headerView.frame = CGRect(
|
||||
x: 0,
|
||||
y: 16,
|
||||
width: view.bounds.width,
|
||||
height: 100
|
||||
)
|
||||
}
|
||||
|
||||
open override var prefersStatusBarHidden: Bool {
|
||||
return LightboxConfig.hideStatusBar
|
||||
}
|
||||
@@ -214,15 +231,34 @@ open class LightboxController: UIViewController {
|
||||
pageViews.forEach { $0.removeFromSuperview() }
|
||||
pageViews = []
|
||||
|
||||
for image in images {
|
||||
let pageView = PageView(image: image)
|
||||
let preloadIndicies = calculatePreloadIndicies()
|
||||
|
||||
for i in 0..<images.count {
|
||||
let pageView = PageView(image: preloadIndicies.contains(i) ? images[i] : LightboxImageStub())
|
||||
pageView.pageViewDelegate = self
|
||||
|
||||
scrollView.addSubview(pageView)
|
||||
pageViews.append(pageView)
|
||||
}
|
||||
|
||||
configureLayout()
|
||||
configureLayout(view.bounds.size)
|
||||
}
|
||||
|
||||
func reconfigurePagesForPreload() {
|
||||
let preloadIndicies = calculatePreloadIndicies()
|
||||
|
||||
for i in 0..<initialImages.count {
|
||||
let pageView = pageViews[i]
|
||||
if preloadIndicies.contains(i) {
|
||||
if type(of: pageView.image) == LightboxImageStub.self {
|
||||
pageView.update(with: initialImages[i])
|
||||
}
|
||||
} else {
|
||||
if type(of: pageView.image) != LightboxImageStub.self {
|
||||
pageView.update(with: LightboxImageStub())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Pagination
|
||||
@@ -258,7 +294,7 @@ open class LightboxController: UIViewController {
|
||||
|
||||
// MARK: - Layout
|
||||
|
||||
open func configureLayout(_ size: CGSize = UIApplication.shared.delegate?.window??.bounds.size ?? .zero) {
|
||||
open func configureLayout(_ size: CGSize) {
|
||||
scrollView.frame.size = size
|
||||
scrollView.contentSize = CGSize(
|
||||
width: size.width * CGFloat(numberOfPages) + spacing * CGFloat(numberOfPages - 1),
|
||||
@@ -275,25 +311,15 @@ open class LightboxController: UIViewController {
|
||||
}
|
||||
}
|
||||
|
||||
let bounds = scrollView.bounds
|
||||
let headerViewHeight = headerView.closeButton.frame.height > headerView.deleteButton.frame.height
|
||||
? headerView.closeButton.frame.height
|
||||
: headerView.deleteButton.frame.height
|
||||
|
||||
headerView.frame = CGRect(x: 0, y: 16, width: bounds.width, height: headerViewHeight)
|
||||
footerView.frame = CGRect(x: 0, y: 0, width: bounds.width, height: 70)
|
||||
|
||||
[headerView, footerView].forEach { ($0 as AnyObject).configureLayout() }
|
||||
|
||||
footerView.frame.origin.y = bounds.height - footerView.frame.height
|
||||
|
||||
overlayView.frame = scrollView.frame
|
||||
overlayView.resizeGradientLayer()
|
||||
}
|
||||
|
||||
fileprivate func loadDynamicBackground(_ image: UIImage) {
|
||||
backgroundView.image = image
|
||||
backgroundView.layer.add(CATransition(), forKey: kCATransitionFade)
|
||||
backgroundView.layer.add(CATransition(), forKey: "fade")
|
||||
}
|
||||
|
||||
func toggleControls(pageView: PageView?, visible: Bool, duration: TimeInterval = 0.1, delay: TimeInterval = 0) {
|
||||
@@ -307,6 +333,22 @@ open class LightboxController: UIViewController {
|
||||
pageView?.playButton.alpha = alpha
|
||||
}, completion: nil)
|
||||
}
|
||||
|
||||
// MARK: - Helper functions
|
||||
func calculatePreloadIndicies () -> [Int] {
|
||||
var preloadIndicies: [Int] = []
|
||||
let preload = LightboxConfig.preload
|
||||
if preload > 0 {
|
||||
let lb = max(0, currentPage - preload)
|
||||
let rb = min(initialImages.count, currentPage + preload)
|
||||
for i in lb..<rb {
|
||||
preloadIndicies.append(i)
|
||||
}
|
||||
} else {
|
||||
preloadIndicies = [Int](0..<initialImages.count)
|
||||
}
|
||||
return preloadIndicies
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - UIScrollViewDelegate
|
||||
@@ -332,7 +374,7 @@ extension LightboxController: UIScrollViewDelegate {
|
||||
}
|
||||
|
||||
targetContentOffset.pointee.x = x
|
||||
currentPage = Int(x / screenBounds.width)
|
||||
currentPage = Int(x / pageWidth)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -397,8 +439,8 @@ extension LightboxController: HeaderViewDelegate {
|
||||
self.pageViews.remove(at: prevIndex).removeFromSuperview()
|
||||
|
||||
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.5) {
|
||||
self.configureLayout()
|
||||
self.currentPage = Int(self.scrollView.contentOffset.x / self.screenBounds.width)
|
||||
self.configureLayout(self.view.bounds.size)
|
||||
self.currentPage = Int(self.scrollView.contentOffset.x / self.view.bounds.width)
|
||||
deleteButton.isEnabled = true
|
||||
}
|
||||
}
|
||||
@@ -416,8 +458,6 @@ extension LightboxController: HeaderViewDelegate {
|
||||
extension LightboxController: FooterViewDelegate {
|
||||
|
||||
public func footerView(_ footerView: FooterView, didExpand expanded: Bool) {
|
||||
footerView.frame.origin.y = screenBounds.height - footerView.frame.height
|
||||
|
||||
UIView.animate(withDuration: 0.25, animations: {
|
||||
self.overlayView.alpha = expanded ? 1.0 : 0.0
|
||||
self.headerView.deleteButton.alpha = expanded ? 0.0 : 1.0
|
||||
|
||||
@@ -6,10 +6,15 @@ open class LightboxImage {
|
||||
open fileprivate(set) var image: UIImage?
|
||||
open fileprivate(set) var imageURL: URL?
|
||||
open fileprivate(set) var videoURL: URL?
|
||||
open fileprivate(set) var imageClosure: (() -> UIImage)?
|
||||
open var text: String
|
||||
|
||||
// MARK: - Initialization
|
||||
|
||||
internal init(text: String = "") {
|
||||
self.text = text
|
||||
}
|
||||
|
||||
public init(image: UIImage, text: String = "", videoURL: URL? = nil) {
|
||||
self.image = image
|
||||
self.text = text
|
||||
@@ -22,19 +27,25 @@ open class LightboxImage {
|
||||
self.videoURL = videoURL
|
||||
}
|
||||
|
||||
open func addImageTo(_ imageView: UIImageView, completion: ((_ image: UIImage?) -> Void)? = nil) {
|
||||
public init(imageClosure: @escaping () -> UIImage, text: String = "", videoURL: URL? = nil) {
|
||||
self.imageClosure = imageClosure
|
||||
self.text = text
|
||||
self.videoURL = videoURL
|
||||
}
|
||||
|
||||
open func addImageTo(_ imageView: UIImageView, completion: ((UIImage?) -> Void)? = nil) {
|
||||
if let image = image {
|
||||
imageView.image = image
|
||||
completion?(image)
|
||||
} else if let imageURL = imageURL {
|
||||
imageView.setImage(url: imageURL, placeholder: nil, completion: { result in
|
||||
switch result {
|
||||
case .value(let image):
|
||||
completion?(image)
|
||||
case .error:
|
||||
completion?(nil)
|
||||
}
|
||||
})
|
||||
LightboxConfig.loadImage(imageView, imageURL, completion)
|
||||
} else if let imageClosure = imageClosure {
|
||||
let img = imageClosure()
|
||||
imageView.image = img
|
||||
completion?(img)
|
||||
} else {
|
||||
imageView.image = nil
|
||||
completion?(nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
import UIKit
|
||||
|
||||
internal class LightboxImageStub: LightboxImage {
|
||||
|
||||
// MARK: - Initialization
|
||||
init () {
|
||||
super.init()
|
||||
}
|
||||
|
||||
}
|
||||
@@ -16,7 +16,7 @@ open class FooterView: UIView {
|
||||
label.delegate = self
|
||||
|
||||
return label
|
||||
}()
|
||||
}()
|
||||
|
||||
open fileprivate(set) lazy var pageLabel: UILabel = { [unowned self] in
|
||||
let label = UILabel(frame: CGRect.zero)
|
||||
@@ -24,7 +24,7 @@ open class FooterView: UIView {
|
||||
label.numberOfLines = 1
|
||||
|
||||
return label
|
||||
}()
|
||||
}()
|
||||
|
||||
open fileprivate(set) lazy var separatorView: UIView = { [unowned self] in
|
||||
let view = UILabel(frame: CGRect.zero)
|
||||
@@ -32,9 +32,9 @@ open class FooterView: UIView {
|
||||
view.backgroundColor = LightboxConfig.PageIndicator.separatorColor
|
||||
|
||||
return view
|
||||
}()
|
||||
}()
|
||||
|
||||
let gradientColors = [UIColor(hex: "040404").alpha(0.1), UIColor(hex: "040404")]
|
||||
let gradientColors = [UIColor(hex: "040404").withAlphaComponent(0.1), UIColor(hex: "040404")]
|
||||
open weak var delegate: FooterViewDelegate?
|
||||
|
||||
// MARK: - Initializers
|
||||
@@ -76,17 +76,29 @@ open class FooterView: UIView {
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Layout
|
||||
open override func layoutSubviews() {
|
||||
super.layoutSubviews()
|
||||
|
||||
fileprivate func resetFrames() {
|
||||
frame.size.height = infoLabel.frame.height + 40 + 0.5
|
||||
do {
|
||||
let bottomPadding: CGFloat
|
||||
if #available(iOS 11, *) {
|
||||
bottomPadding = safeAreaInsets.bottom
|
||||
} else {
|
||||
bottomPadding = 0
|
||||
}
|
||||
|
||||
pageLabel.frame.origin = CGPoint(
|
||||
x: (frame.width - pageLabel.frame.width) / 2,
|
||||
y: frame.height - pageLabel.frame.height - 2)
|
||||
pageLabel.frame.origin = CGPoint(
|
||||
x: (frame.width - pageLabel.frame.width) / 2,
|
||||
y: frame.height - pageLabel.frame.height - 2 - bottomPadding
|
||||
)
|
||||
}
|
||||
|
||||
separatorView.frame = CGRect(x: 0, y: pageLabel.frame.minY - 2.5,
|
||||
width: frame.width, height: 0.5)
|
||||
separatorView.frame = CGRect(
|
||||
x: 0,
|
||||
y: pageLabel.frame.minY - 2.5,
|
||||
width: frame.width,
|
||||
height: 0.5
|
||||
)
|
||||
|
||||
infoLabel.frame.origin.y = separatorView.frame.minY - infoLabel.frame.height - 15
|
||||
|
||||
@@ -107,7 +119,6 @@ extension FooterView: LayoutConfigurable {
|
||||
extension FooterView: InfoLabelDelegate {
|
||||
|
||||
public func infoLabel(_ infoLabel: InfoLabel, didExpand expanded: Bool) {
|
||||
resetFrames()
|
||||
_ = (expanded || infoLabel.fullText.isEmpty) ? removeGradientLayer() : addGradientLayer(gradientColors)
|
||||
delegate?.footerView(self, didExpand: expanded)
|
||||
}
|
||||
|
||||
@@ -6,13 +6,6 @@ protocol HeaderViewDelegate: class {
|
||||
}
|
||||
|
||||
open class HeaderView: UIView {
|
||||
|
||||
var centerTextStyle: NSMutableParagraphStyle = {
|
||||
var style = NSMutableParagraphStyle()
|
||||
style.alignment = .center
|
||||
return style
|
||||
}()
|
||||
|
||||
open fileprivate(set) lazy var closeButton: UIButton = { [unowned self] in
|
||||
let title = NSAttributedString(
|
||||
string: LightboxConfig.CloseButton.text,
|
||||
@@ -20,7 +13,7 @@ open class HeaderView: UIView {
|
||||
|
||||
let button = UIButton(type: .system)
|
||||
|
||||
button.setAttributedTitle(title, for: UIControlState())
|
||||
button.setAttributedTitle(title, for: UIControl.State())
|
||||
|
||||
if let size = LightboxConfig.CloseButton.size {
|
||||
button.frame.size = size
|
||||
@@ -32,13 +25,13 @@ open class HeaderView: UIView {
|
||||
for: .touchUpInside)
|
||||
|
||||
if let image = LightboxConfig.CloseButton.image {
|
||||
button.setBackgroundImage(image, for: UIControlState())
|
||||
button.setBackgroundImage(image, for: UIControl.State())
|
||||
}
|
||||
|
||||
button.isHidden = !LightboxConfig.CloseButton.enabled
|
||||
|
||||
return button
|
||||
}()
|
||||
}()
|
||||
|
||||
open fileprivate(set) lazy var deleteButton: UIButton = { [unowned self] in
|
||||
let title = NSAttributedString(
|
||||
@@ -59,13 +52,13 @@ open class HeaderView: UIView {
|
||||
for: .touchUpInside)
|
||||
|
||||
if let image = LightboxConfig.DeleteButton.image {
|
||||
button.setBackgroundImage(image, for: UIControlState())
|
||||
button.setBackgroundImage(image, for: UIControl.State())
|
||||
}
|
||||
|
||||
button.isHidden = !LightboxConfig.DeleteButton.enabled
|
||||
|
||||
return button
|
||||
}()
|
||||
}()
|
||||
|
||||
weak var delegate: HeaderViewDelegate?
|
||||
|
||||
@@ -99,9 +92,22 @@ open class HeaderView: UIView {
|
||||
extension HeaderView: LayoutConfigurable {
|
||||
|
||||
@objc public func configureLayout() {
|
||||
closeButton.frame.origin = CGPoint(
|
||||
x: bounds.width - closeButton.frame.width - 17, y: 0)
|
||||
let topPadding: CGFloat
|
||||
|
||||
deleteButton.frame.origin = CGPoint(x: 17, y: 0)
|
||||
if #available(iOS 11, *) {
|
||||
topPadding = safeAreaInsets.top
|
||||
} else {
|
||||
topPadding = 0
|
||||
}
|
||||
|
||||
closeButton.frame.origin = CGPoint(
|
||||
x: bounds.width - closeButton.frame.width - 17,
|
||||
y: topPadding
|
||||
)
|
||||
|
||||
deleteButton.frame.origin = CGPoint(
|
||||
x: 17,
|
||||
y: topPadding
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,26 +41,32 @@ open class InfoLabel: UILabel {
|
||||
}
|
||||
}
|
||||
|
||||
fileprivate var truncatedText: String {
|
||||
var truncatedText: String {
|
||||
var truncatedText = fullText
|
||||
|
||||
guard numberOfLines(fullText) > numberOfVisibleLines else {
|
||||
return truncatedText
|
||||
}
|
||||
|
||||
// Perform quick "rough cut"
|
||||
while numberOfLines(truncatedText) > numberOfVisibleLines * 2 {
|
||||
truncatedText = String(truncatedText.characters.prefix(truncatedText.characters.count / 2))
|
||||
truncatedText = String(truncatedText.prefix(truncatedText.count / 2))
|
||||
}
|
||||
|
||||
// Capture the endIndex of truncatedText before appending ellipsis
|
||||
var truncatedTextCursor = truncatedText.endIndex
|
||||
|
||||
truncatedText += ellipsis
|
||||
|
||||
let start = truncatedText.characters.index(truncatedText.endIndex, offsetBy: -(ellipsis.characters.count + 1))
|
||||
let end = truncatedText.characters.index(truncatedText.endIndex, offsetBy: -ellipsis.characters.count)
|
||||
var range = start..<end
|
||||
|
||||
// Remove characters ahead of ellipsis until the text is the right number of lines
|
||||
while numberOfLines(truncatedText) > numberOfVisibleLines {
|
||||
truncatedText.removeSubrange(range)
|
||||
range = truncatedText.index(range.lowerBound, offsetBy: -1)..<truncatedText.index(range.upperBound, offsetBy: -1)
|
||||
// To avoid "Cannot decrement before startIndex"
|
||||
guard truncatedTextCursor > truncatedText.startIndex else {
|
||||
break
|
||||
}
|
||||
|
||||
truncatedTextCursor = truncatedText.index(before: truncatedTextCursor)
|
||||
truncatedText.remove(at: truncatedTextCursor)
|
||||
}
|
||||
|
||||
return truncatedText
|
||||
@@ -105,13 +111,13 @@ open class InfoLabel: UILabel {
|
||||
}
|
||||
|
||||
fileprivate func updateText(_ string: String) {
|
||||
let attributedString = NSMutableAttributedString(string: string,
|
||||
attributes: LightboxConfig.InfoLabel.textAttributes)
|
||||
let textAttributes = LightboxConfig.InfoLabel.textAttributes
|
||||
let attributedString = NSMutableAttributedString(string: string, attributes: textAttributes)
|
||||
|
||||
if string.range(of: ellipsis) != nil {
|
||||
let range = (string as NSString).range(of: ellipsis)
|
||||
attributedString.addAttribute(NSAttributedStringKey.foregroundColor,
|
||||
value: LightboxConfig.InfoLabel.ellipsisColor, range: range)
|
||||
if let range = string.range(of: ellipsis) {
|
||||
let ellipsisColor = LightboxConfig.InfoLabel.ellipsisColor
|
||||
let ellipsisRange = NSRange(range, in: string)
|
||||
attributedString.addAttribute(.foregroundColor, value: ellipsisColor, range: ellipsisRange)
|
||||
}
|
||||
|
||||
attributedText = attributedString
|
||||
@@ -123,12 +129,12 @@ open class InfoLabel: UILabel {
|
||||
return string.boundingRect(
|
||||
with: CGSize(width: bounds.size.width, height: CGFloat.greatestFiniteMagnitude),
|
||||
options: [.usesLineFragmentOrigin, .usesFontLeading],
|
||||
attributes: [NSAttributedStringKey.font: font],
|
||||
attributes: [NSAttributedString.Key.font: font],
|
||||
context: nil).height
|
||||
}
|
||||
|
||||
fileprivate func numberOfLines(_ string: String) -> Int {
|
||||
let lineHeight = "A".size(withAttributes: [NSAttributedStringKey.font: font]).height
|
||||
let lineHeight = "A".size(withAttributes: [NSAttributedString.Key.font: font]).height
|
||||
let totalHeight = heightForString(string)
|
||||
|
||||
return Int(totalHeight / lineHeight)
|
||||
|
||||
@@ -13,7 +13,7 @@ class LoadingIndicator: UIView {
|
||||
alpha = 0
|
||||
|
||||
indicator = UIActivityIndicatorView()
|
||||
indicator.activityIndicatorViewStyle = .whiteLarge
|
||||
indicator.style = .whiteLarge
|
||||
indicator.startAnimating()
|
||||
|
||||
addSubview(indicator)
|
||||
|
||||
+36
-18
@@ -22,7 +22,7 @@ class PageView: UIScrollView {
|
||||
lazy var playButton: UIButton = {
|
||||
let button = UIButton(type: .custom)
|
||||
button.frame.size = CGSize(width: 60, height: 60)
|
||||
button.setBackgroundImage(AssetManager.image("lightbox_play"), for: UIControlState())
|
||||
button.setBackgroundImage(AssetManager.image("lightbox_play"), for: UIControl.State())
|
||||
button.addTarget(self, action: #selector(playButtonTouched(_:)), for: .touchUpInside)
|
||||
|
||||
button.layer.shadowOffset = CGSize(width: 1, height: 1)
|
||||
@@ -51,20 +51,7 @@ class PageView: UIScrollView {
|
||||
|
||||
configure()
|
||||
|
||||
loadingIndicator.alpha = 1
|
||||
self.image.addImageTo(imageView) { [weak self] image in
|
||||
guard let strongSelf = self else {
|
||||
return
|
||||
}
|
||||
|
||||
strongSelf.isUserInteractionEnabled = true
|
||||
strongSelf.configureImageView()
|
||||
strongSelf.pageViewDelegate?.remoteImageDidLoad(image, imageView: strongSelf.imageView)
|
||||
|
||||
UIView.animate(withDuration: 0.4) {
|
||||
strongSelf.loadingIndicator.alpha = 0
|
||||
}
|
||||
}
|
||||
fetchImage()
|
||||
}
|
||||
|
||||
required init?(coder aDecoder: NSCoder) {
|
||||
@@ -76,9 +63,7 @@ class PageView: UIScrollView {
|
||||
func configure() {
|
||||
addSubview(imageView)
|
||||
|
||||
if image.videoURL != nil {
|
||||
addSubview(playButton)
|
||||
}
|
||||
updatePlayButton()
|
||||
|
||||
addSubview(loadingIndicator)
|
||||
|
||||
@@ -100,6 +85,39 @@ class PageView: UIScrollView {
|
||||
tapRecognizer.require(toFail: doubleTapRecognizer)
|
||||
}
|
||||
|
||||
// MARK: - Update
|
||||
func update(with image: LightboxImage) {
|
||||
self.image = image
|
||||
updatePlayButton()
|
||||
fetchImage()
|
||||
}
|
||||
|
||||
func updatePlayButton () {
|
||||
if self.image.videoURL != nil && !subviews.contains(playButton) {
|
||||
addSubview(playButton)
|
||||
} else if self.image.videoURL == nil && subviews.contains(playButton) {
|
||||
playButton.removeFromSuperview()
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Fetch
|
||||
private func fetchImage () {
|
||||
loadingIndicator.alpha = 1
|
||||
self.image.addImageTo(imageView) { [weak self] image in
|
||||
guard let self = self else {
|
||||
return
|
||||
}
|
||||
|
||||
self.isUserInteractionEnabled = true
|
||||
self.configureImageView()
|
||||
self.pageViewDelegate?.remoteImageDidLoad(image, imageView: self.imageView)
|
||||
|
||||
UIView.animate(withDuration: 0.4) {
|
||||
self.loadingIndicator.alpha = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Recognizers
|
||||
|
||||
@objc func scrollViewDoubleTapped(_ recognizer: UITapGestureRecognizer) {
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
carthage bootstrap
|
||||
cp Cartfile.resolved Carthage
|
||||
@@ -1,5 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
if ! cmp -s Cartfile.resolved Carthage/Cartfile.resolved; then
|
||||
bin/bootstrap
|
||||
fi
|
||||
+2
-3
@@ -4,9 +4,8 @@ machine:
|
||||
|
||||
dependencies:
|
||||
override:
|
||||
- bin/bootstrap-if-needed
|
||||
cache_directories:
|
||||
- "Carthage"
|
||||
- rm -rf Carthage
|
||||
- carthage update
|
||||
|
||||
test:
|
||||
override:
|
||||
|
||||
Reference in New Issue
Block a user