Skip to content

Commit

Permalink
Update for Swift 4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Colin Smith committed Sep 18, 2018
1 parent 1584281 commit 164e78c
Show file tree
Hide file tree
Showing 15 changed files with 189 additions and 23 deletions.
2 changes: 1 addition & 1 deletion Cartfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
github "hyperoslo/Hue" ~> 3.0
github "hyperoslo/Imaginary" ~> 3.0
github "hyperoslo/Imaginary" == 3.0.4
108 changes: 103 additions & 5 deletions Lightbox.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -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>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0900"
LastUpgradeVersion = "1000"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,7 +26,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
Expand Down Expand Up @@ -56,7 +55,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
10 changes: 10 additions & 0 deletions Lightbox.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Lightbox.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
Original file line number Diff line number Diff line change
@@ -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>
19 changes: 19 additions & 0 deletions Podfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
use_frameworks!

source 'https://bitbucket.org/digitalanimalca/ios-pods.git'
source 'https://github.com/CocoaPods/Specs.git'

platform :ios, '11.0'

def shared_pods
pod 'Imaginary', '3.0.4'
pod 'Hue', '~> 3.0'
end

target 'Lightbox-iOS' do
shared_pods
end

target 'Lightbox-iOS-Tests' do
shared_pods
end
25 changes: 25 additions & 0 deletions Podfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
PODS:
- Cache (4.2.1)
- Hue (3.0.1)
- Imaginary (3.0.4):
- Cache (= 4.2.1)

DEPENDENCIES:
- Hue (~> 3.0)
- Imaginary (= 3.0.4)

SPEC REPOS:
https://bitbucket.org/digitalanimalca/ios-pods.git:
- Cache
- Imaginary
https://github.com/cocoapods/specs.git:
- Hue

SPEC CHECKSUMS:
Cache: c3307248aaccf525ad5cc3a8f9f507f0dd4d8e78
Hue: 93e852fa6211ab35922ad8c293f51c43d6c79eb2
Imaginary: 2a0d13ebf1ef5823ce5432988e82446fa6b0e88e

PODFILE CHECKSUM: 5d24fb5489c816d31dccd097f45df426fa667e2b

COCOAPODS: 1.5.3
2 changes: 1 addition & 1 deletion Source/Library/LightboxTransition.swift
Original file line number Diff line number Diff line change
Expand Up @@ -163,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
}
}
Expand Down
8 changes: 4 additions & 4 deletions Source/LightboxConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class LightboxConfig {
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: {
Expand All @@ -63,7 +63,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: {
Expand All @@ -80,7 +80,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: {
Expand All @@ -97,7 +97,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")
]
Expand Down
4 changes: 2 additions & 2 deletions Source/LightboxController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ open class LightboxController: UIViewController {
scrollView.isPagingEnabled = false
scrollView.delegate = self
scrollView.showsHorizontalScrollIndicator = false
scrollView.decelerationRate = UIScrollViewDecelerationRateFast
scrollView.decelerationRate = UIScrollView.DecelerationRate.fast

return scrollView
}()
Expand Down Expand Up @@ -320,7 +320,7 @@ open class LightboxController: UIViewController {

fileprivate func loadDynamicBackground(_ image: UIImage) {
backgroundView.image = image
backgroundView.layer.add(CATransition(), forKey: kCATransitionFade)
backgroundView.layer.add(CATransition(), forKey: CATransitionType.fade.rawValue)
}

func toggleControls(pageView: PageView?, visible: Bool, duration: TimeInterval = 0.1, delay: TimeInterval = 0) {
Expand Down
6 changes: 3 additions & 3 deletions Source/Views/HeaderView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,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
Expand All @@ -25,7 +25,7 @@ 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
Expand All @@ -52,7 +52,7 @@ 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
Expand Down
4 changes: 2 additions & 2 deletions Source/Views/InfoLabel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -129,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)
Expand Down
2 changes: 1 addition & 1 deletion Source/Views/LoadingIndicator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class LoadingIndicator: UIView {
alpha = 0

indicator = UIActivityIndicatorView()
indicator.activityIndicatorViewStyle = .whiteLarge
indicator.style = .whiteLarge
indicator.startAnimating()

addSubview(indicator)
Expand Down
2 changes: 1 addition & 1 deletion Source/Views/PageView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 164e78c

Please sign in to comment.