Will Larche 1080e89422 [Documentation] Putting Swift snippets before Objc (#960)
* [ActivityIndicator] Swift first in README

* [AnimationTiming] Swift first in readme.

* [AppBar] Swift first in readme.

* [ButtonBar] Swift first in readme.

* [Buttons] Swift first in readme.

* [CollectionLayoutAttributes] Swift first in readme

* [Collections] Swift first in readme.

* [Dialogs] Swift first in readme.

* [FeatureHighlight] Swift first in readme.

* [FlexibleHeader] Swift first in readme.

* [FontDiskLoader] Swift first in readme.

* [HeaderStackView] Swift first in readme.

* [Ink] Swift first in readme.

* [NavigationBar] Swift first in readme.

* [OverlayWindow] Adding missing site comments. Swift first in readme.

* [PageControl] Swift first in readme.

* [Palettes] Swift first in readme.

* [ProgressView] Swift first in readme.

* [RobotoFontLoader] Swift first in readme.

* [ShadowElevations] Swift first in readme.

* [ShadowLayer] Swift first in readme.

* [Slider] Swift first in readme.

* [Snackbar] Swift first in readme.

* [SpritedAnimationView] Swift first in readme.

* [Switch] Swift first in readme.

* [Typography] Swift first in readme.

* [ShadowLayer] Reducing font size in readme.

* [Switch] Reducing font size in readme.
2016-12-07 10:31:34 -05:00
..

Roboto Font Loader

The Roboto Font Loader lazy loads the Roboto font.

Material Design Specifications

API Documentation

Installation

Requirements

  • Xcode 7.0 or higher.
  • iOS SDK version 7.0 or higher.

Installation with CocoaPods

To add this component to your Xcode project using CocoaPods, add the following to your Podfile:

pod 'MaterialComponents/RobotoFontLoader'

Then, run the following command:

pod install

Usage

The Roboto Font Loader Component provides APIs for getting the Roboto Fonts. Consider using the Typography Component for font styles recomended by Material spec.

Importing

Before using Roboto Font Loader, you'll need to import it:

Swift

import MaterialComponents

Objective-C

#import "MaterialRobotoFontLoader.h"

Dependencies

The Roboto Font Loader Component depends on the FontDiskLoader Component.

Swift

let myFont:UIFont = [[MDCRobotoFontLoader sharedInstance] regularFontOfSize:16];
}

Objective-C

UIFont *font = [[MDCRobotoFontLoader sharedInstance] regularFontOfSize:16];

Advanced Usage

Typography's weak dependency

When included in your build the Roboto Font Loader is used by the Typography component. This runtime check occurs when no specific Font Loader is set on Typography, resulting in Roboto being used for Material Typography. For more information see Typography.