+ All Categories
Home > Documents > Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage...

Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage...

Date post: 14-Aug-2020
Category:
Upload: others
View: 1 times
Download: 0 times
Share this document with a friend
169
These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 210 Introducing Text Kit Ian Baird iOS Text Kit Lead Engineer
Transcript
Page 1: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

These are confidential sessions—please refrain from streaming, blogging, or taking pictures

Session 210

Introducing Text Kit

Ian BairdiOS Text Kit Lead Engineer

Page 2: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Agenda

•Motivation

Page 3: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Agenda

•Motivation•What is Text Kit?

Page 4: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Agenda

•Motivation•What is Text Kit?• Feature set

Page 5: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Agenda

•Motivation•What is Text Kit?• Feature set• Rich Text

Page 6: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Motivation

Page 7: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

MotivationIn the beginning…

Page 8: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

MotivationIn the beginning…

String DrawingCore Text

Core Graphics

WebKit

Page 9: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

MotivationIn the beginning…

String DrawingCore Text

Core Graphics

WebKit

UILabel UITextField UITextView UIWebView

UITextInputProtocol

Page 10: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Core Text is very advancedMotivation

•Mastering Core Text considered to be a “rite of passage”

Page 11: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Core Text is very advancedMotivation

•Mastering Core Text considered to be a “rite of passage”•Advanced Unicode layout engine

Page 12: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Core Text is very advancedMotivation

•Mastering Core Text considered to be a “rite of passage”•Advanced Unicode layout engine•Many concepts Toll-Free Bridged with Text Kit now

Page 13: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

UIWebViewMotivation

•Great for embedding web content

Page 14: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

UIWebViewMotivation

•Great for embedding web content•WebKit is a great HTML rendering engine

Page 15: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

UIWebViewMotivation

•Great for embedding web content•WebKit is a great HTML rendering engine•Unexpected behavior with scroll view objects

Page 16: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.
Page 17: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Text Kit

Page 18: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

What Is Text Kit?

Page 19: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

IntroductionWhat Is Text Kit?

• Fast modern text layout and rendering engine

Page 20: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

IntroductionWhat Is Text Kit?

• Fast modern text layout and rendering engine• Built on Core Text

Page 21: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

IntroductionWhat Is Text Kit?

• Fast modern text layout and rendering engine• Built on Core Text•Great integration with UIKit

Page 22: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

What Is Text Kit?

Page 23: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

What Is Text Kit?

Text Kit WebKit

Core Text

Core Graphics

Page 24: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

What Is Text Kit?

Text Kit WebKit

Core Text

Core Graphics

UITextInputProtocol

UILabel UITextField UITextView UIWebView

Page 25: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Text Kit is a “first-class citizen” in UIKitWhat Is Text Kit?

• Complete control over text rendering in UI elements

Page 26: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Text Kit is a “first-class citizen” in UIKitWhat Is Text Kit?

• Complete control over text rendering in UI elements•UITextView, UITextField, and UILabel rebuilt on Text Kit

Page 27: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Text Kit is a “first-class citizen” in UIKitWhat Is Text Kit?

• Complete control over text rendering in UI elements•UITextView, UITextField, and UILabel rebuilt on Text Kit• Seamlessly integrates with animations, UICollectionView, and UITableView

Page 28: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Extensible object-oriented architectureWhat Is Text Kit?

• Subclassing•Delegation•NotificationsNSTextStorageWillProcessEditingNotificationNSTextStorageDidProcessEditingNotification

Page 29: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Extensible object-oriented architectureWhat Is Text Kit?

• Subclassing•Delegation•NotificationsNSTextStorageWillProcessEditingNotificationNSTextStorageDidProcessEditingNotification

MyTextStorage

NSTextStorage

Page 30: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Extensible object-oriented architectureWhat Is Text Kit?

• Subclassing•Delegation

Layout ManagerDelegateNSLayoutManager

Page 31: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Extensible object-oriented architectureWhat Is Text Kit?

• Subclassing•Delegation•NotificationsNSTextStorageWillProcessEditingNotificationNSTextStorageDidProcessEditingNotification

Page 32: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

A tour of Text KitFeature Set

Page 33: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Feature SetPaginated text

Page 34: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Feature SetText in columns

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Phasellus lacinia pretium diam non tempor. Aenean mollis

pellentesque lectus, vitae ultrices urna tincidunt eu. Mauris

ullamcorper elementum pharetra. Donec imperdiet lacinia

porttitor. Pellentesque habitant morbi tristique senectus et

netus et malesuada fames ac turpis egestas. Nulla lobortis

tortor libero. Donec fringilla placerat lectus sed commodo.

Nulla nisl nulla, feugiat eu sodales nec, semper non nibh.

Nunc porta lacinia cursus. Vestibulum ultrices euismod

euismod. Class aptent taciti sociosqu ad litora torquent per

conubia nostra, per inceptos himenaeos. Quisque nec

lectus id diam molestie consectetur sed sed ligula. Nulla

non luctus nibh. Integer viverra posuere urna, vel volutpat

eros eleifend in. Donec pharetra tincidunt lectus vitae

luctus.

Ut semper vulputate quam in dictum. Maecenas lobortis

porttitor lorem vel molestie. Nam eros orci, mattis ac

placerat nec, blandit sed orci. In consequat convallis risus

eu fermentum. Mauris accumsan lobortis porta. Nunc

feugiat, leo et consequat varius, velit metus consectetur

ante, in bibendum neque felis vel sapien. Fusce vel risus in

tellus convallis facilisis. Nunc consectetur fringilla sem vel

varius. Etiam cursus auctor tortor vitae dictum. Sed

interdum fringilla orci, sed commodo magna ultricies

fringilla. Donec eget convallis lacus.

Etiam nec mauris lacus. Cras mattis lobortis dignissim. Sed

lorem turpis, feugiat at sodales eget, porta vel purus. Sed

ullamcorper diam ac justo hendrerit porta. Aliquam sed erat

ut lorem facilisis sollicitudin quis eget mi. Sed vitae massa

id magna sagittis commodo. Ut feugiat tincidunt purus, et

imperdiet diam convallis vitae. Donec augue libero, blandit

ut dapibus id, vulputate at velit. Morbi condimentum

bibendum turpis, sed fermentum turpis ornare non.

In hac habitasse platea dictumst. Nulla facilisi. Proin vel

nibh mi, quis congue lectus. Etiam sit amet est nec quam

iaculis lobortis sit amet eu leo. Nulla mollis feugiat quam, a

interdum sapien pellentesque sed. Pellentesque eu sem ut

elit fringilla scelerisque a vel leo. Aenean quis lacus eget

massa condimentum adipiscing ac vitae sapien. Vivamus id

nibh aliquet ante blandit varius ac lobortis nisl. Pellentesque

turpis ante, consectetur egestas semper eget, sodales non

tellus. Pellentesque ullamcorper felis non nibh vehicula in

mollis mi eleifend. Integer eget interdum velit.

Nulla scelerisque nibh non neque tincidunt semper. Integer

lorem est, consequat eu convallis in, egestas quis purus.

Phasellus egestas mi risus. Phasellus a quam nec sapien

vulputate cursus. Maecenas mattis congue placerat.

Pellentesque et euismod massa. Morbi rhoncus euismod

luctus.

Page 35: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Feature SetText wrapping

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Phasellus lacinia pretium diam non tempor. Aenean mollis

pellentesque lectus, vitae ultrices urna tincidunt eu. Mauris

ullamcorper elementum pharetra. Donec imperdiet lacinia

porttitor. Pellentesque habitant morbi tristique senectus et

netus et malesuada fames ac turpis egestas. Nulla lobortis

tortor libero. Donec fringilla placerat lectus sed commodo.

Nulla nisl nulla, feugiat eu sodales nec, semper non nibh.

Nunc porta lacinia cursus. Vestibulum ultrices euismod

euismod. Class aptent taciti sociosqu ad litora torquent per

conubia nostra, per inceptos himenaeos. Quisque nec

lectus id diam molestie

consectetur sed sed ligula.

Nulla non luctus nibh.

Integer viverra posuere urna,

vel volutpat eros eleifend in.

Donec pharetra tincidunt lectus

vitae luctus.

Ut semper vulputate quam in dictum.

Maecenas lobortis porttitor lorem vel molestie. Nam

eros orci, mattis ac placerat nec, blandit sed orci. In

consequat convallis risus eu fermentum. Mauris accumsan

lobortis porta. Nunc feugiat, leo et consequat varius, velit

metus consectetur ante, in bibendum neque felis vel

sapien. Fusce vel risus in tellus convallis facilisis. Nunc

consectetur fringilla sem vel varius. Etiam cursus auctor

tortor vitae dictum. Sed interdum fringilla orci, sed

commodo magna ultricies fringilla. Donec eget convallis

lacus.

Etiam nec mauris lacus. Cras mattis lobortis

dignissim. Sed lorem turpis, feugiat at sodales

eget, porta vel purus. Sed ullamcorper diam ac

justo hendrerit porta. Aliquam sed erat ut

lorem facilisis sollicitudin quis eget mi. Sed

vitae massa id magna sagittis commodo.

Ut feugiat tincidunt purus, et imperdiet

diam convallis vitae. Donec augue

libero, blandit ut dapibus id,

vulputate at velit. Morbi

condimentum bibendum turpis,

sed fermentum turpis ornare non.

In hac habitasse platea dictumst.

Nulla facilisi. Proin vel nibh mi, quis

congue lectus. Etiam sit amet est nec quam iaculis

lobortis sit amet eu leo. Nulla mollis feugiat quam,

a interdum sapien pellentesque sed. Pellentesque eu

sem ut elit fringilla scelerisque a vel leo. Aenean quis lacus

eget massa condimentum adipiscing ac vitae sapien.

Vivamus id nibh aliquet ante blandit varius ac lobortis nisl.

Pellentesque turpis ante, consectetur egestas semper eget,

Page 36: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Feature SetRich Text editing

Heading One

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus lacinia

pretium diam non tempor. Aenean mollis pellentesque lectus, vitae ultrices

urna tincidunt eu. Mauris ullamcorper elementum pharetra. Donec imperdiet

lacinia porttitor. Pellentesque habitant morbi tristique senectus et netus et

malesuada fames ac turpis egestas. Nulla lobortis tortor libero. Donec fringilla

placerat lectus sed commodo. Nulla nisl nulla, feugiat eu sodales nec, semper

non nibh. Nunc porta lacinia cursus. Vestibulum ultrices euismod euismod.

Class aptent taciti sociosqu ad litora torquent per conubia nostra, per

inceptos himenaeos. Quisque nec lectus id diam molestie consectetur sed

sed ligula. Nulla non luctus nibh. Integer viverra posuere urna, vel volutpat

eros eleifend in. Donec pharetra tincidunt lectus vitae luctus.

Ut semper vulputate quam in dictum. Maecenas lobortis porttitor lorem vel

molestie. Nam eros orci, mattis ac placerat nec, blandit sed orci. In

consequat convallis risus eu fermentum. Mauris accumsan lobortis porta.

Nunc feugiat, leo et consequat varius, velit metus consectetur ante, in

bibendum neque felis vel sapien. Fusce vel risus in tellus convallis facilisis.

Nunc consectetur fringilla sem vel varius. Etiam cursus auctor tortor vitae

dictum. Sed interdum fringilla orci, sed commodo magna ultricies fringilla.

Donec eget convallis lacus.

Etiam nec mauris lacus. Cras mattis lobortis dignissim. Sed lorem turpis,

feugiat at sodales eget, porta vel purus. Sed ullamcorper diam ac justo

hendrerit porta. Aliquam sed erat ut lorem facilisis sollicitudin quis eget mi.

Sed vitae massa id magna sagittis commodo. Ut feugiat tincidunt purus, et

imperdiet diam convallis vitae. Donec augue libero, blandit ut dapibus id,

vulputate at velit. Morbi condimentum bibendum turpis, sed fermentum turpis

ornare non.

Page 37: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Interactive text coloringFeature Set

Page 38: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Interactive text coloringFeature Set

@somebody

Page 39: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Interactive text coloringFeature Set

@somebody@somebody: nice layout!@somebody

Page 40: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Text foldingFeature Set

Heading 1This is a snippet of text we’d like to hide.

Heading 2This is a range of text we’d like to keep visible.

Page 41: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Text foldingFeature Set

Heading 1Heading 2

This is a range of text we’d like to keep visible.

Page 42: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Custom truncationFeature Set

Mary had a little lamb its fleecewas white as snow.

Page 43: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Custom truncationFeature Set

Mary had … fleece … was white.

Page 44: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Enhanced in iOS 7Feature Set

•Advanced techniques work in stock components

Page 45: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Enhanced in iOS 7Feature Set

•Advanced techniques work in stock components•UITextView and UITextField support all text attributes

Page 46: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Enhanced in iOS 7Feature Set

•Advanced techniques work in stock components•UITextView and UITextField support all text attributes• Kerning and ligatures everywhere

KERNING

TruffleLIGATURE

Page 47: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Enhanced in iOS 7Feature Set

•Advanced techniques work in stock components•UITextView and UITextField support all text attributes• Kerning and ligatures everywhere• Letterpress

Page 48: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Advanced Text Layouts and Effects with Text Kit MissionThursday 2:00PM

Page 49: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

•Designed type styles

Dynamic TypeFeature Set

Page 50: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

•Designed type styles•Optimized for legibility

Dynamic TypeFeature Set

Page 51: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

•Designed type styles•Optimized for legibility•User picks size

Dynamic TypeFeature Set

Page 52: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

•Designed type styles•Optimized for legibility•User picks size

Dynamic TypeFeature Set

Page 53: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

•Designed type styles•Optimized for legibility•User picks size

Dynamic TypeFeature Set

Page 54: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

•Designed type styles•Optimized for legibility•User picks size•Accessibility

Dynamic TypeFeature Set

Page 55: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

•Designed type styles•Optimized for legibility•User picks size•Accessibility• Xcode 5

Dynamic TypeFeature Set

Page 56: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Font descriptorsFeature Set

• Specifies a font

Page 57: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Font descriptorsFeature Set

• Specifies a font•Queries fonts (and supplies the result)

Page 58: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Font descriptorsFeature Set

• Specifies a font•Queries fonts (and supplies the result)• Can be archived

Page 59: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Using Fonts with Text Kit PresidioFriday 9:00AM

Page 60: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Feature Set

Headline 1Headline 2

Body

Subheadline 1Subheadline 2

FootnoteCaption 1Caption 2

Symbolic traits

Page 61: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Feature SetSymbolic traits

Headline 1Headline 2

Body

Subheadline 1Subheadline 2

FootnoteCaption 1Caption 2

Page 62: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Feature SetSymbolic traits

Regular

Headline 1Headline 2

Body

Subheadline 1Subheadline 2

FootnoteCaption 1Caption 2

Page 63: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Feature Set

Headline 1Headline 2

Body

Subheadline 1Subheadline 2

FootnoteCaption 1Caption 2

Bold

Headline 1Headline 2

Body

Subheadline 1Subheadline 2

FootnoteCaption 1Caption 2

Italic

Symbolic traits

Regular

Headline 1Headline 2

Body

Subheadline 1Subheadline 2

FootnoteCaption 1Caption 2

Page 64: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Feature SetSymbolic traits

Regular

Headline 1Headline 2

Body

Subheadline 1Subheadline 2

FootnoteCaption 1Caption 2

Page 65: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Feature Set

Headline 1Headline 2

Body

Subheadline 1Subheadline 2

FootnoteCaption 1Caption 2

Expanded

Headline 1Headline 2

Body

Subheadline 1Subheadline 2

FootnoteCaption 1Caption 2

Condensed

Symbolic traits

Regular

Headline 1Headline 2

Body

Subheadline 1Subheadline 2

FootnoteCaption 1Caption 2

Page 66: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Feature Set

Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod

Regular

Line spacing

Page 67: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Feature Set

Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh

Loose

Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut

Tight

Line spacing

Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod

Regular

Page 68: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

CSS font valuesFont Enhancements

Page 69: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

CSS font values

-apple-system-headline1-apple-system-headline2-apple-system-body-apple-system-subheadline1-apple-system-subheadline2-apple-system-footnote-apple-system-caption1-apple-system-caption2-apple-system-short-headline1-apple-system-short-headline2-apple-system-short-body-apple-system-short-subheadline1-apple-system-short-subheadline2-apple-system-short-footnote-apple-system-short-caption1-apple-system-tall-body

Font Enhancements

Page 70: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

What’s New in Safari and WebKit for Web Developers MissionTuesday 9:00AM

Page 71: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Feature SetUITextView composition

Page 72: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Feature SetUITextView composition

Page 73: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Feature SetUITextView composition

Page 74: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Feature SetUITextView composition

Page 75: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

NSTextStorage

Feature SetUITextView composition

Page 76: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Exclusion pathsFeature Set

• Simple figures and cutouts

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Phasellus lacinia pretium diam non tempor. Aenean mollis

pellentesque lectus, vitae ultrices urna tincidunt eu. Mauris

ullamcorper elementum pharetra. Donec imperdiet lacinia

porttitor. Pellentesque habitant morbi tristique senectus et

netus et malesuada fames ac turpis egestas. Nulla lobortis

tortor libero. Donec fringilla placerat lectus sed commodo.

Nulla nisl nulla, feugiat eu sodales nec, semper non nibh.

Nunc porta lacinia cursus. Vestibulum ultrices euismod

euismod. Class aptent taciti sociosqu ad litora torquent per

conubia nostra, per inceptos himenaeos. Quisque nec

lectus id diam molestie consectetur sed sed ligula. Nulla

non luctus nibh. Integer viverra posuere urna, vel volutpat

eros eleifend in. Donec pharetra tincidunt lectus vitae

luctus.

Ut semper vulputate quam in dictum. Maecenas lobortis

porttitor lorem vel molestie. Nam eros orci, mattis ac

placerat nec, blandit sed orci. In consequat convallis risus

eu fermentum. Mauris accumsan lobortis porta. Nunc

feugiat, leo et consequat varius, velit metus consectetur

ante, in bibendum neque felis vel sapien. Fusce vel risus in

tellus convallis facilisis. Nunc consectetur fringilla sem vel

varius. Etiam cursus auctor tortor vitae dictum. Sed

interdum fringilla orci, sed commodo magna ultricies

fringilla. Donec eget convallis lacus.

Etiam nec mauris lacus. Cras mattis lobortis dignissim. Sed

lorem turpis, feugiat at sodales eget, porta vel purus. Sed

ullamcorper diam ac justo hendrerit porta. Aliquam sed erat

ut lorem facilisis sollicitudin quis eget mi. Sed vitae massa

id magna sagittis commodo. Ut feugiat tincidunt purus, et

imperdiet diam convallis vitae. Donec augue libero, blandit

ut dapibus id, vulputate at velit. Morbi condimentum

bibendum turpis, sed fermentum turpis ornare non.

In hac habitasse platea dictumst. Nulla facilisi. Proin vel

nibh mi, quis congue lectus. Etiam sit amet est nec quam

iaculis lobortis sit amet eu leo. Nulla mollis feugiat quam, a

interdum sapien pellentesque sed. Pellentesque eu sem ut

elit fringilla scelerisque a vel leo. Aenean quis lacus eget

massa condimentum adipiscing ac vitae sapien. Vivamus id

nibh aliquet ante blandit varius ac lobortis nisl. Pellentesque

turpis ante, consectetur egestas semper eget, sodales non

tellus. Pellentesque ullamcorper felis non nibh vehicula in

mollis mi eleifend. Integer eget interdum velit.

Nulla scelerisque nibh non neque tincidunt semper. Integer

lorem est, consequat eu convallis in, egestas quis purus.

Phasellus egestas mi risus. Phasellus a quam nec sapien

vulputate cursus. Maecenas mattis congue placerat.

Pellentesque et euismod massa. Morbi rhoncus euismod

luctus.

Page 77: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Exclusion pathsFeature Set

• Simple figures and cutoutsUIBezierPath *exclusion = ButterflyBezierPath;

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Phasellus lacinia pretium diam non tempor. Aenean mollis

pellentesque lectus, vitae ultrices urna tincidunt eu. Mauris

ullamcorper elementum pharetra. Donec imperdiet lacinia

porttitor. Pellentesque habitant morbi tristique senectus et

netus et malesuada fames ac turpis egestas. Nulla lobortis

tortor libero. Donec fringilla placerat lectus sed commodo.

Nulla nisl nulla, feugiat eu sodales nec, semper non nibh.

Nunc porta lacinia cursus. Vestibulum ultrices euismod

euismod. Class aptent taciti sociosqu ad litora torquent per

conubia nostra, per inceptos himenaeos. Quisque nec

lectus id diam molestie consectetur sed sed ligula. Nulla

non luctus nibh. Integer viverra posuere urna, vel volutpat

eros eleifend in. Donec pharetra tincidunt lectus vitae

luctus.

Ut semper vulputate quam in dictum. Maecenas lobortis

porttitor lorem vel molestie. Nam eros orci, mattis ac

placerat nec, blandit sed orci. In consequat convallis risus

eu fermentum. Mauris accumsan lobortis porta. Nunc

feugiat, leo et consequat varius, velit metus consectetur

ante, in bibendum neque felis vel sapien. Fusce vel risus in

tellus convallis facilisis. Nunc consectetur fringilla sem vel

varius. Etiam cursus auctor tortor vitae dictum. Sed

interdum fringilla orci, sed commodo magna ultricies

fringilla. Donec eget convallis lacus.

Etiam nec mauris lacus. Cras mattis lobortis dignissim. Sed

lorem turpis, feugiat at sodales eget, porta vel purus. Sed

ullamcorper diam ac justo hendrerit porta. Aliquam sed erat

ut lorem facilisis sollicitudin quis eget mi. Sed vitae massa

id magna sagittis commodo. Ut feugiat tincidunt purus, et

imperdiet diam convallis vitae. Donec augue libero, blandit

ut dapibus id, vulputate at velit. Morbi condimentum

bibendum turpis, sed fermentum turpis ornare non.

In hac habitasse platea dictumst. Nulla facilisi. Proin vel

nibh mi, quis congue lectus. Etiam sit amet est nec quam

iaculis lobortis sit amet eu leo. Nulla mollis feugiat quam, a

interdum sapien pellentesque sed. Pellentesque eu sem ut

elit fringilla scelerisque a vel leo. Aenean quis lacus eget

massa condimentum adipiscing ac vitae sapien. Vivamus id

nibh aliquet ante blandit varius ac lobortis nisl. Pellentesque

turpis ante, consectetur egestas semper eget, sodales non

tellus. Pellentesque ullamcorper felis non nibh vehicula in

mollis mi eleifend. Integer eget interdum velit.

Nulla scelerisque nibh non neque tincidunt semper. Integer

lorem est, consequat eu convallis in, egestas quis purus.

Phasellus egestas mi risus. Phasellus a quam nec sapien

vulputate cursus. Maecenas mattis congue placerat.

Pellentesque et euismod massa. Morbi rhoncus euismod

luctus.

Page 78: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Exclusion pathsFeature Set

• Simple figures and cutoutsUIBezierPath *exclusion = ButterflyBezierPath;textContainer.exclusionPaths = @[exclusion];

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Phasellus lacinia pretium diam non tempor. Aenean mollis

pellentesque lectus, vitae ultrices urna tincidunt eu. Mauris

ullamcorper elementum pharetra. Donec imperdiet lacinia

porttitor. Pellentesque habitant morbi tristique senectus et

netus et malesuada fames ac turpis egestas. Nulla lobortis

tortor libero. Donec fringilla placerat lectus sed commodo.

Nulla nisl nulla, feugiat eu sodales nec, semper non nibh.

Nunc porta lacinia cursus. Vestibulum ultrices euismod

euismod. Class aptent taciti sociosqu ad litora torquent per

conubia nostra, per inceptos himenaeos. Quisque nec

lectus id diam molestie

consectetur sed sed ligula.

Nulla non luctus nibh.

Integer viverra posuere urna,

vel volutpat eros eleifend in.

Donec pharetra tincidunt lectus

vitae luctus.

Ut semper vulputate quam in dictum.

Maecenas lobortis porttitor lorem vel molestie. Nam

eros orci, mattis ac placerat nec, blandit sed orci. In

consequat convallis risus eu fermentum. Mauris accumsan

lobortis porta. Nunc feugiat, leo et consequat varius, velit

metus consectetur ante, in bibendum neque felis vel

sapien. Fusce vel risus in tellus convallis facilisis. Nunc

consectetur fringilla sem vel varius. Etiam cursus auctor

tortor vitae dictum. Sed interdum fringilla orci, sed

commodo magna ultricies fringilla. Donec eget convallis

lacus.

Etiam nec mauris lacus. Cras mattis lobortis

dignissim. Sed lorem turpis, feugiat at sodales

eget, porta vel purus. Sed ullamcorper diam ac

justo hendrerit porta. Aliquam sed erat ut

lorem facilisis sollicitudin quis eget mi. Sed

vitae massa id magna sagittis commodo.

Ut feugiat tincidunt purus, et imperdiet

diam convallis vitae. Donec augue

libero, blandit ut dapibus id,

vulputate at velit. Morbi

condimentum bibendum turpis,

sed fermentum turpis ornare non.

In hac habitasse platea dictumst.

Nulla facilisi. Proin vel nibh mi, quis

congue lectus. Etiam sit amet est nec quam iaculis

lobortis sit amet eu leo. Nulla mollis feugiat quam,

a interdum sapien pellentesque sed. Pellentesque eu

sem ut elit fringilla scelerisque a vel leo. Aenean quis lacus

eget massa condimentum adipiscing ac vitae sapien.

Vivamus id nibh aliquet ante blandit varius ac lobortis nisl.

Pellentesque turpis ante, consectetur egestas semper eget,

Page 79: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Exclusion pathsFeature Set

• Easy, declarative model

Page 80: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Exclusion pathsFeature Set

• Easy, declarative model•No subclassing or delegation needed

Page 81: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

NSTextContainer

NSTextContainerFeature Set

•Defines coordinate system and geometry for NSLayoutManager• Exclusion paths live in NSTextContainer’s coordinates•Hit-testing done in NSTextContainer’s coordinates

Page 82: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

NSTextContainer

NSTextContainerFeature Set

•Defines coordinate system and geometry for NSLayoutManager• Exclusion paths live in NSTextContainer’s coordinates•Hit-testing done in NSTextContainer’s coordinates

Page 83: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

NSTextContainerFeature Set

•Defines coordinate system and geometry for NSLayoutManager• Exclusion paths live in NSTextContainer’s coordinates

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Phasellus lacinia pretium diam non tempor. Aenean mollis

pellentesque lectus, vitae ultrices urna tincidunt eu. Mauris

ullamcorper elementum pharetra. Donec imperdiet lacinia

porttitor. Pellentesque habitant morbi tristique senectus et

netus et malesuada fames ac turpis egestas. Nulla lobortis

tortor libero. Donec fringilla placerat lectus sed commodo.

Nulla nisl nulla, feugiat eu sodales nec, semper non nibh.

Nunc porta lacinia cursus. Vestibulum ultrices euismod

euismod. Class aptent taciti sociosqu ad litora torquent per

conubia nostra, per inceptos himenaeos. Quisque nec

lectus id diam molestie

consectetur sed sed ligula.

Nulla non luctus nibh.

Integer viverra posuere urna,

vel volutpat eros eleifend in.

Donec pharetra tincidunt lectus

vitae luctus.

Ut semper vulputate quam in dictum.

Maecenas lobortis porttitor lorem vel molestie. Nam

eros orci, mattis ac placerat nec, blandit sed orci. In

consequat convallis risus eu fermentum. Mauris accumsan

lobortis porta. Nunc feugiat, leo et consequat varius, velit

metus consectetur ante, in bibendum neque felis vel

sapien. Fusce vel risus in tellus convallis facilisis. Nunc

consectetur fringilla sem vel varius. Etiam cursus auctor

tortor vitae dictum. Sed interdum fringilla orci, sed

commodo magna ultricies fringilla. Donec eget convallis

lacus.

Etiam nec mauris lacus. Cras mattis lobortis

dignissim. Sed lorem turpis, feugiat at sodales

eget, porta vel purus. Sed ullamcorper diam ac

justo hendrerit porta. Aliquam sed erat ut

lorem facilisis sollicitudin quis eget mi. Sed

vitae massa id magna sagittis commodo.

Ut feugiat tincidunt purus, et imperdiet

diam convallis vitae. Donec augue

libero, blandit ut dapibus id,

vulputate at velit. Morbi

condimentum bibendum turpis,

sed fermentum turpis ornare non.

In hac habitasse platea dictumst.

Nulla facilisi. Proin vel nibh mi, quis

congue lectus. Etiam sit amet est nec quam iaculis

lobortis sit amet eu leo. Nulla mollis feugiat quam,

a interdum sapien pellentesque sed. Pellentesque eu

sem ut elit fringilla scelerisque a vel leo. Aenean quis lacus

eget massa condimentum adipiscing ac vitae sapien.

Vivamus id nibh aliquet ante blandit varius ac lobortis nisl.

Pellentesque turpis ante, consectetur egestas semper eget,

Page 84: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

NSTextContainerFeature Set

•Defines coordinate system and geometry for NSLayoutManager• Exclusion paths live in NSTextContainer’s coordinates•Hit-testing done in NSTextContainer’s coordinates

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Phasellus lacinia pretium diam non tempor. Aenean mollis

pellentesque lectus, vitae ultrices urna tincidunt eu. Mauris

ullamcorper elementum pharetra. Donec imperdiet lacinia

porttitor. Pellentesque habitant morbi tristique senectus et

netus et malesuada fames ac turpis egestas. Nulla lobortis

tortor libero. Donec fringilla placerat lectus sed commodo.

Nulla nisl nulla, feugiat eu sodales nec, semper non nibh.

Nunc porta lacinia cursus. Vestibulum ultrices euismod

euismod. Class aptent taciti sociosqu ad litora torquent per

conubia nostra, per inceptos himenaeos. Quisque nec

lectus id diam molestie

consectetur sed sed ligula.

Nulla non luctus nibh.

Integer viverra posuere urna,

vel volutpat eros eleifend in.

Donec pharetra tincidunt lectus

vitae luctus.

Ut semper vulputate quam in dictum.

Maecenas lobortis porttitor lorem vel molestie. Nam

eros orci, mattis ac placerat nec, blandit sed orci. In

consequat convallis risus eu fermentum. Mauris accumsan

lobortis porta. Nunc feugiat, leo et consequat varius, velit

metus consectetur ante, in bibendum neque felis vel

sapien. Fusce vel risus in tellus convallis facilisis. Nunc

consectetur fringilla sem vel varius. Etiam cursus auctor

tortor vitae dictum. Sed interdum fringilla orci, sed

commodo magna ultricies fringilla. Donec eget convallis

lacus.

Etiam nec mauris lacus. Cras mattis lobortis

dignissim. Sed lorem turpis, feugiat at sodales

eget, porta vel purus. Sed ullamcorper diam ac

justo hendrerit porta. Aliquam sed erat ut

lorem facilisis sollicitudin quis eget mi. Sed

vitae massa id magna sagittis commodo.

Ut feugiat tincidunt purus, et imperdiet

diam convallis vitae. Donec augue

libero, blandit ut dapibus id,

vulputate at velit. Morbi

condimentum bibendum turpis,

sed fermentum turpis ornare non.

In hac habitasse platea dictumst.

Nulla facilisi. Proin vel nibh mi, quis

congue lectus. Etiam sit amet est nec quam iaculis

lobortis sit amet eu leo. Nulla mollis feugiat quam,

a interdum sapien pellentesque sed. Pellentesque eu

sem ut elit fringilla scelerisque a vel leo. Aenean quis lacus

eget massa condimentum adipiscing ac vitae sapien.

Vivamus id nibh aliquet ante blandit varius ac lobortis nisl.

Pellentesque turpis ante, consectetur egestas semper eget,

Page 85: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

• Resolving tap to a character index -(NSUInteger)characterIndexForPoint:(CGPoint)point inTextContainer:(NSTextContainer *)containerfractionOfDistanceBetweenInsertionPoints:(CGFloat *)partialFraction;

Hit-testing with NSLayoutManagerFeature Set

Page 86: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

• Resolving tap to a character index -(NSUInteger)characterIndexForPoint:(CGPoint)point inTextContainer:(NSTextContainer *)containerfractionOfDistanceBetweenInsertionPoints:(CGFloat *)partialFraction;

Hit-testing with NSLayoutManagerFeature Set

“a”

Page 87: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

GlyphsFeature Set

•What’s a glyph?

Page 88: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

GlyphsFeature Set

•What’s a glyph?• Represents one or more characters

ffi

Page 89: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

GlyphsFeature Set

•What’s a glyph?• Represents one or more characters•No 1:1 mapping from glyph(s) to character(s) or vice-versa

ffiffi

Page 90: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Hit-testing with NSLayoutManagerFeature Set

•Glyph range to character range

ffi ffi

Page 91: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Hit-testing with NSLayoutManagerFeature Set

•Glyph range to character range- (NSRange)characterRangeForGlyphRange:(NSRange)glyphRange actualGlyphRange:(NSRangePointer)actualGlyphRange;

{0,3}{0,1}ffi ffi

Page 92: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Feature SetInteracting with links

Page 93: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Feature SetInteracting with links

Page 94: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Feature SetData Detectors

Page 95: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Feature SetData Detectors

Page 96: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Feature SetText attachments

Page 97: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Feature SetText attachments

Attachment

Page 98: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Feature SetText attachments

ExclusionAttachment

Page 99: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

•Usually used for inline images

Text attachmentsFeature Set

Page 100: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

•Usually used for inline images•Affects text layout

Text attachmentsFeature Set

Page 101: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

•Usually used for inline images•Affects text layout•Geometry for the contained data

Text attachmentsFeature Set

Page 102: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Feature SetInteracting with attachments

Page 103: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Feature SetInteracting with attachments

Page 104: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

DemoInteraction and layout

Jordan BreedingUIKit Engineer

Page 105: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Demo summaryText Kit Tour

•Data Detectors for basic interaction

Page 106: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Demo summaryText Kit Tour

•Data Detectors for basic interaction • Text views in collection view cells

Page 107: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Demo summaryText Kit Tour

•Data Detectors for basic interaction • Text views in collection view cells• Text Styles

Page 108: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Demo summaryText Kit Tour

•Data Detectors for basic interaction • Text views in collection view cells• Text Styles• Exclusion paths

Page 109: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Realizing amazing designs with Text KitText Kit Design

Ian BairdiOS Text Kit Lead Engineer

Page 110: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Layout and positioning techniquesText Kit Design

Page 111: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Layout and positioning techniquesText Kit Design

Page 112: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Layout and positioning techniquesText Kit Design

Page 113: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Layout and positioningText Kit Design

Hey John:

Page 114: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Layout and positioningText Kit Design

Hey John:

Page 115: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Layout and positioningText Kit Design

Hey John:.8 * Cap height

Page 116: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Font metricsText Kit Design

• If you have a detailed spec (like Mail) you’ll need to become familiar with the following font metrics

AbcdefgAbcdefg

Page 117: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Font metricsText Kit Design

• If you have a detailed spec (like Mail) you’ll need to become familiar with the following font metrics• Line height[myFont lineHeight] Abcdefg

Abcdefg

Page 118: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Font metricsText Kit Design

• If you have a detailed spec (like Mail) you’ll need to become familiar with the following font metrics• Line height[myFont lineHeight]

• Cap height[myFont capHeight] Abcdefg

Abcdefg

Page 119: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Font metricsText Kit Design

• If you have a detailed spec (like Mail) you’ll need to become familiar with the following font metrics• Line height[myFont lineHeight]

• Cap height[myFont capHeight]

• Leading: space between lines of text[myFont leading]

AbcdefgAbcdefg

Page 120: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Font metricsText Kit Design

• If you have a detailed spec (like Mail) you’ll need to become familiar with the following font metrics• Line height[myFont lineHeight]

• Cap height[myFont capHeight]

• Leading: space between lines of text[myFont leading]

• Can be negative to move lines closer together!

AbcdefgAbcdefg

Page 121: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Changing sizeText Kit Design

• UIContentSizeCategoryDidChangeNotification emitted when user selects a new size

Page 122: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Changing sizeText Kit Design

• UIContentSizeCategoryDidChangeNotification emitted when user selects a new size•Observe UIContentSizeCategoryDidChangeNotification and re-layout your UI when received

Page 123: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Changing sizeText Kit Design

• UIContentSizeCategoryDidChangeNotification emitted when user selects a new size•Observe UIContentSizeCategoryDidChangeNotification and re-layout your UI when received■ Invalidate intrinsic content size on UIKit views positioned by Auto Layout

Page 124: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Changing sizeText Kit Design

• UIContentSizeCategoryDidChangeNotification emitted when user selects a new size•Observe UIContentSizeCategoryDidChangeNotification and re-layout your UI when received■ Invalidate intrinsic content size on UIKit views positioned by Auto Layout

■ Call setNeedsLayout to re-layout your UI if positioning manually

Page 125: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Changing sizeText Kit Design

• UIContentSizeCategoryDidChangeNotification emitted when user selects a new size•Observe UIContentSizeCategoryDidChangeNotification and re-layout your UI when received■ Invalidate intrinsic content size on UIKit views positioned by Auto Layout

■ Call setNeedsLayout to re-layout your UI if positioning manually■ Invalidate cached preferred fonts or font descriptors

Page 126: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

DemoText Kit and design

Jordan BreedingUIKit Engineer

Page 127: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

It’s dynamic!Text Kit and Design

• Realize complex designs

Page 128: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

It’s dynamic!Text Kit and Design

• Realize complex designs• Respond to the change notification

Page 129: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

It’s dynamic!Text Kit and Design

• Realize complex designs• Respond to the change notification• Customize text container line break mode

Page 130: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Content modification during user inputInteractive Rich Text

Johannes FortmannUIKit Engineer

Page 131: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Interactive content updatesText Kit and Rich Text

Page 132: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Interactive content updatesText Kit and Rich Text

• iOS 6: -attributedText property

Page 133: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Interactive content updatesText Kit and Rich Text

• iOS 6: -attributedText property• iOS 7: direct access to -textStorage

Page 134: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Interactive content updatesText Kit and Rich Text

• iOS 6: -attributedText property• iOS 7: direct access to -textStorage• Selective editing messages with change notifications

Page 135: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Anatomy of an updateText Kit and Rich Text

Page 136: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Anatomy of an updateText Kit and Rich Text

•Use attributed string methods to modify

Page 137: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Anatomy of an updateText Kit and Rich Text

•Use attributed string methods to modify

Page 138: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Anatomy of an updateText Kit and Rich Text

•Use attributed string methods to modify• Bracket edits to batch updates

Page 139: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Anatomy of an updateText Kit and Rich Text

•Use attributed string methods to modify• Bracket edits to batch updates[tv.textStorage beginEditing];

Page 140: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Anatomy of an updateText Kit and Rich Text

•Use attributed string methods to modify• Bracket edits to batch updates[tv.textStorage beginEditing];[self markWord:@”Alice” inTextStorage:tv];

Page 141: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Anatomy of an updateText Kit and Rich Text

•Use attributed string methods to modify• Bracket edits to batch updates[tv.textStorage beginEditing];[self markWord:@”Alice” inTextStorage:tv];[tv.textStorage endEditing];

Page 142: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Anatomy of an updateText Kit and Rich Text

•Use attributed string methods to modify• Bracket edits to batch updates[tv.textStorage beginEditing];[self markWord:@”Alice” inTextStorage:tv];[tv.textStorage endEditing];…Text Kit processes changes…

Page 143: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Anatomy of an updateText Kit and Rich Text

•Use attributed string methods to modify• Bracket edits to batch updates[tv.textStorage beginEditing];[self markWord:@”Alice” inTextStorage:tv];[tv.textStorage endEditing];…Text Kit processes changes…

Page 144: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Subclassing NSTextStorageRich Text Editing

•Why?

Page 145: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Subclassing NSTextStorageRich Text Editing

•Why?• Example: Change text attributes while typing

Page 146: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Subclassing NSTextStorageRich Text Editing

•Why?• Example: Change text attributes while typing

@somebody

Page 147: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Subclassing NSTextStorageRich Text Editing

•Why?• Example: Change text attributes while typing

@somebody@somebody: nice layout!@somebody

Page 148: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Subclassing NSTextStorageRich Text Editing

Page 149: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

• Class cluster

Subclassing NSTextStorageRich Text Editing

Page 150: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

• Class cluster

Subclassing NSTextStorageRich Text Editing

NSTextStorage

Page 151: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

• Class cluster

Subclassing NSTextStorageRich Text Editing

Concrete text storage

NSTextStorage

Page 152: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

• Class cluster

Subclassing NSTextStorageRich Text Editing

Concrete text storage

NSTextStorage

Your subclass

Page 153: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

• Class cluster•Override primitive methods

Subclassing NSTextStorageRich Text Editing

Concrete text storage

NSTextStorage

-string-attributesAtIndex:effectiveRange:-replaceCharactersInRange:withString:-setAttributes:range:

Your subclass

Page 154: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

• Class cluster•Override primitive methods

Subclassing NSTextStorageRich Text Editing

Concrete text storage

NSTextStorage

-string-attributesAtIndex:effectiveRange:-replaceCharactersInRange:withString:-setAttributes:range:

Your subclass

Page 155: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

• Class cluster•Override primitive methods

Subclassing NSTextStorageRich Text Editing

Concrete text storage

NSTextStorage

-string-attributesAtIndex:effectiveRange:-replaceCharactersInRange:withString:-setAttributes:range:

Your subclass

Page 156: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

DemoDynamic attributes and interaction

Page 157: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

DemoText Kit and Data

Page 158: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

DemoText Kit and Data

•Assembling the text system

Page 159: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

DemoText Kit and Data

•Assembling the text system• Subclassing NSTextStorage

Page 160: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

DemoText Kit and Data

•Assembling the text system• Subclassing NSTextStorage• Interactive content modification

Page 161: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Knowledge absorptionWrapping It Up

Page 162: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Text Kit

Page 163: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Text Kit

•Highly capable first-class citizen of UIKit

Page 164: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Text Kit

•Highly capable first-class citizen of UIKit• Powerful

Page 165: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Text Kit

•Highly capable first-class citizen of UIKit• Powerful• Customizable and extensible

Page 166: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

More Information

Jake BehrensApp Frameworks [email protected]

DocumentationiOS Human Interface Guidelineshttp://developer.apple.com/library/ios/#documentation/userexperience

Apple Developer Forumshttp://devforums.apple.com

Page 167: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Related Sessions

Advanced Text Layouts and Effects with Text Kit MissionThursday 2:00PM

Using Fonts with Text Kit PresidioFriday 9:00AM

What’s New in Safari and WebKit for Web Developers MissionTuesday 9:00AM

Page 168: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Labs

Text Kit and Core Text Lab Frameworks Lab BWednesday 4:30PM

Text Kit and Core Text Lab Frameworks Lab AThursday 4:30PM

Page 169: Introducing Text Kit - Apple Inc. · •Mastering Core Text considered to be a “rite of passage ... •Seamlessly integrates with animations, UICollectionView, and UITableView.

Recommended