Skip to content

Commit

Permalink
Merge pull request #6 from trafi/spm
Browse files Browse the repository at this point in the history
Swift Package Manager support
  • Loading branch information
Domas Nutautas authored Apr 22, 2020
2 parents 2c54393 + f1791f6 commit c08af1a
Show file tree
Hide file tree
Showing 15 changed files with 56 additions and 23 deletions.
25 changes: 25 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// swift-tools-version:5.0
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "TextStyle",
products: [
// Products define the executables and libraries produced by a package, and make them visible to other packages.
.library(
name: "TextStyle",
targets: ["TextStyle"]),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
],
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: "TextStyle",
dependencies: []),
]
)
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
[![Swift Package Manager compatible](https://img.shields.io/badge/Swift%20Package%20Manager-compatible-brightgreen.svg)](https://github.com/apple/swift-package-manager) [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)

# TextStyle
Helps you manage text styles in your app.
Expand Down Expand Up @@ -45,7 +45,13 @@ In the Interface Builder set `Text Style` to match your style's name.
To see style changes right in the Interface Builder use `Designable` [UI elements classes](/TextStyleDesignables.swift). (i.e. `UILabelDesignable`). You should and add them to your project manually.

# Installation
Using [Carthage](https://github.com/Carthage/Carthage#adding-frameworks-to-an-application). Add the following line to your Cartfile:

### [Swift Package Manager](https://developer.apple.com/documentation/xcode/adding_package_dependencies_to_your_app)
Open your project in Xcode and select File > Swift Packages > Add Package Dependency. There enter `https://github.com/trafi/TextStyle` as the repository URL.

### [Carthage](https://github.com/Carthage/Carthage#adding-frameworks-to-an-application)

Add the following line to your `Cartfile`:
```
github "Trafi/TextStyle"
```
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
import UIKit

extension TextStyle {
public var attributes: [NSAttributedString.Key: AnyObject] {
public var attributes: [NSAttributedString.Key: Any] {

var attributes = [NSAttributedString.Key: AnyObject]()
var attributes = stringAttributes

attributes[.foregroundColor] = color
attributes[.font] = font
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file removed TextStyle.framework.zip
Binary file not shown.
40 changes: 21 additions & 19 deletions TextStyle.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
/* Begin PBXFileReference section */
D31C22751DAF7A9D00600BC3 /* TextStylable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextStylable.swift; sourceTree = "<group>"; };
D3347FD81E3A9E6300CF9AF3 /* TextStyleDesignables.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextStyleDesignables.swift; sourceTree = SOURCE_ROOT; };
D33BE5A924502F5400DE0A47 /* Package.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Package.swift; sourceTree = "<group>"; };
D35810471DAF66F50062BE59 /* TextStyleExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TextStyleExample.app; sourceTree = BUILT_PRODUCTS_DIR; };
D35810491DAF66F50062BE59 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
D358104B1DAF66F50062BE59 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -66,6 +67,18 @@
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
D33BE5CA2450318B00DE0A47 /* TextStyle */ = {
isa = PBXGroup;
children = (
D36852D61DAE4AC300EDFCA1 /* TextStyle.swift */,
D31C22751DAF7A9D00600BC3 /* TextStylable.swift */,
D36852D81DAE4B5100EDFCA1 /* IBInspectable.swift */,
D3C16B022449F4C700BA323F /* ReferenceWritableKeyPathSetter.swift */,
D36852DA1DAE4B9800EDFCA1 /* Extensions */,
);
path = TextStyle;
sourceTree = "<group>";
};
D35810481DAF66F50062BE59 /* TextStyleExample */ = {
isa = PBXGroup;
children = (
Expand All @@ -81,7 +94,9 @@
D36852C01DAE4A1B00EDFCA1 = {
isa = PBXGroup;
children = (
D36852CC1DAE4A1B00EDFCA1 /* TextStyle */,
D33BE5A924502F5400DE0A47 /* Package.swift */,
D3347FD81E3A9E6300CF9AF3 /* TextStyleDesignables.swift */,
D36852CC1DAE4A1B00EDFCA1 /* Sources */,
D35810481DAF66F50062BE59 /* TextStyleExample */,
D36852CB1DAE4A1B00EDFCA1 /* Products */,
);
Expand All @@ -96,26 +111,13 @@
name = Products;
sourceTree = "<group>";
};
D36852CC1DAE4A1B00EDFCA1 /* TextStyle */ = {
D36852CC1DAE4A1B00EDFCA1 /* Sources */ = {
isa = PBXGroup;
children = (
D36852D51DAE4A9300EDFCA1 /* Source */,
D33BE5CA2450318B00DE0A47 /* TextStyle */,
D36852CE1DAE4A1B00EDFCA1 /* Info.plist */,
);
path = TextStyle;
sourceTree = "<group>";
};
D36852D51DAE4A9300EDFCA1 /* Source */ = {
isa = PBXGroup;
children = (
D36852D61DAE4AC300EDFCA1 /* TextStyle.swift */,
D31C22751DAF7A9D00600BC3 /* TextStylable.swift */,
D36852D81DAE4B5100EDFCA1 /* IBInspectable.swift */,
D3C16B022449F4C700BA323F /* ReferenceWritableKeyPathSetter.swift */,
D3347FD81E3A9E6300CF9AF3 /* TextStyleDesignables.swift */,
D36852DA1DAE4B9800EDFCA1 /* Extensions */,
);
path = Source;
path = Sources;
sourceTree = "<group>";
};
D36852DA1DAE4B9800EDFCA1 /* Extensions */ = {
Expand Down Expand Up @@ -436,7 +438,7 @@
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = "$(SRCROOT)/TextStyle/Info.plist";
INFOPLIST_FILE = "$(SRCROOT)/Sources/Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = Trafi.TextStyle;
Expand All @@ -457,7 +459,7 @@
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = "$(SRCROOT)/TextStyle/Info.plist";
INFOPLIST_FILE = "$(SRCROOT)/Sources/Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = Trafi.TextStyle;
Expand Down

0 comments on commit c08af1a

Please sign in to comment.