All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
-
Properties
color
andswiftUI
allow a SwiftUIColor
to be obtained from aTypographyKitColor
. -
All methods & properties previously accessed using
TypographyKit.
may now be accessed using the shortened form:TK.
. -
Support for RGBA colour values e.g. rgba(255,255,255,255).
-
Support for hexadecimal color values with transparency e.g. #FFFFFFFF.
-
New configuration options may now be declared as part of the TypographyKit JSON configuration file:
development-color
: If the app build is a development build andshould-use-development-colors
istrue
then when the value of a color hasn't been specified, TypographyKit will fallback to using the value of this color.fallback-color
: If the app build is not a development build -or- the app build is a development build butshould-use-development-colors
isfalse
then this color will be used if the value of a color has not been set.is-development
: Can be used to set whether or not the build is a development build. If the value is not set, this is determined according to whether or not the build is debug.should-crash-if-color-not-found
: If the build is a development build and the value of this key istrue
then if the value of a color hasn't been specified then the app will crash. Default value:false
.should-use-development-colors
: If the build is a development build and the value of this key istrue
then if the value of a color hasn't been specified then the specifieddevelopment-colour
will be used. Default value:true
.
-
All configuration options specified in the TypographyKit configuration file may also be specified via the
TypographyKit.Configuration
object when configuring the framework. Note: Settings specified in the TypographyKit configuration file override settings specified programmatically.
- Deployment target updated to iOS 11.0 (dropped support for iOS 9.0 and 10.0 in-line with Xcode 14).
TypographyKit.colors
should no longer be used. Instead use:- For SwiftUI:
TypographyKit.color(named:)
orTK.color(named:)
. - For UIKit:
TypographyKit.uiColor(named:)
orTK.uiColor(named:)
. - Or:
TypographyKit.tkColor(named:).color
(for SwiftUI) orTypographyKit.tkColor(named:).uiColor
(for UIKit).
- For SwiftUI:
ConfigurationSettings
renamed toTypographyKitConfiguration
. This object contains the configuration values supplied by the developer (along with any default configuration values).TypgraphyKitConfiguration
renamed toTypographyKitSettings
. This object contains the current configuration as well as loaded colors and typography styles.
- When using the View modifier in SwiftUI, the scaling mode can be specified as a parameter e.g.
.typography(style: .interactive, scalingMode: .fontMetrics)
. By default the scaling mode specified in the configuration will be applied.
- Fixed an issue concerning font colors in SwiftUI.
- Allow Color and Font for typography styles in SwiftUI to be nullable.
- Support for disabling font scaling either system-wide and/or per-font.
- Support for custom letter spacing in font styles plist.
- Removes a warning relating to iOS 8 being unsupported as a deployment target in Xcode 12 (thanks to @atrinh0).
- Fixed support for Swift Package Manager.
- Support for posting a
UIContentSizeCategory.didChangeNotification
notification manually where scaling usingUIFontMetrics
.
- Support for Swift Package Manager.
- Support for SwiftUI. A typography style can be applied to a SwiftUI
Text
view as follows:
Text("A string").typography(style: .interactive)
Letter casing can be applied directly to a String as follows:
"A string".letterCase(style: .interactive)
- Scaling mode may now be specified on a per typography style basis using the
scaling-mode
key.
- Support for SwiftUI. A typography style can be applied to a SwiftUI
Text
view as follows:
Text("A string").typography(style: .interactive)
Letter casing can be applied directly to a String as follows:
"A string".letterCase(style: .interactive)
- Scaling mode may now be specified on a per typography style basis using the
scaling-mode
key.
- The default scaling mode (if one is not specified) is now
UIFontMetrics
with fallback to stepping prior to iOS 11.0. - Improvements to scaling using
UIFontMetrics
including respecting minimum point size constraints.
Added the ability to specify a minimum and / or maximum point size per typography style e.g.
"paragraph": {
"font-name": "Avenir-Medium",
"minimum-point-size": 12,
"maximum-point-size": 24,
"point-size": 18,
"text-color": "text",
"letter-case": "regular"
}
Added the ability to globally specify the line breaking mode for UILabel
using the line-break
property of labels
. For an example, see the sample app.
Added parameter replacingDefaultTextColor
to function attributedText(_ text:, style:,letterCase:, textColor: UIColor?)
allowing the most frequently occurring text color in an attributed string to be replaced with the value of the textColor
parameter.
Resolved an issues with setting NSAttributedString
on UILabel` updating all fonts to the specified typography style even where a font attribute was already set.
Support for Xcode 11 and dark mode in iOS 13.
Fixed an issue whereby attributed text would not be updated correctly.
Fixed an issue whereby invoking UIFont(name:, size:)
using the name of the system font (as part of setting a new font size for attributed text) causes the font to be set to Times New Roman.
- Fixed an issue whereby updating an element's attributed text only updated the font size and not the typeface.
- Added
TKColorsViewController
for displaying all colors defined in TypographyKit configuration.
- Convenience methods added on
Typography
to support Dynamic Type includingfont()
andlineHeight()
.
- Added support for:
BoldSystem
->boldSystemFont(ofSize: CGFloat) -> UIFont
ItalicSystem
->italicSystemFont(ofSize: CGFloat) -> UIFont
MonospacedDigitSystem-Weight
->monospacedDigitSystemFont(ofSize: CGFloat, weight: UIFont.Weight) -> UIFont
.
- Added support for Swift 5.0.
- Support for scaling using
UIFontMetrics
where iOS 11 using theTypographyKit.scalingMode
property. - Better support for using the system font by listing the font name as
System
or the font name and weight e.g.System-Bold
.
- Deployment target increased from 8.0 -> 8.2.
- Fixed an issue whereby color definitions referencing other color definitions could fail to be parsed correctly.
- It is now possible to extend existing typography styles to create a new one using the
extends
keyword as part of the style definition in the TypographyKit configuration file.
UIButton
no longer gets title set for everyUIControlState
automatically.
- Added
refreshWithData(_:)
for refreshing configuration data from a configuration file which has already been downloaded.
- After updating the
configurationURL
property, configuration is reloaded from the new URL. - Prioritizes JSON configuration files over property lists should both exist in an app's bundle.
- Added the ability to specify presentation options for TypographyKitViewController.
- Invoking
TypographyKit.presentTypographyStyles()
will now present a TypographyKitViewController modally for listing all the typography styles in your app with an option to export to PDF.
- Fixed a minor bug retrieving colors defined in asset catalogs on iOS 11 and above.
Allows the font point size to be clamped to a lower and / or upper bound by optionally defining the minimum-point-size / maximum-point-size in the TypographyKit configuration file.
This release introduces support for integration using the Carthage dependency manager. In order to integrate TypographyKit into your project via Carthage, add the following line to your project's Cartfile:
github "rwbutler/TypographyKit"
This release is unavailable through Cocoapods as it introduces no functional changes from the previous release for developers who have already integrated v0.4.0.
Support for recursive color definitions and obtaining lighter / darker shades of colors. More information is available in this blog post.
- Support for Swift 4.1
Initial release.