Skip to content

Commit

Permalink
Migrate codebase to Swift 5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Botond Magyarosi committed Nov 18, 2019
1 parent 29a5172 commit 4e75c40
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 21 deletions.
4 changes: 2 additions & 2 deletions AttributedStringTag.podspec
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
Pod::Spec.new do |s|
s.name = "AttributedStringTag"
s.version = "1.0.0"
s.version = "1.0.1"
s.homepage = "https://github.com/magyarosibotond/AttributedStringTag"
s.license = { :type => "MIT", :file => "LICENSE" }
s.author = "Botond Magyarosi"
s.summary = "Small framework for easily applying attributes to NSAttributedString."

s.swift_version = "4.2"
s.swift_version = "5.1"

s.ios.deployment_target = '8.0'
s.osx.deployment_target = '10.10'
Expand Down
22 changes: 5 additions & 17 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,28 +1,16 @@
// swift-tools-version:4.2
// swift-tools-version:5.1
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "AttributedStringTag",
products: [
// Products define the executables and libraries produced by a package, and make them visible to other packages.
.library(
name: "AttributedStringTag",
targets: ["AttributedStringTag"]),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
.library(name: "AttributedStringTag", targets: ["AttributedStringTag"]),
],
dependencies: [],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages which this package depends on.
.target(
name: "AttributedStringTag",
dependencies: []),
.testTarget(
name: "AttributedStringTagTests",
dependencies: ["AttributedStringTag"]),
.target(name: "AttributedStringTag", dependencies: []),
.testTarget(name: "AttributedStringTagTests", dependencies: ["AttributedStringTag"]),
]
)
2 changes: 1 addition & 1 deletion Sources/AttributedStringTag/NSAttributedString+Tag.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public extension NSAttributedString {
/// - Parameters:
/// - string: input string with tags
/// - tagsAndAttributes: a map of tags an attributes
public convenience init(string: String, applyingAttributesForTag tagsAndAttributes: [Tag: [NSAttributedString.Key: Any]]) {
convenience init(string: String, applyintAttributesForTag tagsAndAttributes: [Tag: [NSAttributedString.Key: Any]]) {

This comment has been minimized.

Copy link
@kevinrenskers

kevinrenskers Nov 18, 2019

You have undone your typo fix here :)

This comment has been minimized.

Copy link
@magyarosibotond

magyarosibotond Nov 18, 2019

Owner

fixed

let attributedString = NSMutableAttributedString(string: string)
for (tag, attributes) in tagsAndAttributes {
attributedString.setAttributes(attributes, forTag: tag)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public extension NSMutableAttributedString {
/// - tag: a tag string. ex.: "b"
/// - Returns: self reference for better chainability
@discardableResult
public func setAttributes(_ attributes: [NSAttributedString.Key: Any], forTag tag: String) -> NSMutableAttributedString {
func setAttributes(_ attributes: [NSAttributedString.Key: Any], forTag tag: String) -> NSMutableAttributedString {
let tagLength = tag.count + 2
do {
let expression = try NSRegularExpression(pattern: "<\(tag)>(.*?)</\(tag)>", options: [])
Expand Down

0 comments on commit 4e75c40

Please sign in to comment.