Added secure text field support, delegate support, updated doco
This commit is contained in:
parent
8981182b38
commit
35523f5ec7
|
@ -1,9 +1,9 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = "DSFFloatLabelledTextControl"
|
||||
s.version = "1.7.0"
|
||||
s.version = "1.8.0"
|
||||
s.summary = "A macOS Cocoa single-line NSTextField that implements the Float Label Pattern"
|
||||
s.description = <<-DESC
|
||||
A macOS Cocoa single-line NSTextField that implements the Float Label Pattern.
|
||||
A macOS Cocoa single-line NSTextField that implements the Float Label Pattern. Supports secure edit fields.
|
||||
DESC
|
||||
s.homepage = "https://github.com/dagronf/DSFFloatLabelledTextControl"
|
||||
s.license = { :type => "MIT", :file => "LICENSE" }
|
||||
|
|
27
README.md
27
README.md
|
@ -1,6 +1,6 @@
|
|||
# macOS Float Label Pattern Text Field
|
||||
|
||||
A macOS Cocoa single-line NSTextField that implements the Float Label Pattern. You can read about the float pattern [here](http://mds.is/float-label-pattern/). Usable in Swift and Objective-C projects.
|
||||
A macOS Cocoa single-line NSTextField that implements the Float Label Pattern. You can read about the float pattern [here](http://mds.is/float-label-pattern/). Usable in Swift and Objective-C projects. Supports secure edit fields.
|
||||
|
||||
  
|
||||
 [](https://cocoapods.org) [](https://swift.org/package-manager)
|
||||
|
@ -33,6 +33,7 @@ Copy the `DSFFloatLabelledTextField.swift` into your project. This class inheri
|
|||
* Drop in a new Text Field into your canvas and set its class to `DSFFloatLabelledTextField`
|
||||
* Set the size and style of your primary font as you would a regular text field
|
||||
* Set the size of the secondary font via the attributes inspector for the control
|
||||
* If you want a secure field, set the `isSecure` property on the control
|
||||
|
||||
### Dynamically
|
||||
|
||||
|
@ -53,12 +54,36 @@ This control inherits from `NSTextField`, so all `NSTextField` functionalities (
|
|||
|
||||
`placeholderSpacing` - the distance between the text field text and the floating label (in px)
|
||||
|
||||
## Delegate Handling
|
||||
|
||||
You can specify a delegate (`floatLabelDelegate`), either programatically or via Interface Builder, to receive additional information regarding the actions of the control.
|
||||
|
||||
```swift
|
||||
@objc public protocol DSFFloatLabelledTextFieldDelegate: NSObjectProtocol {
|
||||
/// Called when the label is shown or hidden
|
||||
@objc optional func floatLabelledTextField(_ field: DSFFloatLabelledTextField, didShowFloatingLabel didShow: Bool)
|
||||
/// Called when the field becomes or loses first responder status
|
||||
@objc optional func floatLabelledTextField(_ field: DSFFloatLabelledTextField, didFocus: Bool)
|
||||
/// Called when the content of the field changes
|
||||
@objc optional func floatLabelledTextFieldContentChanged(_ field: DSFFloatLabelledTextField)
|
||||
}
|
||||
```
|
||||
|
||||
## Screenshot
|
||||
|
||||
<img src="https://github.com/dagronf/dagronf.github.io/blob/master/art/projects/DSFFloatingLabel/light-mode-secure-field.png?raw=true" alt="drawing" width="265"/>
|
||||
|
||||
|
||||
## Credits
|
||||
|
||||
* Pattern devised by [Matt D. Smith](http://mds.is/matt/)
|
||||
* Read about the pattern [here](http://mds.is/float-label-pattern/)
|
||||
* [UITextField implementation](https://github.com/jverdi/JVFloatLabeledTextField)
|
||||
|
||||
## Versions
|
||||
|
||||
* `1.8.0` Added secure text field support, delegate support
|
||||
|
||||
## License
|
||||
|
||||
```
|
||||
|
|
Loading…
Reference in New Issue