Slide 1

Slide 1 text

題: 発表者: 場所: 日付: /45FYU7JFX ͱ͸Կͳͷ͔ KQ NBD04OBUJWF4ZNQPTJVN

Slide 2

Slide 2 text

macOS native /45FYU7JFX ͱ͸Կͳͷ͔ © 2019 1024jp ࣗݾ঺հ KQ ͸ NBD04 ΞϓϦέʔγϣϯઐ໳ͷϗϏʔ։ൃऀɻ 044 ϓϩδΣΫτӡӦ͔ΒϓϩάϥϛϯάɺΞΠίϯͷσ βΠϯ·ͰɺNBD04 ͷΞϓϦέʔγϣϯ։ൃʹؔΘΔ͜ ͱͳΒશ෦΍ΔϚϯͰ͋Δɻ ͤΜʹ͡Ύ͏ΑΜ
 ͐͡ʔͽʔ 本業ではないよ

Slide 3

Slide 3 text

macOS native /45FYU7JFX ͱ͸Կͳͷ͔ © 2019 1024jp ࣗݾ঺հ CotEditor Gapplin BathyScaphe Qli application work plain-text editor SVG viewer 5ch browser movie player 2014年に
 正式引き継ぎ サポーtメンバー
 (主にデザイン・UI)

Slide 4

Slide 4 text

macOS native /45FYU7JFX ͱ͸Կͳͷ͔ © 2019 1024jp $PU&EJUPS lightweight plain-text editor
 written in Swift + Cocoa github.com/coteditor NSTextView subclass

Slide 5

Slide 5 text

macOS native /45FYU7JFX ͱ͸Կͳͷ͔ © 2019 1024jp ࠓ೔ͷओ໾ NSTextView

Slide 6

Slide 6 text

macOS native ܹ࿦NBD04$BUBMJOB © 2019 1024jp લճͷ ࣍ճ༧ࠂ 欭 䥛孉勦 ⬕㔡 㣆↹ /45FYU7JFXͱͦͷϚϧνΧʔιϧ࣮૷ KQ NBD04OBUJWF4ZNQPTJVN

Slide 7

Slide 7 text

macOS native /45FYU7JFX ͱ͸Կͳͷ͔ © 2019 1024jp ࠓ೔ͷτϐοΫ ѻ͏࿩ – NSTextViewͷཱͪҐஔ – NSTextViewͷ͘͠Έ – TextKitͷมભ ѻΘͳ͍࿩ – ϚϧνΧʔιϧ – ΩʔϘʔυೖྗ૚ – λΠϙάϥϑΟ – Core Text

Slide 8

Slide 8 text

macOS native /45FYU7JFX ͱ͸Կͳͷ͔ © 2019 1024jp 5FYU,JU "QQ,JU ͦͯ͠ /45FYU7JFX Core Graphics TextKit AppKit NSTextView NSTextField NSTextInputContext NSParagraphStyle NSGlyphInfo NSLayoutManager Foundation Core Text UIKit UITextField UITextView UILabel NSSpellChecker UITextInput NSTextAttachment UITextChecker

Slide 9

Slide 9 text

macOS native /45FYU7JFX ͱ͸Կͳͷ͔ © 2019 1024jp /45FYU'JFME ͱ /45FYU7JFX ௕จςΩετ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor NSTextView NSTextView NSTextField ୹จςΩετ දࣔ ೖྗ ΖΕΉ͍΀͞m NSTextView ラベルや表のセル、一行の入力欄など 文書や複数行のテキストなど Name: Clarus Clarus Name: field editor

Slide 10

Slide 10 text

macOS native /45FYU7JFX ͱ͸Կͳͷ͔ © 2019 1024jp ςΩετฤूͷػೳΛఏڙ͢ΔͨΊʹɺ
 ฤू༻ͷϏϡʔ ϑΟʔϧυΤσΟλ ͕ ϏϡʔώΤϥϧΩʔʹࠩ͠ࠐ·ΕΔɻ ΢Πϯυ΢͕͚ͭͩ
 ϑΟʔϧυΤσΟλΛ࣋ͭ ෳ਺ͷςΩετೖྗཝ͕
 ಉ࣌ʹฤूঢ়ଶʹͳΔ͜ͱ͸͋Γಘͳ͍ ϑΟʔϧυΤσΟλ NSTextFieldを編集するときだけ現れる不思議なビュー NSTextView NSTextField 35 Species: Age: Barks: Clarus Moof! Characteristic: Kawaii dogcow field editor Field Editor = First Responder しんどい

Slide 11

Slide 11 text

macOS native /45FYU7JFX ͱ͸Կͳͷ͔ © 2019 1024jp /45FYU7JFX ͷͭͷ໾ׂ ςΩετσʔλͷϏϡʔ ϑΟʔϧυΤσΟλ Moof! Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor heavy-weight ͳ ೖྗΛड͚Δ

Slide 12

Slide 12 text

macOS native /45FYU7JFX ͱ͸Կͳͷ͔ © 2019 1024jp

Slide 13

Slide 13 text

macOS native /45FYU7JFX ͱ͸Կͳͷ͔ © 2019 1024jp 5FYU,JU ただし 仕組みは同一ではない NBD04J04UW04ʹ
 ଘࡏ ಠཱͨ͠GSBNFXPSLͰ͸ͳ͘ "QQ,JU6*,JUͷҰ෦ 5FYU7JFXΛච಄ͱͨ͠ ςΩετೖग़ྗ·ΘΓͷ
 Ϋϥεͷू߹ମ 範囲があいまい

Slide 14

Slide 14 text

macOS native /45FYU7JFX ͱ͸Կͳͷ͔ © 2019 1024jp J04UW04 ʹ͓͚Δ 5FYU7JFX NSTextStorage NSLayoutManager NSTextContainer CoreText UITextView スタイル付き
 テキストデータ テキストデータを
 表示空間に割り付ける テキスト表示空間 ユーザとのやり取り 入力 実際の描画計算 ref. “Getting to Know TextKit” (2013) by Max Seelemann @Ulysses https://www.objc.io/issues/5-ios7/getting-to-know-textkit/ View Model Model Controller Pr UITextInput

Slide 15

Slide 15 text

macOS native /45FYU7JFX ͱ͸Կͳͷ͔ © 2019 1024jp NBD04 ʹ͓͚Δ 5FYU7JFX NSTextStorage NSLayoutManager NSTextContainer CoreText NSTextView NSTextInputContext NSTypesetter NSGlyphGenerator スタイル付き
 テキストデータ テキストデータを
 表示空間に割り付ける ユーザとのやり取り 入力 各行にグリフを流し込む グリフを生成 テキスト表示空間 ref. “Getting to Know TextKit” (2013) by Max Seelemann @Ulysses https://www.objc.io/issues/5-ios7/getting-to-know-textkit/ View Model Model Controller Controller Controller Pr NSTextInputClient 実際の描画計算

Slide 16

Slide 16 text

macOS native /45FYU7JFX ͱ͸Կͳͷ͔ © 2019 1024jp J04UW04 ͱ NBD04 ͷҧ͍ 両方TextKitだが、わりと違うものとして扱った方が良い。 (= iOSのTextKitに関するノウハウはあまり役に立たない) NSTextStorage NSLayoutManager NSTextContainer CoreText UITextView JOJ04UW04 NSTextStorage NSLayoutManager NSTextContainer CoreText NSTextView NSTextInputContext NSTypesetter NSGlyphGenerator JONBD04

Slide 17

Slide 17 text

macOS native /45FYU7JFX ͱ͸Կͳͷ͔ © 2019 1024jp 5FYU,JU ͷྺ࢙ iPhone OS iOS 3.2 Mac OS X 10.4 1998 macOS (Mac OS X) 2020 2007 iOS TextKitという名称が
 初めて出てくる Mac OS 8.5 2001 2005 2013 2010 Apple Type Services for Unicode Imaging Mac OS Mac OS X 10.0 NSTextView, etc UITextView TextKit CoreText CoreText ATSUI iOS 7

Slide 18

Slide 18 text

macOS native /45FYU7JFX ͱ͸Կͳͷ͔ © 2019 1024jp 5FYU7JFXJONBD04 スタイル付き
 テキストデータ テキストデータを
 表示空間に割り付ける ユーザとのやり取り 入力 テキスト表示空間 NSTextStorage NSLayoutManager NSTextContainer NSTextView NSTextInputContext NSTypesetter NSGlyphGenerator View Model Model Controller Controller Controller Pr NSTextInputClient 各行にグリフを流し込む グリフを生成

Slide 19

Slide 19 text

macOS native /45FYU7JFX ͱ͸Կͳͷ͔ © 2019 1024jp 5FYU7JFXJONBD04 NSTextStorage NSLayoutManager NSTextContainer NSTextView NSTextInputContext NSTypesetter NSGlyphGenerator View Model Model Controller Controller Controller ͜ͷͭͷΫϥε͕ڠۀͯ͠ςΩετͷೖྗ͔Βग़ྗ·Ͱ͕׬݁͢Δɻ → 必要に応じてこれらをサブクラスして使う delegate delegate delegate ・デリゲートを受ける

Slide 20

Slide 20 text

macOS native /45FYU7JFX ͱ͸Կͳͷ͔ © 2019 1024jp ༷ʑͳ֓೦ਤ モデルから出力までの流れを説明 Fig. Text object configuration for a single flow of text in Cocoa Text Architecture Guide Appleによる

Slide 21

Slide 21 text

macOS native /45FYU7JFX ͱ͸Կͳͷ͔ © 2019 1024jp ༷ʑͳ֓೦ਤ “Advanced Cocoa Text Tips and Tricks” | WWDC2010 Session114 各クラスをModel-View-Controllerで分類して説明 Cocoa Text System The Cocoa Text System helper classes Vi ew Controller Model NSTextView NSLayoutManager NSTextStorage NSTextContainer NSTextAttachment NSGlyphGenerator NSTypesetter Appleによる

Slide 22

Slide 22 text

macOS native /45FYU7JFX ͱ͸Կͳͷ͔ © 2019 1024jp ༷ʑͳ֓೦ਤ 入出力からモデルまでの流れをMVCの観点から説明 in Cocoa Text Arcihtecture Guide Appleによる

Slide 23

Slide 23 text

macOS native /45FYU7JFX ͱ͸Կͳͷ͔ © 2019 1024jp ༷ʑͳ֓೦ਤ 描画におけるそれぞれのクラスの役割を説明 Fig. Composition of text display in Text Layout Programming Guide Appleによる We the People of the United We the People of the United States, in Order to form a more perfect Union, establish Justice, insure domestic Tranquility, provide for the common defence, promote the general Welfare, and secure the Blessings of Liberty to ourselves and our Posterity, do ordain and establish this Constitution for the United States of America. Section 1. All legislative Powers herein granted shall be vested in a Congress of the United States, which shall consist of a Senate and House of We the People of the United Window Glyph generator provides glyphs for characters. Typesetter places glyphs in line fragment rectangles. Text container models area on page to lay out text. Text view displays text within content view and handles user interactions. Window content view

Slide 24

Slide 24 text

macOS native /45FYU7JFX ͱ͸Կͳͷ͔ © 2019 1024jp ༷ʑͳ֓೦ਤ テキストレイアウト時のメソッド呼び出し順序を説明 Fig. The text layout process in Text Layout Programming Guide Appleによる anNSTypesetter anNSTextContainer anNSTextStorage anNSTextView r epl ac eChar ac t er s I nRange: wi t h s t r i ng: anNSLayoutManager l ayout Gl yphs I nLayout M anager : s t ar t i ngAt Gl yphI ndex: m axNum ber Of Li neFr agm ent s : next Gl yphI ndex: l i neFr agm ent Rec t For Pr opos edRec t : s weepDi r ec t i on: m ovem ent Di r ec t i on: r em ai ni ngRec t : t ext St or age: edi t ed: r ange: c hangeI nLengt h i nval i dat edRange: 2 3 8 9 s et Needs Di s pl ayI nRec t : avoi dAddi t i onal Layout : 4 6 7 5 1

Slide 25

Slide 25 text

macOS native /45FYU7JFX ͱ͸Կͳͷ͔ © 2019 1024jp ༷ʑͳ֓೦ਤ Cocoa Text System The Cocoa Text System helper classes Vi ew Controller Model NSTextView NSLayoutManager NSTextStorage NSTextContainer NSTextAttachment NSGlyphGenerator NSTypesetter Appleによる We the People of the United We the People of the United States, in Order to form a more perfect Union, establish Justice, insure domestic Tranquility, provide for the common defence, promote the general Welfare, and secure the Blessings of Liberty to ourselves and our Posterity, do ordain and establish this Constitution for the United States of America. Section 1. All legislative Powers herein granted shall be vested in a Congress of the United States, which shall consist of a Senate and House of We the People of the United Window Glyph generator provides glyphs for characters. Typesetter places glyphs in line fragment rectangles. Text container models area on page to lay out text. Text view displays text within content view and handles user interactions. Window content view anNSTypesetter anNSTextContainer anNSTextStorage anNSTextView r epl ac eChar ac t er s I nRange: wi t h s t r i ng: anNSLayoutManager l ayout Gl yphs I nLayout M anager : s t ar t i ngAt Gl yphI ndex: m axNum ber Of Li neFr agm ent s : next Gl yphI ndex: l i neFr agm ent Rec t For Pr opos edRec t : s weepDi r ec t i on: m ovem ent Di r ec t i on: r em ai ni ngRec t : t ext St or age: edi t ed: r ange: c hangeI nLengt h i nval i dat edRange: 2 3 8 9 s et Needs Di s pl ayI nRec t : avoi dAddi t i onal Layout : 4 6 7 5 1

Slide 26

Slide 26 text

macOS native /45FYU7JFX ͱ͸Կͳͷ͔ © 2019 1024jp ෳ਺ͷ -BZPVU.BOBHFS5FYU$POUBJOFS NSTextStorage NSLayoutManager NSTextContainer NSTextView NSTextStorage NSLayoutManager NSTextContainer NSTextView NSTextContainer NSTextView NSTextStorage NSLayoutManager NSTextContainer NSTextView NSLayoutManager NSTextContainer NSTextView Multiple layout managers allow you to have multiple presentations of the same text. The text within each view can have separate layout and selections. Multiple layout managers allow you to have multiple presentations of the same text. The text within each view can have separate layout and selections. With one text view, all of the text flows within a single, typically recutangular, area. As text is added, it fills the recion defined by the first text containers. The text is displayed in the text view that is paired with the text container. When there’s no ⾭ more room, another text container (and associated text view) is added, and the text flows onto the second page. CBTJD NVMUJDPOUBJOFST NVMUJMBZPVU.BOBHFST

Slide 27

Slide 27 text

macOS native /45FYU7JFX ͱ͸Կͳͷ͔ © 2019 1024jp /45FYU7JFX ͷ֎ଆ NSScrollView NSRulerViews NSClipView NSTextView NSScrollers

Slide 28

Slide 28 text

macOS native /45FYU7JFX ͱ͸Կͳͷ͔ © 2019 1024jp /45FYU7JFX ͷ֎ଆ NSScrollView NSRulerViews NSClipView NSTextView NSScrollers Font Panel, etc Interactions – Menu Actions – Keybindings – Find/Replace – Print – … Touch Bar TextView component Inspector Bar

Slide 29

Slide 29 text

macOS native /45FYU7JFX ͱ͸Կͳͷ͔ © 2019 1024jp /45FYU7JFX ͕४ڌ͍ͯ͠Δϓϩτίϧ Responder – NSColorChanging – NSDraggingSource – NSUserActivityRestoring Touch Bar – NSTouchBarProvider – NSCandidateListTouchBarItemDelegate – NSTextLayoutOrientationProvider – NSTouchBarDelegate UI Validations – NSUserInterfaceValidations – NSMenuItemValidation Spell Check – NSChangeSpelling – NSIgnoreMisspelledWords Text Typing – NSTextInput (slated for deprecation) – NSTextInputClient – NSAccessibilityNavigableStaticText – NSStandardKeyBindingResponding

Slide 30

Slide 30 text

macOS native /45FYU7JFX ͱ͸Կͳͷ͔ © 2019 1024jp γεςϜػೳͱͷ࿈ܞ ྫ ࣙॻ QuickLook ڞ༗

Slide 31

Slide 31 text

macOS native /45FYU7JFX ͱ͸Կͳͷ͔ © 2019 1024jp γεςϜػೳͱͷ࿈ܞ ྫ Ի੠ೖྗ γεςϜϨϕϧͷೖྗ·ΘΓઃఆ

Slide 32

Slide 32 text

macOS native /45FYU7JFX ͱ͸Կͳͷ͔ © 2019 1024jp /45FYU7JFX ͷܧঝؔ܎ NSText NSView subclass subclass お前だれだ? NSObject NSResponder subclass subclass UITextView UIScrollView UIView subclass subclass NSObject UIResponder subclass subclass 6*5FYU7JFX /45FYU7JFX NSTextView

Slide 33

Slide 33 text

macOS native /45FYU7JFX ͱ͸Կͳͷ͔ © 2019 1024jp /45FYUͱ͸ –NSTextView以外では使われてない –サブクラスもとくに推奨されてない –これだけだと使えない AppKit reference (2019/macOS 10.14) Class NSText The most general programmatic interface for objects that manage text. var string: String var isEditable: Bool var isFieldEditor: Bool var baseWritingDirection: NSWritingDirection func replaceCharacters(in: NSRange, with: String) func paste(Any?) func scrollRangeToVisible(NSRange) NSTextͷAPI (ൈਮ) var textStorage var layoutManager var textContainer NSTextViewͷAPI (ൈਮ) NSTextʹͳ͍

Slide 34

Slide 34 text

macOS native /45FYU7JFX ͱ͸Կͳͷ͔ © 2019 1024jp /45FYUͱ͸ Protocol NSTextInputClient A set of methods that text views must implement to interact properly with the text input management system. Overview To create another text view class, you can either subclass NSTextView (and not NSText, for historical reasons), or subclass NSView and implement the NSTextInputClient protocol AppKit reference (2019/macOS 10.14) → NSTextInputContextとやり取りできない。 NSTextViewが準拠してるヤツ

Slide 35

Slide 35 text

macOS native /45FYU7JFX ͱ͸Կͳͷ͔ © 2019 1024jp /45FYUͱ͸ 欭 䥛孉勦 ⬕㔡 㣆↹ (/6TUFQͱ$PDPUSPO KQ NBD04OBUJWF4ZNQPTJVN “GNUstepͱCocotron”, macOS native Symposium #03 https://speakerdeck.com/1024jp/gnustep-and-cocotron

Slide 36

Slide 36 text

macOS native /45FYU7JFX ͱ͸Կͳͷ͔ © 2019 1024jp /45FYUͱ͸ macOS native (/6TUFQͱ$PDPUSPO © 2019 1024jp "QQMJDBUJPO,JU 0QFO4UFQ NSColorList NSObject NSColor NSCell NSColorPicker NSCursor NSDataLink NSDataLinkManager NSEvent NSFont NSFontManager NSImage NSImageRep NSPasteboard NSPrintInfo NSPrintOperation NSPrinter NSResponder NSScreen NSSelection NSSpellChecker NSSpellServer NSWorkspace NSActionCell NSBrowserCell NSBitmapImageRep NSEPSImageRep NSCachedImageRep NSCustomImageRep NSWindow NSApplication NSView NSButtonCell NSFormCell NSSliderCell NSTextFieldCell NSMenuCell NSPanel NSText NSCStringText NSSplitView NSScrollView NSControl NSBox NSClipView NSColorPanel NSDataLinkPanel NSFontPanel NSHelpPanel NSMenu NSPageLayout NSPrintPanel NSSavePanel NSOpenPanel NSTextField NSBrowser NSButton NSColorWell NSMatrix NSScroller NSSlider NSPopUpButton NSForm “GNUstepͱCocotron”, macOS native Symposium #03 https://speakerdeck.com/1024jp/gnustep-and-cocotron ger n NSActionCell NSBrowserCell NSBitmapImageRep NSEPSImageRep NSCachedImageRep NSCustomImageRep NSWindow NSApplication NSView NSButtonCell NSFormCell NSSliderCell NSTextFieldCell NSMenuCell NSPanel NSText NSCStringText NSSplitView NSScrollView NSControl NSBox NSClipView NSColorPanel NSDataLinkPanel NSFontPanel NSHelpPanel NSMenu NSPageLayout NSPrintPanel NSSavePanel NSOpenPanel NSTextField NSBrowser NSButton NSColorWell NSMatrix NSScroller NSSlider NSPopUpButton NSForm 0QFO4UFQ NSActionCell NSBrowserCell NSBitmapImageRep NSEPSImageRep NSCachedImageRep NSCustomImageRep NSWindow NSApplication NSView NSButtonCell NSFormCell NSSliderCell NSTextFieldCell NSMenuCell NSPanel NSText NSCStringText NSSplitView NSScrollView NSControl NSBox NSClipView NSColorPanel NSDataLinkPanel NSFontPanel NSHelpPanel NSMenu NSTextField NSBrowser NSButton NSColorWell NSMatrix NSScroller NSSlider NSPopUpButton NSForm 0QFO4UFQ ޙظNeXT༻ϑϨʔϜϫʔΫɻ چNeXTSTEPɻ

Slide 37

Slide 37 text

macOS native /45FYU7JFX ͱ͸Կͳͷ͔ © 2019 1024jp NSText Inherits From: NSView : NSResponder : NSObject Conforms To: NSChangeSpelling, NSIgnoreMisspelledWords NSCoding (NSResponder) NSObject (NSObject) Declared In: AppKit/NSTextView.h Class Description The NSText class declares the programmatic interface to objects that manage text. NSText objects are used by the Application Kit wherever text appears in interface objects: An NSText object draws the title of a window, the commands in a menu, the title of a button, and the items in a browser. Your application inherits these uses of the NSText class when it incorporates any of these objects into its interface. Your application can also create NSText objects for its own purposes. The NSText class is unlike most other classes in the Application Kit in its complexity and range of features. One of its design goals is to provide a comprehensive set of text-handling features so that you’ll rarely need to create a subclass. An NSText object can (among other things): • Control the color of its text and background. • Control the font and layout characteristics of its text. /45FYUͱ͸ OpenStep specification (1994)

Slide 38

Slide 38 text

macOS native /45FYU7JFX ͱ͸Կͳͷ͔ © 2019 1024jp Class NSText The NSText class declares
 the programmatic interface to objects that manage text. Class NSText The most general programmatic interface for objects that manage text. /45FYUͱ͸ AppKit reference (2019) OpenStep specification (1994)

Slide 39

Slide 39 text

macOS native /45FYU7JFX ͱ͸Կͳͷ͔ © 2019 1024jp NSText Inherits From: NSView : NSResponder : NSObject Conforms To: NSChangeSpelling, NSIgnoreMisspelledWords NSCoding (NSResponder) NSObject (NSObject) Declared In: AppKit/NSTextView.h Class Description The NSText class declares the programmatic interface to objects that manage text. NSText objects are used by the Application Kit wherever text appears in interface objects: An NSText object draws the title of a window, the commands in a menu, the title of a button, and the items in a browser. Your application inherits these uses of the NSText class when it incorporates any of these objects into its interface. Your application can also create NSText objects for its own purposes. The NSText class is unlike most other classes in the Application Kit in its complexity and range of features. One of its design goals is to provide a comprehensive set of text-handling features so that you’ll rarely need to create a subclass. An NSText object can (among other things): • Control the color of its text and background. • Control the font and layout characteristics of its text. OpenStep specification (1994) /45FYUͱ͸ !? –NSTextサブクラスであるNSCStringTextのAPIはNSTextViewとあまり似ていない。 –OpenStepの仕様書にNSTextViewは存在しないが…

Slide 40

Slide 40 text

macOS native /45FYU7JFX ͱ͸Կͳͷ͔ © 2019 1024jp /F9545&1 ͷόʔδϣϯวྺ 1989 1997 1993 1991 1995 1992 1990 1994 1996 NeXTSTEP OPENSTEP 1998 1.0 2.0 3.0 ࢓༷ॻ 4.0 Sun Microsystemsと
 NeXTが提携 NeXT買収 Rhapsody開発版リリース NSText.h /* NSText.h Application Kit Copyright (c) 1994-2018, Apple Inc. All rights reserved. */ (AppKit) 3.3 4.2

Slide 41

Slide 41 text

macOS native (/6TUFQͱ$PDPUSPO © 2019 1024jp "QQMJDBUJPO,JU 0QFO4UFQESBGU NSCell NSWorkspace NSActionCell NSBrowserCell NSBitmapImageRep NSEPSImageRep NSWindow NSApplication NSView NSButtonCell NSTextFieldCell NSMenuCell NSPanel NSText NSCStringText NSBox NSColorPanel NSMenu NSPageLayout NSPrintPanel NSSavePanel NSOpenPanel NSTextField NSBrowser NSMatrix NSPopUpButton NSForm NSFormCell NSSliderCell NSCachedImageRep NSCustomImageRep NSClipView NSControl NSScrollView NSSplitView NSColorList NSColor NSColorPicker NSCursor NSDataLink NSDataLinkManager NSEvent NSFont NSFontManager NSImage NSImageRep NSPasteboard NSPrintInfo NSPrintOperation NSPrinter NSResponder NSScreen NSSelection NSSpellChecker NSSpellServer NSButton NSColorWell NSScroller NSSlider NSDataLinkPanel NSFontPanel NSHelpPanel #03 再掲 NSObject

Slide 42

Slide 42 text

macOS native /45FYU7JFX ͱ͸Կͳͷ͔ © 2019 1024jp "QQMJDBUJPO,JU 0QFO4UFQ NSCell NSSpellServer NSActionCell NSBitmapImageRep NSEPSImageRep NSWindow NSApplication NSView NSButtonCell NSTextFieldCell NSPanel NSText NSCStringText NSSplitView NSScrollView NSControl NSBox NSClipView NSColorPanel NSPageLayout NSSavePanel NSOpenPanel NSTextField NSBrowser NSColorWell NSMatrix NSPopUpButton NSForm NSFormCell NSSliderCell NSCachedImageRep NSCustomImageRep NSColorList NSColor NSColorPicker NSCursor NSDataLink NSDataLinkManager NSEvent NSObject NSPrintOperation NSPrinter NSResponder NSSelection NSScroller NSSlider NSPrintPanel NSDataLinkPanel NSFontPanel NSTextView NSTextAttachmentCell NSComboBoxCell NSTableHeaderCell NSRulerView NSTableHeaderView NSComboBox NSSecureTextField NSTableView NSDPSContext NSDPSServerContext NSFileWRapper NSInputManager NSInputServer NSMenu NSMenuItem NSParagraphStyle NSRulerMarker NSTextStorage NSSecureTextFieldCell NSButton NSImageView NSBrowserCell NSImageCell NSFont NSFontManager NSImage NSImageRep NSPasteboard NSSpellChecker NSScreen NSPrintInfo NSMutableAttributedString NSTableColumn NSTextContainer NSTextTab NSTextAttachment NSWorkspace OpenStep 4.0Ͱ௥Ճ/มߋ OpenStep draftʹଘࡏ NSWindowサブクラスから
 NSObject下に移動 NSLayoutManager

Slide 43

Slide 43 text

macOS native /45FYU7JFX ͱ͸Կͳͷ͔ © 2019 1024jp 01&/45&1 Ҏલ r /4QSFpY͕෇Ճ r /45FYU7JFXొ৔ r 0CKFDUJWF$ r ΦϒδΣΫτࢦ޲ 新 NeXTSTEP 1.0-3.3 OPENSTEP 4.x macOS 10.0 –

Slide 44

Slide 44 text

macOS native /45FYU7JFX ͱ͸Կͳͷ͔ © 2019 1024jp "QQMJDBUJPO,JU /F9545&1 Cell ActionCell SelectionCell Window Application View ButtonCell TextFieldCell MenuCell Panel Text Box FontPanel Menu PageLayout PrintPanel SavePanel OpenPanel TextField Matrix PopUpList Form FormCell SliderCell Control ScrollView Bitmap Font FontManager Listener Pasteboard PrintInfo Responder Speaker Button Scroller Slider ChoosePrinter Object Cursor OpenStep draftʹ͸ଘࡏ͠ͳ͍ OpenStep draftʹଘࡏ ClipView

Slide 45

Slide 45 text

macOS native /45FYU7JFX ͱ͸Կͳͷ͔ © 2019 1024jp "QQMJDBUJPO,JU /F9545&1 Cell ActionCell SelectionCell Window Application View ButtonCell TextFieldCell MenuCell Panel Text Box FontPanel Menu PageLayout PrintPanel SavePanel OpenPanel TextField Matrix PopUpList Form FormCell SliderCell Control ScrollView Font FontManager Listener Pasteboard PrintInfo Responder Speaker Button Scroller Slider Object NeXTSTEP 2.0–3.3Ͱ௥Ճ NXColorPicker NXColorList NXCursor NXImage NXImageRep NXDataLink NXDataLinkManager NXSelection NXJournaler NXSpellChecker NXSpellServer NXBrowserCell NXBitmapImageRep NXCachedImageRep NXEPSImageRep NXCustomImageRep NXSplitView ClipView NXColorWell NXBrowser NXHelpPanel NXDataLinkPanel NXColorPanel

Slide 46

Slide 46 text

macOS native /45FYU7JFX ͱ͸Կͳͷ͔ © 2019 1024jp 5FYU Ϋϥε -setText:(const char*)string -(BOOL)isEditable -(float)backgroundGray -(id)delegate -replaceSel:(const char*)string
 -setSel:(int)start :(int)end -paste:(id)sender -sizeToFit -scrollSelToVisible -setString:(NSString*)string -(BOOL)isEditable -(NSColor*)backgroundColor -(id)delegate -replaceCharactersInRange:(NSRange)range
 withString:(NSString*)str -setSelectedRange:(NSRange)range -paste:(id)sender -sizeToFit -scrollRangeToVisible:(NSRange)range ref. “Text class” (1989) http://lisp.hopto.org/Documentation/NEXTSTEP-1.0/NeXT/SysRefMan/22_ClassSpecs/AppKit/Text.htmld/ NSText class Text class NeXTSTEP 1.0 – 3.3 OPENSTEP 4.0 – macOS 10.14

Slide 47

Slide 47 text

macOS native /45FYU7JFX ͱ͸Կͳͷ͔ © 2019 1024jp 5FYU Ϋϥε NeXTSTEP 1.0 – 3.3 OPENSTEP 4.0 – macOS 10.14 ref. “Window class” (1989) http://lisp.hopto.org/Documentation/NEXTSTEP-1.0/NeXT/SysRefMan/22_ClassSpecs/AppKit/Window.htmld/ -(Text*)getFieldEditor:(BOOL)create
 for:(id)anObject -(NSText*)fieldEditor:(BOOL)createFlag
 forObject:(id)object -textDidChange:(Text*)textObject -textDidEnd:(Text*)textObject
 endChar:(unsigned short)whyEnd -textDidChange:(NSNotification*)note -textDidEndEditing:(NSNotification*)note a movement character
 (Tab, Shift-Tab, or Return) (userInfo: NSTextMovementUserInfoKey) NSTextDelegate protocol Text delegate NSWindow class Window class

Slide 48

Slide 48 text

macOS native /45FYU7JFX ͱ͸Կͳͷ͔ © 2019 1024jp 01&/45&1 Ҏલ r /4QSFpY͕෇Ճ r /45FYU7JFXొ৔ r 0CKFDUJWF$ r ΦϒδΣΫτࢦ޲ 新 NeXTSTEP 1.0-3.3 OPENSTEP 4.x macOS 10.0 – r 5FYUΫϥε͸طʹଘࡏ r 4DSPMM7JFXʹೖΕͯ5FYUΛར༻͢Δ r ϑΟʔϧυΤσΟλ (NS)Textこそが“Text”のクラス r /9QSFpY͕෇Ճ

Slide 49

Slide 49 text

macOS native /45FYU7JFX ͱ͸Կͳͷ͔ © 2019 1024jp /F95 ͔Β $PDPB ΁ ref. “The OPENSTEP Text System” (1997) http://lisp.hopto.org/Documentation/OPENSTEP/NextDev/ TasksAndConcepts/ProgrammingTopics/TextOverview.htmld/ ref. “Cocoa Text Architecture Guide” (2012) https://developer.apple.com/library/archive/documentation/ TextFonts/Conceptual/CocoaTextArchitecture/ TextSystemArchitecture/ArchitectureOverview.html $PDPB5FYU4ZTUFN 01&/45&15FYU4ZTUFN 現在のTextKitの仕組みはNeXTの時点で完成されていた ͍͍࿩ʂ Ϋ˓ϨΨγʔ
 ͡ΌͶ͔͐ʜ ރΕͯΔ͎ʂ

Slide 50

Slide 50 text

macOS native /45FYU7JFX ͱ͸Կͳͷ͔ © 2019 1024jp 5FYU,JU ͷྺ࢙ iPhone OS iOS 3.2 Mac OS X 10.4 iOS 7 1998 macOS (Mac OS X) 2020 2007 iOS TextKitという名称が
 初めて出てくる Mac OS 8.5 2001 2005 2013 2010 Apple Type Services for Unicode Imaging Mac OS Mac OS X 10.0 NSTextView, etc UITextView TextKit CoreText CoreText ATSUI ࠶ܝ

Slide 51

Slide 51 text

macOS native /45FYU7JFX ͱ͸Կͳͷ͔ © 2019 1024jp 5FYU,JU ͷྺ࢙ iPhone OS iOS 3.2 Mac OS X 10.4 iOS 7 1998 macOS (Mac OS X) 2007 iOS TextKitという名称が
 初めて出てくる Mac OS 8.5 2001 2005 2013 2010 Apple Type Services for Unicode Imaging Mac OS Mac OS X 10.0 NSTextView, etc UITextView TextKit CoreText CoreText ATSUI NeXTSTEP OPENSTEP 4.0 NSTextView, etc 1996 NeXTSTEP 1.0 Text 1989 ׬શ൛ 2020 NSTextの前身 かつfield editorの祖

Slide 52

Slide 52 text

macOS native /45FYU7JFX ͱ͸Կͳͷ͔ © 2019 1024jp 5FYU,JU ·ͱΊ – CocoaͷςΩετγεςϜ͸NeXTSTEP༝དྷͰ͋Γ1989೥·ͰḪΕΔ – TextKit͸Cocoaʹ͓͍ͯςΩετͷϞσϧ͔ΒϏϡʔ·Ͱఏڙ͢Δ ϓϥοτϑΥʔϜϨϕϧͷγεςϜͰ͋Δ – iOS/tvOSͷTextKitͱmacOSͷTextKit͸͍ͩͿҧ͏ – NSTextView͸ओʹҎԼͷ6ͭͷΫϥε͔Β੒Γཱͭɿ NSTextStorage NSLayoutManager NSTextContainer CoreText NSTextView NSTextInputContext NSTypesetter NSGlyphGenerator

Slide 53

Slide 53 text

macOS native /45FYU7JFX ͱ͸Կͳͷ͔ © 2019 1024jp ͓ Θ Γ

Slide 54

Slide 54 text

macOS native /45FYU7JFX ͱ͸Կͳͷ͔ © 2019 1024jp ࢀߟจݙ API Reference – TextKit | Apple Developer Documentation (2019) https://developer.apple.com/documentation/appkit/textkit Documentation – Cocoa Text Architecture Guide (2014) https://developer.apple.com/library/archive/documentation/TextFonts/Conceptual/ CocoaTextArchitecture/ – Text Layout Programming Guilde (2003, 2014) https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/TextLayout/ – Text System User Interface Layer Programming Guide (1997, 2012) https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/TextUILayer/ – Text System Storage Layer Overview (1997, 2012) https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ TextStorageLayer/ Source Code – TextEdit | Apple Developer Documentation (2013) https://developer.apple.com/library/archive/samplecode/TextEdit/ archived archived Apple

Slide 55

Slide 55 text

macOS native /45FYU7JFX ͱ͸Կͳͷ͔ © 2019 1024jp ࢀߟจݙ Video – Session 114: Advanced Cocoa Text Tips and Tricks | WWDC 2010 (2010) https://developer.apple.com/devcenter/download.action?path=/videos/wwdc_2010__hd/ session_114__advanced_cocoa_text_tips_and_tricks.mov – Session 221: TextKit Best Practices | WWDC 2018 (2018) https://developer.apple.com/videos/play/wwdc2018/221/ Apple

Slide 56

Slide 56 text

macOS native /45FYU7JFX ͱ͸Կͳͷ͔ © 2019 1024jp ࢀߟจݙ API Reference – OpenStep Specification (1994) http://www.gnustep.org/resources/OpenStepSpec.pdf.gz – AppKit Class in NeXTSTEP 1.0 (1989) http://lisp.hopto.org/Documentation/NEXTSTEP-1.0/NeXT/SysRefMan/22_ClassSpecs/AppKit/ – AppKit Classes in OPENSTEP (1996) http://lisp.hopto.org/Documentation/OPENSTEP/NextDev/Reference/AppKit/Classes/ Article – The OPENSTEP Text System (1997) http://lisp.hopto.org/Documentation/OPENSTEP/NextDev/TasksAndConcepts/ ProgrammingTopics/TextOverview.htmld/ Book – NeXtstep Programming: Step One: Object-Oriented Applications (1993) by Simson L. Garfinkel, Michael K. Mahoney Article – Porting NEXTSTEP3.2/3.3 Applications to OpenStep on Solaris (1997) http://www.nextcomputers.org/NeXTfiles/Docs/Software/OPENSTEP/802-2115.pdf NeXT SunSoft

Slide 57

Slide 57 text

macOS native /45FYU7JFX ͱ͸Կͳͷ͔ © 2019 1024jp ࢀߟจݙ Source Code – gnustep/libs-gui (2019) https://github.com/gnustep/libs-gui Article – Getting to Know TextKit (2013) https://www.objc.io/issues/5-ios7/getting-to-know-textkit/ Article – NeXTSTEP (2019) https://en.wikipedia.org/wiki/NeXTSTEP GNUstep objc.io wikipedia