Skip to content

Commit

Permalink
remove warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
magicmon committed Apr 7, 2017
1 parent b1a151b commit fd15f46
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Example/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
FBSnapshotTestCase: '094f9f314decbabe373b87cc339bea235a63e07a'
Mentions: c00c32aacea71e10382e31f662264e1417bbba8e
Mentions: faa1a9602511fc7d1379b835b44225a8797b0a52

PODFILE CHECKSUM: 5f1cc487160907907ff307f780e99b771cf671f0

Expand Down
2 changes: 1 addition & 1 deletion Mentions.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
Pod::Spec.new do |s|
s.name = 'Mentions'
s.version = '0.1.0'
s.summary = 'A short description of Mentions.'
s.summary = 'An easy way to add mentions in UITextView.'

# This description is used to generate tags and improve search results.
# * Think: What does it do? Why did you write it? What is the focus?
Expand Down
18 changes: 9 additions & 9 deletions Mentions/Classes/MentionParser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ extension UIView {
// print("\(matchText)")

// TODO: [, ], /의 개수를 찾아 제거.
for user in matchUsers {
let string = matchText.substring(to: matchText.index(matchText.startIndex, offsetBy: user.1.location))
// print("<\(string)>")

if let idx = string.characters.index(of: "[") {
let pos = string.characters.distance(from: string.startIndex, to: idx)
// print("Found [ at position \(pos)")
}
}
// for user in matchUsers {
// let string = matchText.substring(to: matchText.index(matchText.startIndex, offsetBy: user.1.location))
// print("<\(string)>")
//
// if let idx = string.characters.index(of: "[") {
// let pos = string.characters.distance(from: string.startIndex, to: idx)
// print("Found [ at position \(pos)")
// }
// }


// replacing
Expand Down
4 changes: 2 additions & 2 deletions Mentions/Classes/UIView/MentionLabel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ public class MentionLabel: UILabel {

let (matchText, matchUsers) = self.parse(self.text, pattern: pattern, template: "$1")

if var matchText = matchText {
if let matchText = matchText {
var attributes = [NSFontAttributeName: self.font, NSForegroundColorAttributeName : self.textColor] as [String : Any]
let muAttrString = NSAttributedString(string: matchText)
textStorage.setAttributedString(muAttrString)
textStorage.setAttributes(attributes, range: NSRange(location: 0, length: muAttrString.length))

// append attributes
if let matchUsers = matchUsers {
for (matchUser, range) in matchUsers {
for (_, range) in matchUsers {
clickableRanges.append(range)
attributes[NSForegroundColorAttributeName] = highlightColor
textStorage.setAttributes(attributes, range: range)
Expand Down
2 changes: 1 addition & 1 deletion Mentions/Classes/UIView/MentionTextView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ extension MentionTextView: UITextViewDelegate {
refresh()
}

guard var range = replaceValues.range else {
guard let range = replaceValues.range else {
return
}

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[![Support](https://img.shields.io/badge/support-iOS%208%2B%20-blue.svg?style=flat)](https://www.apple.com/nl/ios/)
![Language](https://img.shields.io/badge/Language-%20swift%20%20-blue.svg)

An easy way to add mentions.
An easy way to add mentions in UITextView.

## Demo
![Demo](https://raw.githubusercontent.com/magicmon/Mentions/master/Screenshots/Demo.gif)
Expand Down

0 comments on commit fd15f46

Please sign in to comment.