Skip to content
This repository has been archived by the owner on Jun 30, 2021. It is now read-only.

fix(colorFix): color and font problem fixed #34

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
PODS:
- UIEmptyState (3.1.0)
- UIEmptyState (3.1.1)

DEPENDENCIES:
- UIEmptyState (from `../`)

EXTERNAL SOURCES:
UIEmptyState:
:path: ../
:path: "../"

SPEC CHECKSUMS:
UIEmptyState: 9b501dc90933ce2743949ecbf18c20ffb33a2be9
UIEmptyState: 801fb97bc13d0ec75e32ba0a111538683aea69f5

PODFILE CHECKSUM: 2410e5e41e5d4570ddd34538c5ba93d5d35ce08c

COCOAPODS: 1.3.1
COCOAPODS: 1.9.1
27 changes: 6 additions & 21 deletions Example/UIEmptyStateExample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@
A05AA1BB1E4560E800B851F7 /* Frameworks */,
A05AA1BC1E4560E800B851F7 /* Resources */,
0085D2E6DEBEFB5796183033 /* [CP] Embed Pods Frameworks */,
24B3590701ADC38465D2548E /* [CP] Copy Pods Resources */,
);
buildRules = (
);
Expand All @@ -146,7 +145,7 @@
A05AA1BD1E4560E800B851F7 = {
CreatedOnToolsVersion = 8.2.1;
DevelopmentTeam = 4FNMZ7SN42;
LastSwiftMigration = 0900;
LastSwiftMigration = 1140;
ProvisioningStyle = Automatic;
};
};
Expand All @@ -156,6 +155,7 @@
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
Base,
);
Expand Down Expand Up @@ -189,7 +189,7 @@
files = (
);
inputPaths = (
"${SRCROOT}/Pods/Target Support Files/Pods-UIEmptyStateExample/Pods-UIEmptyStateExample-frameworks.sh",
"${PODS_ROOT}/Target Support Files/Pods-UIEmptyStateExample/Pods-UIEmptyStateExample-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/UIEmptyState/UIEmptyState.framework",
);
name = "[CP] Embed Pods Frameworks";
Expand All @@ -198,22 +198,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-UIEmptyStateExample/Pods-UIEmptyStateExample-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
24B3590701ADC38465D2548E /* [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-UIEmptyStateExample/Pods-UIEmptyStateExample-resources.sh\"\n";
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-UIEmptyStateExample/Pods-UIEmptyStateExample-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
7D72286EB8A21429E4DC3E74 /* [CP] Check Pods Manifest.lock */ = {
Expand Down Expand Up @@ -386,7 +371,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.luispadron.UIEmptyStateExample;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -401,7 +386,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.luispadron.UIEmptyStateExample;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand Down
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>
2 changes: 1 addition & 1 deletion Example/UIEmptyStateExample/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,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 {
// Override point for customization after application launch.
return true
}
Expand Down
10 changes: 5 additions & 5 deletions Example/UIEmptyStateExample/EmptyStateTableViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ class EmptyStateTableViewController: UITableViewController, UIEmptyStateDelegate
}

var emptyStateTitle: NSAttributedString {
let attrs = [NSAttributedStringKey.foregroundColor: UIColor(red: 0.882, green: 0.890, blue: 0.859, alpha: 1.00),
NSAttributedStringKey.font: UIFont.systemFont(ofSize: 22)]
let attrs = [NSAttributedString.Key.foregroundColor: UIColor(red: 0.882, green: 0.890, blue: 0.859, alpha: 1.00),
NSAttributedString.Key.font: UIFont.systemFont(ofSize: 22)]
return NSAttributedString(string: "No Pokemon caught!", attributes: attrs)
}

var emptyStateButtonTitle: NSAttributedString? {
let attrs = [NSAttributedStringKey.foregroundColor: UIColor.white,
NSAttributedStringKey.font: UIFont.systemFont(ofSize: 16)]
let attrs = [NSAttributedString.Key.foregroundColor: UIColor.white,
NSAttributedString.Key.font: UIFont.systemFont(ofSize: 16)]
return NSAttributedString(string: "Catch'em All", attributes: attrs)
}

Expand Down Expand Up @@ -83,7 +83,7 @@ class EmptyStateTableViewController: UITableViewController, UIEmptyStateDelegate
return cell
}

override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {
override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) {
if editingStyle == .delete {
// Delete the row
tableView.beginUpdates()
Expand Down
2 changes: 1 addition & 1 deletion UIEmptyState.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Pod::Spec.new do |s|

s.name = "UIEmptyState"
s.version = "3.1.0"
s.version = "3.1.1"
s.summary = "An empty state control to give visually appealing context when building iOS applications."
s.description = <<-DESC
Empty state control which gives context with either a message, image, and buttons to the user when ever there is a reason the state is empty.
Expand Down
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>
4 changes: 4 additions & 0 deletions UIEmptyState/UIEmptyStateDataSource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ public protocol UIEmptyStateDataSource: class {
*/
func emptyStateViewAnimation(for view: UIView, animationDuration: TimeInterval,
completion: ((Bool) -> Void)?) -> Void

var emptyStateContainerView: UIView { get }
}

/// Extension for the UIEmptyDataSource which adds a default implementation for any UIViewController Subclass
Expand Down Expand Up @@ -260,6 +262,8 @@ extension UIEmptyStateDataSource where Self: UIViewController {
/// Default implementation of `emptyStateViewAnimationDuration`, returns `0.5`
public var emptyStateViewAnimationDuration: TimeInterval { get { return 0.5 } }

public var emptyStateContainerView: UIView { return self.view }

/// Default implementation of `emptyStateViewAnimation`, implements a simple animation
public func emptyStateViewAnimation(for view: UIView, animationDuration: TimeInterval,
completion: ((Bool) -> Void)?) -> Void {
Expand Down
6 changes: 3 additions & 3 deletions UIEmptyState/UIEmptyStateView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ open class UIEmptyStateView: UIView {
return
}

detailLabel.attributedText = message
detailLabel.attributedText = NSAttributedString(string: message.string)
self.setNeedsUpdateConstraints()
handleAdding(view: detailLabel)
}
Expand Down Expand Up @@ -253,7 +253,7 @@ open class UIEmptyStateView: UIView {
contentView.axis = .vertical
contentView.distribution = .equalSpacing
contentView.alignment = .center
contentView.backgroundColor = UIColor.red
contentView.backgroundColor = .clear
contentView.spacing = spacing ?? 0
contentView.translatesAutoresizingMaskIntoConstraints = false
contentView.addArrangedSubview(titleLabel)
Expand All @@ -270,7 +270,7 @@ open class UIEmptyStateView: UIView {
private func handleAdding(view: UIView) {
// The order we want is 1. Image View, 2. Title Label, 3. Detail Label, 4. Button
// If already added we can return
if contentView.subviews.index(of: view) != nil { return }
if contentView.subviews.firstIndex(of: view) != nil { return }

// Tags correspond to the views AND the order we want them in
switch view.tag {
Expand Down
18 changes: 10 additions & 8 deletions UIEmptyState/UIViewController+UIEmptyState.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ extension UIViewController {
*/
public weak var emptyStateDataSource: UIEmptyStateDataSource? {
get { return objc_getAssociatedObject(self, &Keys.emptyStateDataSource) as? UIEmptyStateDataSource }
set { objc_setAssociatedObject(self, &Keys.emptyStateDataSource, newValue, .OBJC_ASSOCIATION_RETAIN) }
set { objc_setAssociatedObject(self, &Keys.emptyStateDataSource, newValue, .OBJC_ASSOCIATION_ASSIGN) }
}

/**
Expand All @@ -36,7 +36,7 @@ extension UIViewController {
*/
public weak var emptyStateDelegate: UIEmptyStateDelegate? {
get { return objc_getAssociatedObject(self, &Keys.emptyStateDelegate) as? UIEmptyStateDelegate }
set { objc_setAssociatedObject(self, &Keys.emptyStateDelegate, newValue, .OBJC_ASSOCIATION_RETAIN) }
set { objc_setAssociatedObject(self, &Keys.emptyStateDelegate, newValue, .OBJC_ASSOCIATION_ASSIGN) }
}

/**
Expand Down Expand Up @@ -137,9 +137,9 @@ extension UIViewController {
//// Private helper which creates view contraints for the UIEmptyStateView.
private func createViewConstraints(for view: UIView, in source: UIEmptyStateDataSource) {
// Set constraints
var centerX = view.centerXAnchor.constraint(equalTo: self.view.centerXAnchor)
var centerX = view.centerXAnchor.constraint(equalTo: source.emptyStateContainerView.centerXAnchor)
centerX.isActive = true
var centerY = view.centerYAnchor.constraint(equalTo: self.view.centerYAnchor)
var centerY = view.centerYAnchor.constraint(equalTo: source.emptyStateContainerView.centerYAnchor)
centerY.isActive = true

// If iOS 11.0 is not available, then adjust the extended layout accordingly using older API
Expand All @@ -160,11 +160,11 @@ extension UIViewController {
if source.emptyStateViewAdjustsToFitBars {
// Adjust constraint to fit new big title bars, etc
centerX.isActive = false
centerX = view.centerXAnchor.constraint(equalTo: self.view.safeAreaLayoutGuide.centerXAnchor)
centerX = view.centerXAnchor.constraint(equalTo: source.emptyStateContainerView.safeAreaLayoutGuide.centerXAnchor)
centerX.isActive = true

centerY.isActive = false
centerY = view.centerYAnchor.constraint(equalTo: self.view.safeAreaLayoutGuide.centerYAnchor)
centerY = view.centerYAnchor.constraint(equalTo: source.emptyStateContainerView.safeAreaLayoutGuide.centerYAnchor)
centerY.isActive = true

}
Expand Down Expand Up @@ -216,8 +216,10 @@ extension UIViewController {
// Add to emptyStateView property
emptyView = newView
// Add as a subView, bring it infront of the tableView
self.view.addSubview(newView)
self.view.bringSubview(toFront: newView)

self.emptyStateDataSource?.emptyStateContainerView.addSubview(newView)
self.emptyStateDataSource?.emptyStateContainerView.sendSubviewToBack(newView)

// Animate now
if source.emptyStateViewCanAnimate {
DispatchQueue.main.async {
Expand Down