Skip to content

Commit

Permalink
v0.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
touyu committed May 14, 2017
1 parent 5a72e2e commit d6d1cce
Show file tree
Hide file tree
Showing 25 changed files with 1,233 additions and 168 deletions.
269 changes: 269 additions & 0 deletions Carthage/Build/iOS/82051E20-23AA-3CC8-9BBC-D0F3D612D93C.bcsymbolmap

Large diffs are not rendered by default.

276 changes: 276 additions & 0 deletions Carthage/Build/iOS/B921B6E4-E339-375C-B8C9-B3FE3C95F619.bcsymbolmap

Large diffs are not rendered by default.

269 changes: 269 additions & 0 deletions Carthage/Build/iOS/D8E889BC-A35B-3684-924C-D2A22A04CC07.bcsymbolmap

Large diffs are not rendered by default.

276 changes: 276 additions & 0 deletions Carthage/Build/iOS/DC99CEB7-DCE8-3434-9725-E35B026F5FDB.bcsymbolmap

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified Carthage/Build/iOS/SwiftyAttributedString.framework/Info.plist
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

This file was deleted.

This file was deleted.

Binary file not shown.
2 changes: 1 addition & 1 deletion SwiftyAttributedString/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>0.2</string>
<string>0.3.0</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
Expand Down
8 changes: 4 additions & 4 deletions SwiftyAttributedString/Sources/Attribute.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public enum AttributeRange {
case range(NSRange)
}

func toNSRange(string: String) -> NSRange {
public func toNSRange(string: String) -> NSRange {

switch self {
case .all:
Expand All @@ -54,10 +54,10 @@ public enum AttributeRange {
}

public struct Attribute {
var value: AttributeValue
var range: AttributeRange
public var value: AttributeValue
public var range: AttributeRange

init(value: AttributeValue, range: AttributeRange = .all) {
public init(value: AttributeValue, range: AttributeRange = .all) {
self.value = value
self.range = range
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import UIKit

public extension NSMutableAttributedString {
func add(attribute: Attribute) -> NSMutableAttributedString {
public func add(attribute: Attribute) -> NSMutableAttributedString {
let text = self.string
let range = attribute.range.toNSRange(string: text)

Expand Down Expand Up @@ -47,7 +47,7 @@ public extension NSMutableAttributedString {
return self
}

func add(attributeValue: AttributeValue) -> NSMutableAttributedString {
public func add(attributeValue: AttributeValue) -> NSMutableAttributedString {
return self.add(attribute: Attribute(value: attributeValue, range: .all))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,22 @@ import UIKit

public extension String {

func findRange(_ string: String?) -> NSRange {
public func findRange(_ string: String?) -> NSRange {
guard let string = string else { return NSRange() }
let titleRange = (self as NSString).range(of: string)
return titleRange
}

func add(attribute: Attribute) -> NSMutableAttributedString {
public func add(attribute: Attribute) -> NSMutableAttributedString {
let attributedString = NSMutableAttributedString(string: self)
return attributedString.add(attribute: attribute)
}

func add(attributeValue: AttributeValue) -> NSMutableAttributedString {
public func add(attributeValue: AttributeValue) -> NSMutableAttributedString {
return self.add(attribute: Attribute(value: attributeValue, range: .all))
}

func add(attributes: [Attribute]) -> NSMutableAttributedString {
public func add(attributes: [Attribute]) -> NSMutableAttributedString {
var attributedString = NSMutableAttributedString(string: self)
for attribute in attributes {
attributedString = attributedString.add(attribute: attribute)
Expand Down

0 comments on commit d6d1cce

Please sign in to comment.