<commit_before>![Bad Type Logo](https://cloud.githubusercontent.com/assets/23727/12509092/64af7190-c100-11e5-8ccb-8957005b3400.png)

[![GitHub license](https://img.shields.io/badge/license-MIT-lightgrey.svg)](https://raw.githubusercontent.com/alvivi/BadType/master/LICENSE.md)
![Platform](https://img.shields.io/badge/plaform-ios-lightgrey.svg)
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)

Use [iOS DynamicType](https://developer.apple.com/library/ios/documentation/StringsTextFonts/Conceptual/TextAndWebiPhoneOS/CustomTextProcessing/CustomTextProcessing.html#//apple_ref/doc/uid/TP40009542-CH4-SW65)
with your custom fonts and styles (Interface Builder Compatible).


## Features

- [x] UIDynamicType with automatic updating
- [x] Custom user defined styles  
- [x] Interface Builder Support
- [ ] Objective-C Support (Not Tested)
- [ ] Attributed Text Support

## Requirements

- iOS 8.0+
- Xcode 7.2+

## Installation

### Carthage

[Install Carthage](https://github.com/Carthage/Carthage#installing-carthage)
and then add BadType to your `Cartfile`:
```
github "alvivi/BadType" "master"
```
After that follow the [standard instructions](https://github.com/Carthage/Carthage#adding-frameworks-to-an-application)
to add BadType to your project.

### Manually

**TODO**. But, you can follow any other [framework tutorial](https://github.com/Alamofire/Alamofire#embedded-framework)
changing references to BadType.

## Usage

### From source code

BadType adds extensions to UIKit components to enable the use of UIDynamicType
custom font styles. For example, you can change the style of `UILabel` to a
standard Headline style using:

```
myLabel.fontStyle = "Headline"
```

BadType will create a weak reference to that view to update the style if a
dynamic type notification is received. For creating custom font style see
[Custom Styles]() section.

### Interface Builder Support

**Note** that because an Interface Builder Bug ([rdar://23114017](https://openradar.appspot.com/23114017)),
the Interface Builder compatibility requires additional configuration.

BadType provides a family of components based UIKit ones that enable live view
into Interface Builder. These components are declared in [`BadType/BadType/BadTypeIBWorkaround.swift`](https://github.com/alvivi/BadType/blob/master/BadType/BadTypeIBWorkaround.swift).
To use them, first change the the view's **custom class** attribute to their
corresponding BadType class (for example, from `UILabel` to `BTLabel`,
`UIButton` to `BTButton`, etc), and then set the **font style** attribute to
a name of a valid font style in your catalog (standard styles are `Headline`,
`Body`, `Footnote` and so on). The font style attribute is **case-sensitive**.

![](https://cloud.githubusercontent.com/assets/23727/12514991/5a59dab6-c126-11e5-8b16-45535eb86e81.png)
<commit_msg>fixed a reference to custom styles section<commit_after>![Bad Type Logo](https://cloud.githubusercontent.com/assets/23727/12509092/64af7190-c100-11e5-8ccb-8957005b3400.png)

[![GitHub license](https://img.shields.io/badge/license-MIT-lightgrey.svg)](https://raw.githubusercontent.com/alvivi/BadType/master/LICENSE.md)
![Platform](https://img.shields.io/badge/plaform-ios-lightgrey.svg)
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)

Use [iOS DynamicType](https://developer.apple.com/library/ios/documentation/StringsTextFonts/Conceptual/TextAndWebiPhoneOS/CustomTextProcessing/CustomTextProcessing.html#//apple_ref/doc/uid/TP40009542-CH4-SW65)
with your custom fonts and styles (Interface Builder Compatible).


## Features

- [x] UIDynamicType with automatic updating
- [x] Custom user defined styles  
- [x] Interface Builder Support
- [ ] Objective-C Support (Not Tested)
- [ ] Attributed Text Support

## Requirements

- iOS 8.0+
- Xcode 7.2+

## Installation

### Carthage

[Install Carthage](https://github.com/Carthage/Carthage#installing-carthage)
and then add BadType to your `Cartfile`:
```
github "alvivi/BadType" "master"
```
After that follow the [standard instructions](https://github.com/Carthage/Carthage#adding-frameworks-to-an-application)
to add BadType to your project.

### Manually

**TODO**. But, you can follow any other [framework tutorial](https://github.com/Alamofire/Alamofire#embedded-framework)
changing references to BadType.

## Usage

### From source code

BadType adds extensions to UIKit components to enable the use of UIDynamicType
custom font styles. For example, you can change the style of `UILabel` to a
standard Headline style using:

```
myLabel.fontStyle = "Headline"
```

BadType will create a weak reference to that view to update the style if a
dynamic type notification is received. For creating custom font style see
[Custom Styles](https://github.com/alvivi/BadType#custom-styles) section.

### Interface Builder Support

**Note** that because an Interface Builder Bug ([rdar://23114017](https://openradar.appspot.com/23114017)),
the Interface Builder compatibility requires additional configuration.

BadType provides a family of components based UIKit ones that enable live view
into Interface Builder. These components are declared in [`BadType/BadType/BadTypeIBWorkaround.swift`](https://github.com/alvivi/BadType/blob/master/BadType/BadTypeIBWorkaround.swift).
To use them, first change the the view's **custom class** attribute to their
corresponding BadType class (for example, from `UILabel` to `BTLabel`,
`UIButton` to `BTButton`, etc), and then set the **font style** attribute to
a name of a valid font style in your catalog (standard styles are `Headline`,
`Body`, `Footnote` and so on). The font style attribute is **case-sensitive**.

![](https://cloud.githubusercontent.com/assets/23727/12514991/5a59dab6-c126-11e5-8b16-45535eb86e81.png)

{'fraction_non_alphanumeric': 0.12017603249830738, 'fraction_numerical': 0.03588354773188896, 'mean_word_length': 5.443838604143948, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 27, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5337303', 'n_tokens_mistral': 1997, 'n_tokens_neox': 1802, 'n_words': 510}