-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added hidden property for all objects and placeholder property for UI…
…TextFields
- Loading branch information
1 parent
518981c
commit 8c01413
Showing
4 changed files
with
39 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// | ||
// TextFieldPropertyParser.swift | ||
// EverLayout | ||
// | ||
// Created by Dale Webster on 22/03/2017. | ||
// Copyright © 2017 Dale Webster. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
|
||
class TextFieldPropertyResolver: PropertyResolver { | ||
override public var exposedProperties: [String : (String) -> Void] { | ||
var props = super.exposedProperties | ||
|
||
props["placeholder"] = {(source) in | ||
if let textField = self.view as? UITextField { | ||
textField.placeholder = PropertyResolver.string(value: source) ?? "" | ||
} | ||
} | ||
|
||
return props | ||
} | ||
} | ||
|
||
extension UITextField { | ||
override open func applyViewProperty(viewProperty: ELViewProperty) { | ||
super.applyViewProperty(viewProperty: viewProperty) | ||
|
||
TextFieldPropertyResolver(view: self).apply(viewProperty: viewProperty) | ||
} | ||
} |