Skip to content

Commit

Permalink
Update for Swift 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
MoZhouqi committed Sep 18, 2015
1 parent c9968c4 commit 6b3abce
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Example/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class ViewController: UIViewController {
func keyboardWasShown(notification: NSNotification)
{
let info = notification.userInfo
var kbRect = info![UIKeyboardFrameEndUserInfoKey]!.CGRectValue()
var kbRect = info![UIKeyboardFrameEndUserInfoKey]!.CGRectValue
kbRect = view.convertRect(kbRect, fromView: nil)

var contentInsets = placeholderTextView.contentInset
Expand Down
2 changes: 1 addition & 1 deletion KMPlaceholderTextView.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|

s.name = "KMPlaceholderTextView"
s.version = "0.1.2"
s.version = "1.0.0"
s.summary = "A UITextView subclass that adds support for multiline placeholder written in Swift."

s.description = <<-DESC
Expand Down
1 change: 1 addition & 0 deletions KMPlaceholderTextView.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@
CD2064E81AA18E6900E1F272 /* Project object */ = {
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0700;
LastUpgradeCheck = 0610;
ORGANIZATIONNAME = "Zhouqi Mo";
TargetAttributes = {
Expand Down
10 changes: 5 additions & 5 deletions KMPlaceholderTextView/KMPlaceholderTextView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,14 @@ public class KMPlaceholderTextView: UITextView {
}
}

var placeholderLabelConstraints = [AnyObject]()
var placeholderLabelConstraints = [NSLayoutConstraint]()

override init(frame: CGRect, textContainer: NSTextContainer?) {
super.init(frame: frame, textContainer: textContainer)
commonInit()
}

required public init(coder aDecoder: NSCoder) {
required public init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
commonInit()
}
Expand All @@ -98,7 +98,7 @@ public class KMPlaceholderTextView: UITextView {
placeholderLabel.text = placeholder
placeholderLabel.numberOfLines = 0
placeholderLabel.backgroundColor = UIColor.clearColor()
placeholderLabel.setTranslatesAutoresizingMaskIntoConstraints(false)
placeholderLabel.translatesAutoresizingMaskIntoConstraints = false
addSubview(placeholderLabel)

updateConstraintsForPlaceholderLabel()
Expand All @@ -107,11 +107,11 @@ public class KMPlaceholderTextView: UITextView {

func updateConstraintsForPlaceholderLabel() {
var newConstraints = NSLayoutConstraint.constraintsWithVisualFormat("H:|-(\(textContainerInset.left + textContainer.lineFragmentPadding))-[placeholder]-(\(textContainerInset.right + textContainer.lineFragmentPadding))-|",
options: nil,
options: [],
metrics: nil,
views: ["placeholder": placeholderLabel])
newConstraints += NSLayoutConstraint.constraintsWithVisualFormat("V:|-(\(textContainerInset.top))-[placeholder]-(>=\(textContainerInset.bottom))-|",
options: nil,
options: [],
metrics: nil,
views: ["placeholder": placeholderLabel])
removeConstraints(placeholderLabelConstraints)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Simply add the following line to your Podfile:
platform :ios, '8.0'
use_frameworks!

pod 'KMPlaceholderTextView', '~> 0.1.2'
pod 'KMPlaceholderTextView', '~> 1.0.0'
```

Then, run the following command:
Expand Down Expand Up @@ -71,7 +71,7 @@ github "MoZhouqi/KMPlaceholderTextView" >= 1.0
## Requirements

- iOS 7.0+
- Xcode 6.3
- Xcode 7

## License

Expand Down

0 comments on commit 6b3abce

Please sign in to comment.