Skip to content

Commit

Permalink
Merge pull request #7 from eddiekaiger/version-3.1.0
Browse files Browse the repository at this point in the history
Version 3.1.0
  • Loading branch information
eddiekaiger authored Dec 13, 2016
2 parents b5c56e1 + 46a6705 commit 8de3a08
Show file tree
Hide file tree
Showing 41 changed files with 3,036 additions and 613 deletions.
10 changes: 8 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
language: objective-c
osx_image: xcode8

env:
- PLATFORM=iOS CODECOV=ios DESTINATION='platform=iOS Simulator,name=iPhone 6S'
- PLATFORM=Mac CODECOV=osx DESTINATION='platform=OS X'
- PLATFORM=tvOS CODECOV=tvos DESTINATION='platform=tvOS Simulator,name=Apple TV 1080p'

script:
- xcodebuild -version
- xcodebuild -project SwiftyAttributes.xcodeproj -scheme SwiftyAttributesTests -sdk iphonesimulator -destination "platform=iOS Simulator,name=iPhone 6" -configuration Debug ONLY_ACTIVE_ARCH=YES -enableCodeCoverage YES test
- bash <(curl -s https://codecov.io/bash) -cF ios
- xcodebuild -project SwiftyAttributes.xcodeproj -scheme "SwiftyAttributes" -destination "$DESTINATION" -configuration Debug -enableCodeCoverage YES CODE_SIGNING_REQUIRED=NO test
- bash <(curl -s https://codecov.io/bash) -cF "$CODECOV"
6 changes: 3 additions & 3 deletions ExampleApp-iOS/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ class ViewController: UITableViewController {

private let attributedStrings: [NSAttributedString] = [
{
let attachment = NSTextAttachment()
let attachment = TextAttachment()
attachment.image = UIImage(named: "Star")
let str = NSMutableAttributedString(string: "Attachment With Image")
let str = "Attachment With Image".attributedString
str.replaceCharacters(in: 10 ..< 12, with: NSAttributedString(attachment: attachment))
return str
}(),
Expand All @@ -31,7 +31,7 @@ class ViewController: UITableViewController {
"Link".withLink(URL(string: "https://google.com")!),
"Obliqueness".withObliqueness(2),
"Shadow".withShadow({
let shadow = NSShadow()
let shadow = Shadow()
shadow.shadowBlurRadius = 2
shadow.shadowOffset = CGSize(width: 3, height: -4)
return shadow
Expand Down
12 changes: 12 additions & 0 deletions ExampleApp-macOS/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//
// AppDelegate.swift
// ExampleApp-macOS
//
// Created by Eddie Kaiger on 11/26/16.
// Copyright © 2016 Eddie Kaiger. All rights reserved.
//

import Cocoa

@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate { }
58 changes: 58 additions & 0 deletions ExampleApp-macOS/Assets.xcassets/AppIcon.appiconset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"images" : [
{
"idiom" : "mac",
"size" : "16x16",
"scale" : "1x"
},
{
"idiom" : "mac",
"size" : "16x16",
"scale" : "2x"
},
{
"idiom" : "mac",
"size" : "32x32",
"scale" : "1x"
},
{
"idiom" : "mac",
"size" : "32x32",
"scale" : "2x"
},
{
"idiom" : "mac",
"size" : "128x128",
"scale" : "1x"
},
{
"idiom" : "mac",
"size" : "128x128",
"scale" : "2x"
},
{
"idiom" : "mac",
"size" : "256x256",
"scale" : "1x"
},
{
"idiom" : "mac",
"size" : "256x256",
"scale" : "2x"
},
{
"idiom" : "mac",
"size" : "512x512",
"scale" : "1x"
},
{
"idiom" : "mac",
"size" : "512x512",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
6 changes: 6 additions & 0 deletions ExampleApp-macOS/Assets.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
750 changes: 750 additions & 0 deletions ExampleApp-macOS/Base.lproj/Main.storyboard

Large diffs are not rendered by default.

32 changes: 32 additions & 0 deletions ExampleApp-macOS/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2016 Eddie Kaiger. All rights reserved.</string>
<key>NSMainStoryboardFile</key>
<string>Main</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>
72 changes: 72 additions & 0 deletions ExampleApp-macOS/ViewController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
//
// ViewController.swift
// ExampleApp-macOS
//
// Created by Eddie Kaiger on 11/26/16.
// Copyright © 2016 Eddie Kaiger. All rights reserved.
//

import Cocoa
import SwiftyAttributes

class ViewController: NSViewController {

fileprivate let attributedStrings: [NSAttributedString] = [
{
let attachment = TextAttachment()
attachment.image = NSImage(named: "Star")!
let str = "Attachment With Image".attributedString
str.replaceCharacters(in: 10 ..< 12, with: NSAttributedString(attachment: attachment))
return str
}(),
"Baseline Offset".withBaselineOffset(8.5),
"Background Color".withBackgroundColor(.blue),
"Expansion".withExpansion(0.8),
"Font".withFont(.boldSystemFont(ofSize: 20)),
"Kern".withKern(5.1),
"Default Ligatures".withLigatures(.default),
"No Ligatures".withLigatures(.none),
"Link".withLink(URL(string: "https://google.com")!),
"Obliqueness".withObliqueness(2),
"Shadow".withShadow({
let shadow = Shadow()
shadow.shadowBlurRadius = 2
shadow.shadowOffset = CGSize(width: 3, height: -4)
return shadow
}()),
"Stroke Color".withStrokeColor(.orange).withStrokeWidth(1),
"Stroke Width".withStrokeWidth(2.7),
"Strikethrough Style & Color".withStrikethroughColor(.green).withStrikethroughStyle(.styleDouble),
"Text Color".withTextColor(.brown),
"Text Effect".withTextEffect(.letterPressStyle),
"Underline Style & Color".withUnderlineColor(.red).withUnderlineStyle(.styleDouble),
"Writing Directions".withWritingDirections([.rightToLeftOverride]),
"Multiple Attributes".withAttributes([.baselineOffset(5), .font(.boldSystemFont(ofSize: 20)), .kern(4), .underlineStyle(.styleSingle), .underlineColor(.magenta), .strokeColor(.orange), .strokeWidth(3), .strikethroughColor(.green), .strikethroughStyle(.styleSingle), .backgroundColor(.yellow)]),
{
let str = "Partial Range Attributes".withUnderlineStyle(.styleSingle)
str.addAttributes([.underlineStyle(.styleDouble), .textColor(.blue)], range: 3 ..< 8)
str.addAttributes([.strikethroughStyle(.styleThick), .strikethroughColor(.purple)], range: 16 ..< 22)
str.setAttributes([.textColor(.red)], range: 22 ..< 24)
return str
}()
]

override func viewDidLoad() {
super.viewDidLoad()


}

}

extension ViewController: NSTableViewDataSource {

func numberOfRows(in tableView: NSTableView) -> Int {
return attributedStrings.count
}

func tableView(_ tableView: NSTableView, objectValueFor tableColumn: NSTableColumn?, row: Int) -> Any? {
return attributedStrings[row]
}

}
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ Initializing attributed strings in `SwiftyAttributes` can be done several ways:
- Using the `Attribute` enum extensions:
````swift
"Hello World".withAttributes([.underlineColor(.red), underlineStyle(.styleDouble)])
"Hello World".withAttributes([.underlineColor(.red), .underlineStyle(.styleDouble)])
````
- Using the `Attribute` enum in an initializer:
Expand Down Expand Up @@ -127,24 +127,24 @@ extension NSAttributedString {
func withAttribute(_ attribute: Attribute) -> NSMutableAttributedString
func attributedSubstring(from range: Range<Int>) -> NSAttributedString
func attribute(_ attrName: Attribute.Name, at location: Int, effectiveRange range: NSRangePointer? = nil) -> Attribute?
func attributes(in range: Range<Int>, options: NSAttributedString.EnumerationOptions = []) -> [([Attribute], Range<Int>)]
func enumerateAttributes(in enumerationRange: Range<Int>, options: NSAttributedString.EnumerationOptions = [], using block: (_ attrs: [Attribute], _ range: Range<Int>, _ stop: UnsafeMutablePointer<ObjCBool>) -> Void)
func enumerateAttribute(_ attrName: Attribute.Name, in enumerationRange: Range<Int>, options: NSAttributedString.EnumerationOptions = [], using block: (_ value: Any?, _ range: Range<Int>, _ stop: UnsafeMutablePointer<ObjCBool>) -> Void)
}
extension String {
var attributedString: NSMutableAttributedString
func withAttributes(_ attributes: [Attribute]) -> NSMutableAttributedString
func withAttribute(_ attribute: Attribute) -> NSMutableAttributedString
}
````
# Goals
// ... and more!
The goal of version 3.1.0 will be full support for macOS, tvOS, and watchOS as well as additional helper methods to retrieve and enumerate attributes in an attributed string.
If you have suggestions and feature requests, please feel free to open up an issue.
````
# Support
For questions and support, please open up an issue.
For questions, support, and suggestions, please open up an issue.
# License
Expand Down
18 changes: 12 additions & 6 deletions SwiftyAttributes.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,26 @@
Pod::Spec.new do |s|

s.name = "SwiftyAttributes"
s.version = "3.0.0"
s.summary = "Swift extensions that make it a breeze to work with attributed strings."
s.version = "3.1.0"
s.summary = "A Swifty API for attributed strings."

s.description = <<-DESC
SwiftyAttributes provides extensions for the String and NSAttributedString classes that make it easier to create and modify attributed strings.
SwiftyAttributes provides a clean, Swifty API for dealing with NSAttributedStrings.
DESC

s.homepage = "https://github.com/eddiekaiger/SwiftyAttributes"
s.license = { :type => "MIT", :file => "LICENSE" }
s.author = { "Eddie Kaiger" => "eddiekaiger@gmail.com" }
s.source = { :git => "https://github.com/eddiekaiger/SwiftyAttributes.git", :tag => "v3.0.0" }
s.source_files = "SwiftyAttributes/*.swift"
s.platform = :ios, '8.0'
s.source = { :git => "https://github.com/eddiekaiger/SwiftyAttributes.git", :tag => "v3.1.0" }

s.source_files = "SwiftyAttributes/Sources/common/*.swift"
s.osx.source_files = "SwiftyAttributes/Sources/macOS/*.swift"

s.ios.deployment_target = '8.0'
s.osx.deployment_target = '10.11'
s.tvos.deployment_target = '9.0'
s.watchos.deployment_target = '2.0'

end
Loading

0 comments on commit 8de3a08

Please sign in to comment.