Commit 6a47fbca by Daniel Dahan

removed the need to setup the clearButton for TextFields

parent 84168221
......@@ -19,8 +19,6 @@
9663F94E1C7A74EA00AF0965 /* AppLeftViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9663F94D1C7A74EA00AF0965 /* AppLeftViewController.swift */; };
9663F9521C7A751D00AF0965 /* ItemViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9663F9511C7A751D00AF0965 /* ItemViewController.swift */; };
96CC08881C7FEBD60034FF84 /* RecipesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96CC08871C7FEBD60034FF84 /* RecipesViewController.swift */; };
96E01FD91CB0485C00411B61 /* Material.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 96E01FD81CB0485C00411B61 /* Material.framework */; };
96E01FDA1CB0485C00411B61 /* Material.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 96E01FD81CB0485C00411B61 /* Material.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
......@@ -30,7 +28,6 @@
dstPath = "";
dstSubfolderSpec = 10;
files = (
96E01FDA1CB0485C00411B61 /* Material.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
......@@ -52,7 +49,6 @@
9663F94D1C7A74EA00AF0965 /* AppLeftViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppLeftViewController.swift; sourceTree = "<group>"; };
9663F9511C7A751D00AF0965 /* ItemViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ItemViewController.swift; sourceTree = "<group>"; };
96CC08871C7FEBD60034FF84 /* RecipesViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RecipesViewController.swift; sourceTree = "<group>"; };
96E01FD81CB0485C00411B61 /* Material.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; name = Material.framework; path = "/Users/danieldahan/Library/Developer/Xcode/DerivedData/Material-hbpnflxhoouqxebjcyhbbhqyesjd/Build/Products/Debug-iphonesimulator/Material.framework"; sourceTree = "<absolute>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
......@@ -60,7 +56,6 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
96E01FD91CB0485C00411B61 /* Material.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -70,7 +65,6 @@
9663F9251C7A744500AF0965 = {
isa = PBXGroup;
children = (
96E01FD81CB0485C00411B61 /* Material.framework */,
9663F9301C7A744600AF0965 /* App */,
9663F92F1C7A744600AF0965 /* Products */,
);
......
......@@ -68,7 +68,7 @@ class ItemViewController: UIViewController {
prepareView()
prepareTitleLabel()
prepareShareButton()
prepareNavigationBar()
prepareNavigationItem()
prepareScrollView()
prepareImageCardView()
}
......@@ -123,7 +123,7 @@ class ItemViewController: UIViewController {
}
/// Prepares the navigationItem.
private func prepareNavigationBar() {
private func prepareNavigationItem() {
navigationItem.titleLabel = titleLabel
navigationItem.detailLabel = detailLabel
navigationItem.rightControls = [shareButton]
......
......@@ -58,7 +58,7 @@ class RecipesViewController: UIViewController {
prepareMenuButton()
prepareSwitchControl()
prepareSearchButton()
prepareNavigationBar()
prepareNavigationItem()
prepareTableView()
}
......@@ -255,7 +255,7 @@ class RecipesViewController: UIViewController {
}
/// Prepares the navigationItem.
private func prepareNavigationBar() {
private func prepareNavigationItem() {
navigationItem.titleLabel = titleLabel
navigationItem.leftControls = [menuButton]
navigationItem.rightControls = [switchControl, searchButton]
......
......@@ -11,8 +11,6 @@
96E01FC21CB0441800411B61 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96E01FC11CB0441800411B61 /* ViewController.swift */; };
96E01FC71CB0441800411B61 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 96E01FC61CB0441800411B61 /* Assets.xcassets */; };
96E01FCA1CB0441800411B61 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 96E01FC81CB0441800411B61 /* LaunchScreen.storyboard */; };
96E01FD21CB0448F00411B61 /* Material.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 96E01FD11CB0448F00411B61 /* Material.framework */; };
96E01FD31CB0448F00411B61 /* Material.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 96E01FD11CB0448F00411B61 /* Material.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
......@@ -22,7 +20,6 @@
dstPath = "";
dstSubfolderSpec = 10;
files = (
96E01FD31CB0448F00411B61 /* Material.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
......@@ -36,7 +33,6 @@
96E01FC61CB0441800411B61 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
96E01FC91CB0441800411B61 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
96E01FCB1CB0441800411B61 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
96E01FD11CB0448F00411B61 /* Material.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; name = Material.framework; path = "/Users/danieldahan/Library/Developer/Xcode/DerivedData/Material-hbpnflxhoouqxebjcyhbbhqyesjd/Build/Products/Debug-iphoneos/Material.framework"; sourceTree = "<absolute>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
......@@ -44,7 +40,6 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
96E01FD21CB0448F00411B61 /* Material.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -54,7 +49,6 @@
96E01FB31CB0441800411B61 = {
isa = PBXGroup;
children = (
96E01FD11CB0448F00411B61 /* Material.framework */,
96E01FBE1CB0441800411B61 /* TabBar */,
96E01FBD1CB0441800411B61 /* Products */,
);
......
......@@ -7,6 +7,8 @@
objects = {
/* Begin PBXBuildFile section */
966015D91CB2B0BA00AAB661 /* Material.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 966015D81CB2B0BA00AAB661 /* Material.framework */; };
966015DA1CB2B0BA00AAB661 /* Material.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 966015D81CB2B0BA00AAB661 /* Material.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
966F57A11C226BAA009185B7 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 966F57A01C226BAA009185B7 /* AppDelegate.swift */; };
966F57A31C226BAA009185B7 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 966F57A21C226BAA009185B7 /* ViewController.swift */; };
966F57A81C226BAA009185B7 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 966F57A71C226BAA009185B7 /* Assets.xcassets */; };
......@@ -14,12 +16,13 @@
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
966F57B51C226CA3009185B7 /* Embed Frameworks */ = {
966015DB1CB2B0BA00AAB661 /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
966015DA1CB2B0BA00AAB661 /* Material.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
......@@ -27,6 +30,7 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
966015D81CB2B0BA00AAB661 /* Material.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; name = Material.framework; path = "/Users/danieldahan/Library/Developer/Xcode/DerivedData/Material-hbpnflxhoouqxebjcyhbbhqyesjd/Build/Products/Debug-iphoneos/Material.framework"; sourceTree = "<absolute>"; };
966F579D1C226BAA009185B7 /* TextField.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TextField.app; sourceTree = BUILT_PRODUCTS_DIR; };
966F57A01C226BAA009185B7 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
966F57A21C226BAA009185B7 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
......@@ -40,6 +44,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
966015D91CB2B0BA00AAB661 /* Material.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -49,6 +54,7 @@
966F57941C226BAA009185B7 = {
isa = PBXGroup;
children = (
966015D81CB2B0BA00AAB661 /* Material.framework */,
966F579F1C226BAA009185B7 /* TextField */,
966F579E1C226BAA009185B7 /* Products */,
);
......@@ -84,7 +90,7 @@
966F57991C226BAA009185B7 /* Sources */,
966F579A1C226BAA009185B7 /* Frameworks */,
966F579B1C226BAA009185B7 /* Resources */,
966F57B51C226CA3009185B7 /* Embed Frameworks */,
966015DB1CB2B0BA00AAB661 /* Embed Frameworks */,
);
buildRules = (
);
......
......@@ -64,17 +64,6 @@ class ViewController: UIViewController, TextFieldDelegate {
textField.titleLabelColor = MaterialColor.grey.base
textField.titleLabelActiveColor = MaterialColor.blue.accent3
let image: UIImage? = MaterialIcon.close
let clearButton: FlatButton = FlatButton()
clearButton.pulseColor = MaterialColor.grey.base
clearButton.pulseScale = false
clearButton.tintColor = MaterialColor.grey.base
clearButton.setImage(image, forState: .Normal)
clearButton.setImage(image, forState: .Highlighted)
textField.clearButton = clearButton
view.addSubview(textField)
}
......@@ -102,17 +91,6 @@ class ViewController: UIViewController, TextFieldDelegate {
textField.detailLabelActiveColor = MaterialColor.red.accent3
// textField.detailLabelAutoHideEnabled = false // Uncomment this line to have manual hiding.
let image: UIImage? = MaterialIcon.close
let clearButton: FlatButton = FlatButton()
clearButton.pulseColor = MaterialColor.grey.base
clearButton.pulseScale = false
clearButton.tintColor = MaterialColor.grey.base
clearButton.setImage(image, forState: .Normal)
clearButton.setImage(image, forState: .Highlighted)
textField.clearButton = clearButton
view.addSubview(textField)
}
......
......@@ -7,8 +7,6 @@
objects = {
/* Begin PBXBuildFile section */
96E01FD61CB0474500411B61 /* Material.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 96E01FD51CB0474500411B61 /* Material.framework */; };
96E01FD71CB0474500411B61 /* Material.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 96E01FD51CB0474500411B61 /* Material.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
96F2F2151C97AFC600A5FE27 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96F2F20D1C97AFC600A5FE27 /* AppDelegate.swift */; };
96F2F2161C97AFC600A5FE27 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 96F2F20E1C97AFC600A5FE27 /* Assets.xcassets */; };
96F2F2171C97AFC600A5FE27 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 96F2F20F1C97AFC600A5FE27 /* LaunchScreen.storyboard */; };
......@@ -23,7 +21,6 @@
dstPath = "";
dstSubfolderSpec = 10;
files = (
96E01FD71CB0474500411B61 /* Material.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
......@@ -31,7 +28,6 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
96E01FD51CB0474500411B61 /* Material.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; name = Material.framework; path = "/Users/danieldahan/Library/Developer/Xcode/DerivedData/Material-hbpnflxhoouqxebjcyhbbhqyesjd/Build/Products/Debug-iphonesimulator/Material.framework"; sourceTree = "<absolute>"; };
96F2F20D1C97AFC600A5FE27 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
96F2F20E1C97AFC600A5FE27 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
96F2F2101C97AFC600A5FE27 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
......@@ -46,7 +42,6 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
96E01FD61CB0474500411B61 /* Material.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -69,7 +64,6 @@
9ABEC5081C15085400F6895E = {
isa = PBXGroup;
children = (
96E01FD51CB0474500411B61 /* Material.framework */,
96F2F20C1C97AFC600A5FE27 /* Toolbar */,
9ABEC5121C15085400F6895E /* Products */,
);
......
......@@ -46,6 +46,7 @@ public struct MaterialIcon {
public static let add: UIImage? = UIImage(named: "ic_add_white", inBundle: bundle, compatibleWithTraitCollection: nil)?.imageWithRenderingMode(.AlwaysTemplate)
public static let arrowBack: UIImage? = UIImage(named: "ic_arrow_back_white", inBundle: bundle, compatibleWithTraitCollection: nil)?.imageWithRenderingMode(.AlwaysTemplate)
public static let arrowDownward: UIImage? = UIImage(named: "ic_arrow_downward_white", inBundle: bundle, compatibleWithTraitCollection: nil)?.imageWithRenderingMode(.AlwaysTemplate)
public static let bell: UIImage? = UIImage(named: "ic_bell_white", inBundle: bundle, compatibleWithTraitCollection: nil)?.imageWithRenderingMode(.AlwaysTemplate)
public static let clear: UIImage? = UIImage(named: "ic_close_white", inBundle: bundle, compatibleWithTraitCollection: nil)?.imageWithRenderingMode(.AlwaysTemplate)
public static let close: UIImage? = UIImage(named: "ic_close_white", inBundle: bundle, compatibleWithTraitCollection: nil)?.imageWithRenderingMode(.AlwaysTemplate)
public static let menu: UIImage? = UIImage(named: "ic_menu_white", inBundle: bundle, compatibleWithTraitCollection: nil)?.imageWithRenderingMode(.AlwaysTemplate)
......
......@@ -34,16 +34,6 @@ public class SearchBar : StatusBarView {
/// The UITextField for the searchBar.
public private(set) lazy var textField: TextField = TextField()
/// The UIImage for the clear icon.
public var clearButton: UIButton? {
get {
return textField.clearButton
}
set(value) {
textField.clearButton = value
}
}
/// TintColor for searchBar.
@IBInspectable public override var tintColor: UIColor? {
didSet {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment