Update documentation
This commit is contained in:
parent
ad85f71bd2
commit
637703bd5e
|
@ -1,6 +1,6 @@
|
||||||
Pod::Spec.new do |s|
|
Pod::Spec.new do |s|
|
||||||
s.name = "DSFFloatLabelledTextControl"
|
s.name = "DSFFloatLabelledTextControl"
|
||||||
s.version = "1.8.0"
|
s.version = "2.0.0"
|
||||||
s.summary = "A macOS Cocoa single-line NSTextField/NSSecureTextField that implements the Float Label Pattern"
|
s.summary = "A macOS Cocoa single-line NSTextField/NSSecureTextField that implements the Float Label Pattern"
|
||||||
s.description = <<-DESC
|
s.description = <<-DESC
|
||||||
A macOS Cocoa single-line NSTextField/NSSecureTextField that implements the Float Label Pattern.
|
A macOS Cocoa single-line NSTextField/NSSecureTextField that implements the Float Label Pattern.
|
||||||
|
|
30
README.md
30
README.md
|
@ -1,8 +1,9 @@
|
||||||
# macOS Float Label Pattern Text Field
|
# 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. Supports secure edit fields.
|
A macOS Cocoa single-line NSTextField/NSSecureTextField that implements the Float Label Pattern.
|
||||||
|
You can read about the float pattern [here](http://mds.is/float-label-pattern/).
|
||||||
|
|
||||||
  
|
   
|
||||||
 [](https://cocoapods.org) [](https://swift.org/package-manager)
|
 [](https://cocoapods.org) [](https://swift.org/package-manager)
|
||||||
|
|
||||||
## Screenshot
|
## Screenshot
|
||||||
|
@ -23,9 +24,6 @@ Add `https://github.com/dagronf/DSFFloatLabelledTextControl` to your project.
|
||||||
|
|
||||||
Add `pod 'DSFFloatLabelledTextControl', :git => 'https://github.com/dagronf/DSFFloatLabelledTextControl'` to your podfile.
|
Add `pod 'DSFFloatLabelledTextControl', :git => 'https://github.com/dagronf/DSFFloatLabelledTextControl'` to your podfile.
|
||||||
|
|
||||||
### Directly
|
|
||||||
Copy the `DSFFloatLabelledTextField.swift` into your project. This class inherits directly from `NSTextField` so all settings that you make on a text field (eg. alignment) should also apply here.
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
### Interface builder
|
### Interface builder
|
||||||
|
@ -48,32 +46,19 @@ parentView.addSubview(field)
|
||||||
|
|
||||||
## Custom Properties
|
## Custom Properties
|
||||||
|
|
||||||
This control inherits from `NSTextField`, so all `NSTextField` functionalities (like cocoa binding and Interface Builder settings) are available. If you can use an NSTextField, you can use this control.
|
These controls inherit from `NSTextField`, so all `NSTextField` functionalities (like cocoa binding and Interface Builder settings) are available. If you can use an NSTextField, you can use this control.
|
||||||
|
|
||||||
`placeholderTextSize` - the size of the text used in the floating label (in pt)
|
* `placeholderTextSize` - the size of the text used in the floating label (in pt)
|
||||||
|
* `placeholderSpacing` - the distance between the text field text and the floating label (in px)
|
||||||
`placeholderSpacing` - the distance between the text field text and the floating label (in px)
|
|
||||||
|
|
||||||
## Delegate Handling
|
## Delegate Handling
|
||||||
|
|
||||||
You can specify a delegate (`floatLabelDelegate`), either programatically or via Interface Builder, to receive additional information regarding the actions of the control.
|
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
|
## 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"/>
|
<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
|
## Credits
|
||||||
|
|
||||||
* Pattern devised by [Matt D. Smith](http://mds.is/matt/)
|
* Pattern devised by [Matt D. Smith](http://mds.is/matt/)
|
||||||
|
@ -82,7 +67,8 @@ You can specify a delegate (`floatLabelDelegate`), either programatically or via
|
||||||
|
|
||||||
## Versions
|
## Versions
|
||||||
|
|
||||||
* `1.8.0` Added secure text field support, delegate support
|
* `2.0.0`: Moved secure text field into separate class (fixing security warnings in modern Xcode)
|
||||||
|
* `1.8.0`: Added secure text field support, delegate support
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue