diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..f193f92 Binary files /dev/null and b/.DS_Store differ diff --git a/.gitignore b/.gitignore index 2c22487..3b29812 100644 --- a/.gitignore +++ b/.gitignore @@ -1,65 +1,9 @@ -# Xcode -# -# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore - -## Build generated -build/ -DerivedData/ - -## Various settings -*.pbxuser -!default.pbxuser -*.mode1v3 -!default.mode1v3 -*.mode2v3 -!default.mode2v3 -*.perspectivev3 -!default.perspectivev3 +.DS_Store +/.build +/Packages +/*.xcodeproj xcuserdata/ - -## Other -*.moved-aside -*.xcuserstate - -## Obj-C/Swift specific -*.hmap -*.ipa -*.dSYM.zip -*.dSYM - -## Playgrounds -timeline.xctimeline -playground.xcworkspace - -# Swift Package Manager -# -# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. -# Packages/ -.build/ - -# CocoaPods -# -# We recommend against adding the Pods directory to your .gitignore. However -# you should judge for yourself, the pros and cons are mentioned at: -# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control -# -# Pods/ - -# Carthage -# -# Add this line if you want to avoid checking in source code from Carthage dependencies. -# Carthage/Checkouts - -Carthage/Build - -# fastlane -# -# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the -# screenshots whenever they are needed. -# For more information about the recommended setup visit: -# https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md - -fastlane/report.xml -fastlane/Preview.html -fastlane/screenshots -fastlane/test_output +DerivedData/ +.swiftpm/config/registries.json +.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata +.netrc diff --git a/Package.swift b/Package.swift new file mode 100644 index 0000000..797cfaf --- /dev/null +++ b/Package.swift @@ -0,0 +1,28 @@ +// swift-tools-version: 5.5 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +import PackageDescription + +let package = Package( + name: "HandyText", + products: [ + // Products define the executables and libraries a package produces, and make them visible to other packages. + .library( + name: "HandyText", + targets: ["HandyText"]), + ], + 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 this package depends on. + .target( + name: "HandyText", + dependencies: []), + .testTarget( + name: "HandyTextTests", + dependencies: ["HandyText"]), + ] +) diff --git a/README.md b/README.md old mode 100755 new mode 100644 index f7c831c..33216d6 --- a/README.md +++ b/README.md @@ -1,146 +1,3 @@ -HandyText --------------- - -Purpose --------------- -HandyText is a helper library that allows to create and manage text styles in a clear declarative manner. - -Problem solved --------------- - -Work on UI tasks is full of repetition when it goes about defining text appearance. You have to refer to mockups all the time, or to search and copy elements of same appearance. Both ways leave many ways for errors, and both make late changes in design quite painful. Amount of work for changing a font in typical elements is proportional to project's size. -The alternative way is in avoiding the use of IB for defining text appearance, but handling it in code. - - -Supported OS & SDK Versions ------------------------------ - -Swift 5.0 -* Supported build target - iOS 10.1 and up (Xcode 10) - -Installation --------------- - -```ruby -# In your Podfile - -pod 'HandyText' -``` - -Declare own text styles as static functions or properties of TextStyle class. - -Version 1.4.5 - -- Release version. - -Usage --------------- - -First, let's define some text styles: - -```swift -extension TextStyle { - static var plainText: TextStyle { - return TextStyle(font: .avenir) - } -} -``` - -The Font is only required parameter for creating a brand new style, all other params are set to defaults. Instead of copying instances and modifying properties the library proposes more declarative 'cascade' style. Think you need a style for headers based on plain text: - -```swift - static var header1: TextStyle { - return plainText.withSizeMultiplied(by: 1.4).uppercase().bold() - } -``` - -It's remarkable that styles are chained, in other words based on each other. Changing basic style font to .georgia makes all style scheme look different, but still well fitted. - -Attributed strings ----------------- - -The costs of using text styles is switching to attributed text, which is supported by the most of UIKit classes. -```swift -label.attributedText = "Hello, World!".withStyle(.plainText) -``` - - -### Merging attributed strings -Attributed strings can be combined to achieve more complex appearance: -```swift -let title = "First name: ".withStyle(.placeholder) -let name = "Michael".withStyle(.plainText) -label.attributedText = title + name - ``` - - -### Highlighting words -You can highlight specific substrings with a different text style: -```swift -let text = "There are three species of zebras: the plains zebra, the Grévy's zebra and the mountain zebra" -label.attributedText = text.withStyle(.plainText).applyStyle(.header1, toOccurencesOf: "zebra") -``` - - - -For displaying strings with tags you define a tag scheme: -```swift - let scheme = TagScheme() - scheme.forTag("b") { $0.bold() } - scheme.forTag("i") { $0.italic() } -``` -In the scheme for each custom tag you register a block defining the modification of the initial text style. -Nested tags are supported. Text marked as following ```"lions"``` will be bold italic. -To convert a string into an attributed string: -```swift -let result = "about zebras".withStyle(.plainText, tagScheme: scheme) -``` - - - -FAQ --------------- -### How many styles do I need? -As little as possible. Average application has 2-3 basic and several complementary text styles. It's not necessary to create a new style if it differs with only the color or alignment. Better to extend the style at place. - -### Absolute or relative size? -You are used to define text size in points: 10 for plain text, 15 for heading and so on. But let's look from another angle: what this numbers mean? I guess, the designer could think something like 'let headers be a half times more than normal text'. Due to method ```withSizeMultiplied(by:)``` you can define text sizes proportionally. In this case, when the base style changes its size, the whole text scheme scales proportionally. Baseline offset can also be defined relative, which will keep proportions in custom superscripts like below: - - - -### What can make the text size change? -Here are some ideas. By using Dynamic Text Size in the base style, you will make your app sensitive to the Accessibility preferences of the device. For large devices it's reasonable to use slightly larger fonts. Some apps allow users to change appearance themes. With HandyText updating fonts becomes a simple task. - - - -### Too many outlets! -To use HandyText effectively you must create an outlet for every text containing view. Is it that bad? In well-designed projects all strings are kept in the single file: Localizable.strings. Not in storyboards, not in the code. With this approach the whole app can be translated into a new language without changing a line of code. HandyText lib encourages you to use this approach: fetch a localized string, apply a style, display the result in the corresponding outlet. - -### How to add links to my attributed text? -The library doesn't add any new abilities to UIKit classes. For assigning a link to a chunk of text it uses NSLinkAttributeName. For more info refer to the [official docs](https://developer.apple.com/reference/uikit/uitextviewdelegate/1649337-textview). - -### How do I call my text styles? -Avoid giving names based on specific usage, try to keep it more generic. For instance, 'screenHeading' is a good name, 'orangeHeaderInFriendsList' – is not. - -### Can HandyText help me improve my design specs? -Of course. As a developer, together with design team you can define a table of common text styles and rules for describing modifiers. Instead of "HelveticaNeue-Bold, 15 pt, color: FF0000" it can be "style: header, color: tomatoRed". - - -License ----------------- - - The MIT License (MIT) - - Copyright © 2016 Aleksey Chernish - - Permission is hereby granted free of charge to any person obtaining a copy of this software and associated documentation files (the "Software") to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. +# HandyText +A description of this package. diff --git a/Demo/HandyTextExample/HandyTextExample.xcodeproj/project.pbxproj b/Sources/Demo/HandyTextExample/HandyTextExample.xcodeproj/project.pbxproj similarity index 71% rename from Demo/HandyTextExample/HandyTextExample.xcodeproj/project.pbxproj rename to Sources/Demo/HandyTextExample/HandyTextExample.xcodeproj/project.pbxproj index 62ef5f9..445f1d8 100644 --- a/Demo/HandyTextExample/HandyTextExample.xcodeproj/project.pbxproj +++ b/Sources/Demo/HandyTextExample/HandyTextExample.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 46; + objectVersion = 52; objects = { /* Begin PBXBuildFile section */ @@ -12,18 +12,9 @@ 5B31FAE21DF45BE900EC9D42 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5B31FAE01DF45BE900EC9D42 /* Main.storyboard */; }; 5B31FAE41DF45BE900EC9D42 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 5B31FAE31DF45BE900EC9D42 /* Assets.xcassets */; }; 5B31FAE71DF45BE900EC9D42 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5B31FAE51DF45BE900EC9D42 /* LaunchScreen.storyboard */; }; - 5B31FAF91DF45D5200EC9D42 /* Font.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B31FAEF1DF45D5200EC9D42 /* Font.swift */; }; - 5B31FAFA1DF45D5200EC9D42 /* NSAttributedString+TextStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B31FAF01DF45D5200EC9D42 /* NSAttributedString+TextStyle.swift */; }; - 5B31FAFB1DF45D5200EC9D42 /* String+TagScheme.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B31FAF11DF45D5200EC9D42 /* String+TagScheme.swift */; }; - 5B31FAFC1DF45D5200EC9D42 /* String+TextStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B31FAF21DF45D5200EC9D42 /* String+TextStyle.swift */; }; - 5B31FAFD1DF45D5200EC9D42 /* TagScheme.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B31FAF31DF45D5200EC9D42 /* TagScheme.swift */; }; - 5B31FAFE1DF45D5200EC9D42 /* TextStyle+Modifiers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B31FAF41DF45D5200EC9D42 /* TextStyle+Modifiers.swift */; }; - 5B31FAFF1DF45D5200EC9D42 /* TextStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B31FAF51DF45D5200EC9D42 /* TextStyle.swift */; }; - 5B31FB001DF45D5200EC9D42 /* TextStyleApplicable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B31FAF61DF45D5200EC9D42 /* TextStyleApplicable.swift */; }; - 5B31FB011DF45D5200EC9D42 /* UIBarButtonItem+TextStyleApplicable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B31FAF71DF45D5200EC9D42 /* UIBarButtonItem+TextStyleApplicable.swift */; }; - 5B31FB021DF45D5200EC9D42 /* UINavigationBar+TextStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B31FAF81DF45D5200EC9D42 /* UINavigationBar+TextStyle.swift */; }; 5BC2FEF51DF50C3900463413 /* ApplicationFonts.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BC2FEF31DF50C3900463413 /* ApplicationFonts.swift */; }; 5BC2FEF61DF50C3900463413 /* ApplicationStyles.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BC2FEF41DF50C3900463413 /* ApplicationStyles.swift */; }; + CCA01A182AD8393E00B0CAB1 /* HandyText in Frameworks */ = {isa = PBXBuildFile; productRef = CCA01A172AD8393E00B0CAB1 /* HandyText */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -34,18 +25,9 @@ 5B31FAE31DF45BE900EC9D42 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 5B31FAE61DF45BE900EC9D42 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 5B31FAE81DF45BE900EC9D42 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 5B31FAEF1DF45D5200EC9D42 /* Font.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Font.swift; sourceTree = ""; }; - 5B31FAF01DF45D5200EC9D42 /* NSAttributedString+TextStyle.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSAttributedString+TextStyle.swift"; sourceTree = ""; }; - 5B31FAF11DF45D5200EC9D42 /* String+TagScheme.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "String+TagScheme.swift"; sourceTree = ""; }; - 5B31FAF21DF45D5200EC9D42 /* String+TextStyle.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "String+TextStyle.swift"; sourceTree = ""; }; - 5B31FAF31DF45D5200EC9D42 /* TagScheme.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TagScheme.swift; sourceTree = ""; }; - 5B31FAF41DF45D5200EC9D42 /* TextStyle+Modifiers.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "TextStyle+Modifiers.swift"; sourceTree = ""; }; - 5B31FAF51DF45D5200EC9D42 /* TextStyle.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextStyle.swift; sourceTree = ""; }; - 5B31FAF61DF45D5200EC9D42 /* TextStyleApplicable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextStyleApplicable.swift; sourceTree = ""; }; - 5B31FAF71DF45D5200EC9D42 /* UIBarButtonItem+TextStyleApplicable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIBarButtonItem+TextStyleApplicable.swift"; sourceTree = ""; }; - 5B31FAF81DF45D5200EC9D42 /* UINavigationBar+TextStyle.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UINavigationBar+TextStyle.swift"; sourceTree = ""; }; 5BC2FEF31DF50C3900463413 /* ApplicationFonts.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ApplicationFonts.swift; sourceTree = ""; }; 5BC2FEF41DF50C3900463413 /* ApplicationStyles.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ApplicationStyles.swift; sourceTree = ""; }; + CCA01A162AD8393200B0CAB1 /* HandyText */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = HandyText; path = ../../..; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -53,6 +35,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + CCA01A182AD8393E00B0CAB1 /* HandyText in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -62,9 +45,10 @@ 5B31FAD01DF45BE900EC9D42 = { isa = PBXGroup; children = ( - 5B31FAEE1DF45D5200EC9D42 /* HandyText */, + CCA01A152AD8393200B0CAB1 /* Packages */, 5B31FADB1DF45BE900EC9D42 /* HandyTextExample */, 5B31FADA1DF45BE900EC9D42 /* Products */, + CCA01A122AD835D800B0CAB1 /* Frameworks */, ); sourceTree = ""; }; @@ -91,22 +75,19 @@ path = HandyTextExample; sourceTree = ""; }; - 5B31FAEE1DF45D5200EC9D42 /* HandyText */ = { + CCA01A122AD835D800B0CAB1 /* Frameworks */ = { isa = PBXGroup; children = ( - 5B31FAEF1DF45D5200EC9D42 /* Font.swift */, - 5B31FAF01DF45D5200EC9D42 /* NSAttributedString+TextStyle.swift */, - 5B31FAF11DF45D5200EC9D42 /* String+TagScheme.swift */, - 5B31FAF21DF45D5200EC9D42 /* String+TextStyle.swift */, - 5B31FAF31DF45D5200EC9D42 /* TagScheme.swift */, - 5B31FAF41DF45D5200EC9D42 /* TextStyle+Modifiers.swift */, - 5B31FAF51DF45D5200EC9D42 /* TextStyle.swift */, - 5B31FAF61DF45D5200EC9D42 /* TextStyleApplicable.swift */, - 5B31FAF71DF45D5200EC9D42 /* UIBarButtonItem+TextStyleApplicable.swift */, - 5B31FAF81DF45D5200EC9D42 /* UINavigationBar+TextStyle.swift */, ); - name = HandyText; - path = ../../HandyText; + name = Frameworks; + sourceTree = ""; + }; + CCA01A152AD8393200B0CAB1 /* Packages */ = { + isa = PBXGroup; + children = ( + CCA01A162AD8393200B0CAB1 /* HandyText */, + ); + name = Packages; sourceTree = ""; }; /* End PBXGroup section */ @@ -125,6 +106,9 @@ dependencies = ( ); name = HandyTextExample; + packageProductDependencies = ( + CCA01A172AD8393E00B0CAB1 /* HandyText */, + ); productName = HandyTextExample; productReference = 5B31FAD91DF45BE900EC9D42 /* HandyTextExample.app */; productType = "com.apple.product-type.application"; @@ -183,18 +167,8 @@ buildActionMask = 2147483647; files = ( 5BC2FEF61DF50C3900463413 /* ApplicationStyles.swift in Sources */, - 5B31FAFF1DF45D5200EC9D42 /* TextStyle.swift in Sources */, - 5B31FB011DF45D5200EC9D42 /* UIBarButtonItem+TextStyleApplicable.swift in Sources */, - 5B31FB001DF45D5200EC9D42 /* TextStyleApplicable.swift in Sources */, 5B31FADF1DF45BE900EC9D42 /* ViewController.swift in Sources */, 5B31FADD1DF45BE900EC9D42 /* AppDelegate.swift in Sources */, - 5B31FAFD1DF45D5200EC9D42 /* TagScheme.swift in Sources */, - 5B31FB021DF45D5200EC9D42 /* UINavigationBar+TextStyle.swift in Sources */, - 5B31FAFA1DF45D5200EC9D42 /* NSAttributedString+TextStyle.swift in Sources */, - 5B31FAFB1DF45D5200EC9D42 /* String+TagScheme.swift in Sources */, - 5B31FAF91DF45D5200EC9D42 /* Font.swift in Sources */, - 5B31FAFC1DF45D5200EC9D42 /* String+TextStyle.swift in Sources */, - 5B31FAFE1DF45D5200EC9D42 /* TextStyle+Modifiers.swift in Sources */, 5BC2FEF51DF50C3900463413 /* ApplicationFonts.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -329,7 +303,8 @@ IPHONEOS_DEPLOYMENT_TARGET = 10.1; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; - SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; @@ -341,7 +316,11 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = HandyTextExample/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); PRODUCT_BUNDLE_IDENTIFIER = com.achernish.home.HandyTextExample; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; @@ -353,7 +332,11 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = HandyTextExample/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); PRODUCT_BUNDLE_IDENTIFIER = com.achernish.home.HandyTextExample; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; @@ -382,6 +365,13 @@ defaultConfigurationName = Release; }; /* End XCConfigurationList section */ + +/* Begin XCSwiftPackageProductDependency section */ + CCA01A172AD8393E00B0CAB1 /* HandyText */ = { + isa = XCSwiftPackageProductDependency; + productName = HandyText; + }; +/* End XCSwiftPackageProductDependency section */ }; rootObject = 5B31FAD11DF45BE900EC9D42 /* Project object */; } diff --git a/Demo/HandyTextExample/HandyTextExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Sources/Demo/HandyTextExample/HandyTextExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata similarity index 100% rename from Demo/HandyTextExample/HandyTextExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata rename to Sources/Demo/HandyTextExample/HandyTextExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata diff --git a/Demo/HandyTextExample/HandyTextExample.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Sources/Demo/HandyTextExample/HandyTextExample.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist similarity index 100% rename from Demo/HandyTextExample/HandyTextExample.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist rename to Sources/Demo/HandyTextExample/HandyTextExample.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/Demo/HandyTextExample/HandyTextExample/AppDelegate.swift b/Sources/Demo/HandyTextExample/HandyTextExample/AppDelegate.swift similarity index 100% rename from Demo/HandyTextExample/HandyTextExample/AppDelegate.swift rename to Sources/Demo/HandyTextExample/HandyTextExample/AppDelegate.swift diff --git a/Demo/HandyTextExample/HandyTextExample/ApplicationFonts.swift b/Sources/Demo/HandyTextExample/HandyTextExample/ApplicationFonts.swift similarity index 98% rename from Demo/HandyTextExample/HandyTextExample/ApplicationFonts.swift rename to Sources/Demo/HandyTextExample/HandyTextExample/ApplicationFonts.swift index 85f696e..f67b602 100644 --- a/Demo/HandyTextExample/HandyTextExample/ApplicationFonts.swift +++ b/Sources/Demo/HandyTextExample/HandyTextExample/ApplicationFonts.swift @@ -7,6 +7,7 @@ // import Foundation +import HandyText extension Font { diff --git a/Demo/HandyTextExample/HandyTextExample/ApplicationStyles.swift b/Sources/Demo/HandyTextExample/HandyTextExample/ApplicationStyles.swift similarity index 98% rename from Demo/HandyTextExample/HandyTextExample/ApplicationStyles.swift rename to Sources/Demo/HandyTextExample/HandyTextExample/ApplicationStyles.swift index ba761cf..809e207 100644 --- a/Demo/HandyTextExample/HandyTextExample/ApplicationStyles.swift +++ b/Sources/Demo/HandyTextExample/HandyTextExample/ApplicationStyles.swift @@ -7,6 +7,7 @@ // import UIKit +import HandyText extension TextStyle { diff --git a/Demo/HandyTextExample/HandyTextExample/Assets.xcassets/AppIcon.appiconset/Contents.json b/Sources/Demo/HandyTextExample/HandyTextExample/Assets.xcassets/AppIcon.appiconset/Contents.json similarity index 100% rename from Demo/HandyTextExample/HandyTextExample/Assets.xcassets/AppIcon.appiconset/Contents.json rename to Sources/Demo/HandyTextExample/HandyTextExample/Assets.xcassets/AppIcon.appiconset/Contents.json diff --git a/Demo/HandyTextExample/HandyTextExample/Base.lproj/LaunchScreen.storyboard b/Sources/Demo/HandyTextExample/HandyTextExample/Base.lproj/LaunchScreen.storyboard similarity index 100% rename from Demo/HandyTextExample/HandyTextExample/Base.lproj/LaunchScreen.storyboard rename to Sources/Demo/HandyTextExample/HandyTextExample/Base.lproj/LaunchScreen.storyboard diff --git a/Demo/HandyTextExample/HandyTextExample/Base.lproj/Main.storyboard b/Sources/Demo/HandyTextExample/HandyTextExample/Base.lproj/Main.storyboard similarity index 100% rename from Demo/HandyTextExample/HandyTextExample/Base.lproj/Main.storyboard rename to Sources/Demo/HandyTextExample/HandyTextExample/Base.lproj/Main.storyboard diff --git a/Demo/HandyTextExample/HandyTextExample/Info.plist b/Sources/Demo/HandyTextExample/HandyTextExample/Info.plist similarity index 100% rename from Demo/HandyTextExample/HandyTextExample/Info.plist rename to Sources/Demo/HandyTextExample/HandyTextExample/Info.plist diff --git a/Demo/HandyTextExample/HandyTextExample/ViewController.swift b/Sources/Demo/HandyTextExample/HandyTextExample/ViewController.swift similarity index 98% rename from Demo/HandyTextExample/HandyTextExample/ViewController.swift rename to Sources/Demo/HandyTextExample/HandyTextExample/ViewController.swift index 5887b85..51ea955 100644 --- a/Demo/HandyTextExample/HandyTextExample/ViewController.swift +++ b/Sources/Demo/HandyTextExample/HandyTextExample/ViewController.swift @@ -7,6 +7,7 @@ // import UIKit +import HandyText class ViewController: UIViewController { diff --git a/HandyText/Font.swift b/Sources/HandyText/Font.swift similarity index 100% rename from HandyText/Font.swift rename to Sources/HandyText/Font.swift diff --git a/HandyText/NSAttributedString+TextStyle.swift b/Sources/HandyText/NSAttributedString+TextStyle.swift similarity index 100% rename from HandyText/NSAttributedString+TextStyle.swift rename to Sources/HandyText/NSAttributedString+TextStyle.swift diff --git a/HandyText/String+TagScheme.swift b/Sources/HandyText/String+TagScheme.swift similarity index 100% rename from HandyText/String+TagScheme.swift rename to Sources/HandyText/String+TagScheme.swift diff --git a/HandyText/String+TextStyle.swift b/Sources/HandyText/String+TextStyle.swift similarity index 100% rename from HandyText/String+TextStyle.swift rename to Sources/HandyText/String+TextStyle.swift diff --git a/HandyText/TagScheme.swift b/Sources/HandyText/TagScheme.swift similarity index 94% rename from HandyText/TagScheme.swift rename to Sources/HandyText/TagScheme.swift index 1d75482..27d246e 100644 --- a/HandyText/TagScheme.swift +++ b/Sources/HandyText/TagScheme.swift @@ -9,7 +9,7 @@ import Foundation public typealias TextStyleModifier = (TextStyle) -> TextStyle -public class TagScheme { +open class TagScheme { private var map = [String: TextStyleModifier]() diff --git a/HandyText/TextStyle+Modifiers.swift b/Sources/HandyText/TextStyle+Modifiers.swift similarity index 100% rename from HandyText/TextStyle+Modifiers.swift rename to Sources/HandyText/TextStyle+Modifiers.swift diff --git a/HandyText/TextStyle.swift b/Sources/HandyText/TextStyle.swift similarity index 99% rename from HandyText/TextStyle.swift rename to Sources/HandyText/TextStyle.swift index bd3d493..9205188 100644 --- a/HandyText/TextStyle.swift +++ b/Sources/HandyText/TextStyle.swift @@ -9,7 +9,7 @@ import UIKit //TODO: generate attributes on demand to avoid recalculations -public class TextStyle { +open class TextStyle { public enum BaselineOffset { case none diff --git a/HandyText/TextStyleApplicable.swift b/Sources/HandyText/TextStyleApplicable.swift similarity index 100% rename from HandyText/TextStyleApplicable.swift rename to Sources/HandyText/TextStyleApplicable.swift diff --git a/HandyText/UIBarButtonItem+TextStyleApplicable.swift b/Sources/HandyText/UIBarButtonItem+TextStyleApplicable.swift similarity index 100% rename from HandyText/UIBarButtonItem+TextStyleApplicable.swift rename to Sources/HandyText/UIBarButtonItem+TextStyleApplicable.swift diff --git a/HandyText/UINavigationBar+TextStyle.swift b/Sources/HandyText/UINavigationBar+TextStyle.swift similarity index 100% rename from HandyText/UINavigationBar+TextStyle.swift rename to Sources/HandyText/UINavigationBar+TextStyle.swift diff --git a/Tests/HandyTextTests/HandyTextTests.swift b/Tests/HandyTextTests/HandyTextTests.swift new file mode 100644 index 0000000..65139fa --- /dev/null +++ b/Tests/HandyTextTests/HandyTextTests.swift @@ -0,0 +1,8 @@ +import XCTest +@testable import HandyText + +final class HandyTextTests: XCTestCase { + func testExample() throws { + + } +}