From 7e6befc19e9cf3b0e3c28d9f0a5e749f212364b7 Mon Sep 17 00:00:00 2001 From: Charlie Scheer Date: Thu, 19 Dec 2024 13:05:13 -1000 Subject: [PATCH 1/7] Setup using text kit 2 classes with SPTextView --- Simplenote.xcodeproj/project.pbxproj | 4 +++ Simplenote/Classes/SPTextView.m | 9 ++---- Simplenote/SPTextView.swift | 41 ++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 7 deletions(-) create mode 100644 Simplenote/SPTextView.swift diff --git a/Simplenote.xcodeproj/project.pbxproj b/Simplenote.xcodeproj/project.pbxproj index fe39dec84..d74bfac6e 100644 --- a/Simplenote.xcodeproj/project.pbxproj +++ b/Simplenote.xcodeproj/project.pbxproj @@ -540,6 +540,7 @@ BAB6C04526BA4A04007495C4 /* String+Simplenote.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5476BC023D8E5D0000E7723 /* String+Simplenote.swift */; }; BAB6C04726BA4CAF007495C4 /* WidgetController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BAB6C04626BA4CAF007495C4 /* WidgetController.swift */; }; BAB898D32BEC404200E238B8 /* CreateNewNoteIntentHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = BAB898D22BEC404200E238B8 /* CreateNewNoteIntentHandler.swift */; }; + BABB22DF2D14DA6600FCF47D /* SPTextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BABB22DE2D14DA6300FCF47D /* SPTextView.swift */; }; BABFFF2226CF9094003A4C25 /* WidgetDefaults.swift in Sources */ = {isa = PBXBuildFile; fileRef = BABFFF2126CF9094003A4C25 /* WidgetDefaults.swift */; }; BABFFF2326CF9094003A4C25 /* WidgetDefaults.swift in Sources */ = {isa = PBXBuildFile; fileRef = BABFFF2126CF9094003A4C25 /* WidgetDefaults.swift */; }; BABFFF2426CF9094003A4C25 /* WidgetDefaults.swift in Sources */ = {isa = PBXBuildFile; fileRef = BABFFF2126CF9094003A4C25 /* WidgetDefaults.swift */; }; @@ -1242,6 +1243,7 @@ BAB576BD2670512C00B0C56F /* NoteWidget.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NoteWidget.swift; sourceTree = ""; }; BAB6C04626BA4CAF007495C4 /* WidgetController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WidgetController.swift; sourceTree = ""; }; BAB898D22BEC404200E238B8 /* CreateNewNoteIntentHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreateNewNoteIntentHandler.swift; sourceTree = ""; }; + BABB22DE2D14DA6300FCF47D /* SPTextView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SPTextView.swift; sourceTree = ""; }; BABFFF2126CF9094003A4C25 /* WidgetDefaults.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WidgetDefaults.swift; sourceTree = ""; }; BAD0F1EC2BED49C200E73E45 /* FindNoteIntentHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FindNoteIntentHandler.swift; sourceTree = ""; }; BAE08625261282D1009D40CD /* Note+Publish.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Note+Publish.swift"; sourceTree = ""; }; @@ -1872,6 +1874,7 @@ children = ( B5E3F3972539F1E900271AEA /* SPTextView.h */, B5E3F3962539F1E900271AEA /* SPTextView.m */, + BABB22DE2D14DA6300FCF47D /* SPTextView.swift */, E21F57B717C1244E001F02D3 /* SPEditorTextView.h */, E21F57B817C1244E001F02D3 /* SPEditorTextView.m */, A6BBDA45255034E6005C8343 /* SPEditorTextView+Simplenote.swift */, @@ -3562,6 +3565,7 @@ B53C5A5A230330CD00DA2143 /* SPNoteListViewController+Extensions.swift in Sources */, A6C0DFB525C1581D00B9BE39 /* UIScrollView+Simplenote.swift in Sources */, 375D24B621E01131007AB25A /* html_blocks.c in Sources */, + BABB22DF2D14DA6600FCF47D /* SPTextView.swift in Sources */, 46A3C98217DFA81A002865AE /* NSString+Attributed.m in Sources */, 375D24BA21E01131007AB25A /* document.c in Sources */, BA6DA19126DB5F1B000464C8 /* URLComponents.swift in Sources */, diff --git a/Simplenote/Classes/SPTextView.m b/Simplenote/Classes/SPTextView.m index e92c4a28f..f7777054b 100644 --- a/Simplenote/Classes/SPTextView.m +++ b/Simplenote/Classes/SPTextView.m @@ -22,14 +22,9 @@ @implementation SPTextView - (instancetype)init { SPInteractiveTextStorage *textStorage = [[SPInteractiveTextStorage alloc] init]; - NSLayoutManager *layoutManager = [[NSLayoutManager alloc] init]; - - NSTextContainer *container = [[NSTextContainer alloc] initWithSize:CGSizeMake(0, CGFLOAT_MAX)]; - container.widthTracksTextView = YES; - container.heightTracksTextView = YES; - [layoutManager addTextContainer:container]; - [textStorage addLayoutManager:layoutManager]; + NSTextContainer *container = [self setupTextContainerWith:textStorage]; + self = [super initWithFrame:CGRectZero textContainer:container]; if (self) { self.interactiveTextStorage = textStorage; diff --git a/Simplenote/SPTextView.swift b/Simplenote/SPTextView.swift new file mode 100644 index 000000000..86101ee0f --- /dev/null +++ b/Simplenote/SPTextView.swift @@ -0,0 +1,41 @@ +// +// SPTextView.swift +// Simplenote +// +// Created by Charlie Scheer on 12/19/24. +// Copyright © 2024 Automattic. All rights reserved. +// + +extension SPTextView { + /* + SPInteractiveTextStorage *textStorage = [[SPInteractiveTextStorage alloc] init]; + NSLayoutManager *layoutManager = [[NSLayoutManager alloc] init]; + + NSTextContainer *container = [[NSTextContainer alloc] initWithSize:CGSizeMake(0, CGFLOAT_MAX)]; + container.widthTracksTextView = YES; + container.heightTracksTextView = YES; + [layoutManager addTextContainer:container]; + [textStorage addLayoutManager:layoutManager]; + */ + + @objc + func setupTextContainer(with textStorage: SPInteractiveTextStorage) -> NSTextContainer { + let container = NSTextContainer(size: .zero) + container.widthTracksTextView = true + container.heightTracksTextView = true + + + if #available(iOS 16.0, *) { + let textLayoutManager = NSTextLayoutManager() + let contentStorage = NSTextContentStorage() + contentStorage.addTextLayoutManager(textLayoutManager) + textLayoutManager.textContainer = container + + } else { + layoutManager.addTextContainer(container) + textStorage.addLayoutManager(layoutManager) + } + + return container + } +} From 807eed1c8cc069d00217f78fb815351f84ff3839 Mon Sep 17 00:00:00 2001 From: Charlie Scheer Date: Fri, 20 Dec 2024 12:29:13 -1000 Subject: [PATCH 2/7] Format text with TextKit2 content storage methods --- Simplenote/SPTextView.swift | 75 +++++++++++++++++++++++++++++++------ 1 file changed, 64 insertions(+), 11 deletions(-) diff --git a/Simplenote/SPTextView.swift b/Simplenote/SPTextView.swift index 86101ee0f..a34315b24 100644 --- a/Simplenote/SPTextView.swift +++ b/Simplenote/SPTextView.swift @@ -7,17 +7,6 @@ // extension SPTextView { - /* - SPInteractiveTextStorage *textStorage = [[SPInteractiveTextStorage alloc] init]; - NSLayoutManager *layoutManager = [[NSLayoutManager alloc] init]; - - NSTextContainer *container = [[NSTextContainer alloc] initWithSize:CGSizeMake(0, CGFLOAT_MAX)]; - container.widthTracksTextView = YES; - container.heightTracksTextView = YES; - [layoutManager addTextContainer:container]; - [textStorage addLayoutManager:layoutManager]; - */ - @objc func setupTextContainer(with textStorage: SPInteractiveTextStorage) -> NSTextContainer { let container = NSTextContainer(size: .zero) @@ -28,6 +17,7 @@ extension SPTextView { if #available(iOS 16.0, *) { let textLayoutManager = NSTextLayoutManager() let contentStorage = NSTextContentStorage() + contentStorage.delegate = self contentStorage.addTextLayoutManager(textLayoutManager) textLayoutManager.textContainer = container @@ -39,3 +29,66 @@ extension SPTextView { return container } } + +// MARK: NSTextContentStorageDelegate +// +extension SPTextView: NSTextContentStorageDelegate { + public func textContentStorage(_ textContentStorage: NSTextContentStorage, textParagraphWith range: NSRange) -> NSTextParagraph? { + guard let originalText = textContentStorage.textStorage?.attributedSubstring(from: range) as? NSMutableAttributedString else { + return nil + } + + let style = textInRangeIsHeader(range) ? headlineStyle : defaultStyle + originalText.addAttributes(style, range: originalText.fullRange) + + return NSTextParagraph(attributedString: originalText) + } + + func textInRangeIsHeader(_ range: NSRange) -> Bool { + range.location == .zero + } + + // MARK: Styles + // + var headlineFont: UIFont { + UIFont.preferredFont(for: .title1, weight: .bold) + } + + var defaultFont: UIFont { + UIFont.preferredFont(forTextStyle: .body) + } + + var defaultTextColor: UIColor { + UIColor.simplenoteNoteHeadlineColor + } + + var lineSpacing: CGFloat { + defaultFont.lineHeight * Metrics.lineSpacingMultipler + } + + var defaultStyle: [NSAttributedString.Key: Any] { + [ + .font: defaultFont, + .foregroundColor: defaultTextColor, + .paragraphStyle: NSMutableParagraphStyle(lineSpacing: lineSpacing) + ] + } + + var headlineStyle: [NSAttributedString.Key: Any] { + [ + .font: headlineFont, + .foregroundColor: defaultTextColor, + ] + } +} + +// MARK: - Metrics +// +private enum Metrics { + static let lineSpacingMultiplerPad: CGFloat = 0.40 + static let lineSpacingMultiplerPhone: CGFloat = 0.20 + + static var lineSpacingMultipler: CGFloat { + UIDevice.isPad ? lineSpacingMultiplerPad : lineSpacingMultiplerPhone + } +} From 81268e564051a059d9416f3a749c3b1058a78796 Mon Sep 17 00:00:00 2001 From: Charlie Scheer Date: Sat, 21 Dec 2024 12:57:57 -1000 Subject: [PATCH 3/7] Added SPFallbackText Container file --- Simplenote.xcodeproj/project.pbxproj | 4 ++++ Simplenote/SPFallbackTextContainer.swift | 0 2 files changed, 4 insertions(+) create mode 100644 Simplenote/SPFallbackTextContainer.swift diff --git a/Simplenote.xcodeproj/project.pbxproj b/Simplenote.xcodeproj/project.pbxproj index d74bfac6e..4a6fed455 100644 --- a/Simplenote.xcodeproj/project.pbxproj +++ b/Simplenote.xcodeproj/project.pbxproj @@ -541,6 +541,7 @@ BAB6C04726BA4CAF007495C4 /* WidgetController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BAB6C04626BA4CAF007495C4 /* WidgetController.swift */; }; BAB898D32BEC404200E238B8 /* CreateNewNoteIntentHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = BAB898D22BEC404200E238B8 /* CreateNewNoteIntentHandler.swift */; }; BABB22DF2D14DA6600FCF47D /* SPTextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BABB22DE2D14DA6300FCF47D /* SPTextView.swift */; }; + BABB22E52D1779D000FCF47D /* SPFallbackTextContainer.swift in Sources */ = {isa = PBXBuildFile; fileRef = BABB22E42D1779C700FCF47D /* SPFallbackTextContainer.swift */; }; BABFFF2226CF9094003A4C25 /* WidgetDefaults.swift in Sources */ = {isa = PBXBuildFile; fileRef = BABFFF2126CF9094003A4C25 /* WidgetDefaults.swift */; }; BABFFF2326CF9094003A4C25 /* WidgetDefaults.swift in Sources */ = {isa = PBXBuildFile; fileRef = BABFFF2126CF9094003A4C25 /* WidgetDefaults.swift */; }; BABFFF2426CF9094003A4C25 /* WidgetDefaults.swift in Sources */ = {isa = PBXBuildFile; fileRef = BABFFF2126CF9094003A4C25 /* WidgetDefaults.swift */; }; @@ -1244,6 +1245,7 @@ BAB6C04626BA4CAF007495C4 /* WidgetController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WidgetController.swift; sourceTree = ""; }; BAB898D22BEC404200E238B8 /* CreateNewNoteIntentHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreateNewNoteIntentHandler.swift; sourceTree = ""; }; BABB22DE2D14DA6300FCF47D /* SPTextView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SPTextView.swift; sourceTree = ""; }; + BABB22E42D1779C700FCF47D /* SPFallbackTextContainer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SPFallbackTextContainer.swift; sourceTree = ""; }; BABFFF2126CF9094003A4C25 /* WidgetDefaults.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WidgetDefaults.swift; sourceTree = ""; }; BAD0F1EC2BED49C200E73E45 /* FindNoteIntentHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FindNoteIntentHandler.swift; sourceTree = ""; }; BAE08625261282D1009D40CD /* Note+Publish.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Note+Publish.swift"; sourceTree = ""; }; @@ -1879,6 +1881,7 @@ E21F57B817C1244E001F02D3 /* SPEditorTextView.m */, A6BBDA45255034E6005C8343 /* SPEditorTextView+Simplenote.swift */, B52E2B142537480A0074509A /* SPEditorTapRecognizerDelegate.swift */, + BABB22E42D1779C700FCF47D /* SPFallbackTextContainer.swift */, ); name = Editor; sourceTree = ""; @@ -3448,6 +3451,7 @@ 46A3C96317DFA81A002865AE /* NSString+Metadata.m in Sources */, B5E4082B235DDFC800D4E1DF /* ColorStudio.swift in Sources */, B552AB8724B8E75E00E5E115 /* SPNoteEditorViewController+Extensions.swift in Sources */, + BABB22E52D1779D000FCF47D /* SPFallbackTextContainer.swift in Sources */, A69F851D253EC877005140F2 /* UISlider+Simplenote.swift in Sources */, 46A3C96617DFA81A002865AE /* SPAcitivitySafari.m in Sources */, B5E951E424FEE26E004B10B8 /* NSURL+Links.swift in Sources */, diff --git a/Simplenote/SPFallbackTextContainer.swift b/Simplenote/SPFallbackTextContainer.swift new file mode 100644 index 000000000..e69de29bb From 1332a1080c5b225761981a4ed026bc7f0a9008ec Mon Sep 17 00:00:00 2001 From: Charlie Scheer Date: Sat, 21 Dec 2024 12:58:47 -1000 Subject: [PATCH 4/7] Fixed issue where falling back to text kit 1 lost formatting --- Simplenote/SPFallbackTextContainer.swift | 19 +++++++++++++++++++ Simplenote/SPTextView.swift | 9 +++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/Simplenote/SPFallbackTextContainer.swift b/Simplenote/SPFallbackTextContainer.swift index e69de29bb..693a8c182 100644 --- a/Simplenote/SPFallbackTextContainer.swift +++ b/Simplenote/SPFallbackTextContainer.swift @@ -0,0 +1,19 @@ +class SPFallbackTextContainer: NSTextContainer { + weak var textView: SPTextView? + + override var layoutManager: NSLayoutManager? { + didSet { + // This gets called when falling back to TextKit 1 + guard let layoutManager, + let newManagerStorage = layoutManager.textStorage, + let textView, + textView.interactiveTextStorage.layoutManagers.isEmpty else { + return + } + + textView.interactiveTextStorage.addLayoutManager(layoutManager) + textView.interactiveTextStorage.setAttributedString(newManagerStorage) + textView.text = newManagerStorage.string + } + } +} diff --git a/Simplenote/SPTextView.swift b/Simplenote/SPTextView.swift index a34315b24..6e68361c0 100644 --- a/Simplenote/SPTextView.swift +++ b/Simplenote/SPTextView.swift @@ -9,12 +9,17 @@ extension SPTextView { @objc func setupTextContainer(with textStorage: SPInteractiveTextStorage) -> NSTextContainer { - let container = NSTextContainer(size: .zero) + let container = SPFallbackTextContainer(size: .zero) container.widthTracksTextView = true container.heightTracksTextView = true + // This value is set incase we need to fall back to text kit 1 + // + container.textView = self - if #available(iOS 16.0, *) { + // TextKit 2 + // + if #available(iOS 17.0, *) { let textLayoutManager = NSTextLayoutManager() let contentStorage = NSTextContentStorage() contentStorage.delegate = self From 18ae0c200355f3de013379be5f949b221fa64c69 Mon Sep 17 00:00:00 2001 From: Charlie Scheer Date: Thu, 26 Dec 2024 10:46:54 -1000 Subject: [PATCH 5/7] Revert "Fixed issue where falling back to text kit 1 lost formatting" This reverts commit 1332a1080c5b225761981a4ed026bc7f0a9008ec. --- Simplenote/SPFallbackTextContainer.swift | 19 ------------------- Simplenote/SPTextView.swift | 9 ++------- 2 files changed, 2 insertions(+), 26 deletions(-) diff --git a/Simplenote/SPFallbackTextContainer.swift b/Simplenote/SPFallbackTextContainer.swift index 693a8c182..e69de29bb 100644 --- a/Simplenote/SPFallbackTextContainer.swift +++ b/Simplenote/SPFallbackTextContainer.swift @@ -1,19 +0,0 @@ -class SPFallbackTextContainer: NSTextContainer { - weak var textView: SPTextView? - - override var layoutManager: NSLayoutManager? { - didSet { - // This gets called when falling back to TextKit 1 - guard let layoutManager, - let newManagerStorage = layoutManager.textStorage, - let textView, - textView.interactiveTextStorage.layoutManagers.isEmpty else { - return - } - - textView.interactiveTextStorage.addLayoutManager(layoutManager) - textView.interactiveTextStorage.setAttributedString(newManagerStorage) - textView.text = newManagerStorage.string - } - } -} diff --git a/Simplenote/SPTextView.swift b/Simplenote/SPTextView.swift index 6e68361c0..a34315b24 100644 --- a/Simplenote/SPTextView.swift +++ b/Simplenote/SPTextView.swift @@ -9,17 +9,12 @@ extension SPTextView { @objc func setupTextContainer(with textStorage: SPInteractiveTextStorage) -> NSTextContainer { - let container = SPFallbackTextContainer(size: .zero) + let container = NSTextContainer(size: .zero) container.widthTracksTextView = true container.heightTracksTextView = true - // This value is set incase we need to fall back to text kit 1 - // - container.textView = self - // TextKit 2 - // - if #available(iOS 17.0, *) { + if #available(iOS 16.0, *) { let textLayoutManager = NSTextLayoutManager() let contentStorage = NSTextContentStorage() contentStorage.delegate = self From 4aecd53ce90fcbe2273666c789f58aa612e83b33 Mon Sep 17 00:00:00 2001 From: Charlie Scheer Date: Thu, 26 Dec 2024 10:47:01 -1000 Subject: [PATCH 6/7] Revert "Added SPFallbackText Container file" This reverts commit 81268e564051a059d9416f3a749c3b1058a78796. --- Simplenote.xcodeproj/project.pbxproj | 4 ---- Simplenote/SPFallbackTextContainer.swift | 0 2 files changed, 4 deletions(-) delete mode 100644 Simplenote/SPFallbackTextContainer.swift diff --git a/Simplenote.xcodeproj/project.pbxproj b/Simplenote.xcodeproj/project.pbxproj index 4a6fed455..d74bfac6e 100644 --- a/Simplenote.xcodeproj/project.pbxproj +++ b/Simplenote.xcodeproj/project.pbxproj @@ -541,7 +541,6 @@ BAB6C04726BA4CAF007495C4 /* WidgetController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BAB6C04626BA4CAF007495C4 /* WidgetController.swift */; }; BAB898D32BEC404200E238B8 /* CreateNewNoteIntentHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = BAB898D22BEC404200E238B8 /* CreateNewNoteIntentHandler.swift */; }; BABB22DF2D14DA6600FCF47D /* SPTextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BABB22DE2D14DA6300FCF47D /* SPTextView.swift */; }; - BABB22E52D1779D000FCF47D /* SPFallbackTextContainer.swift in Sources */ = {isa = PBXBuildFile; fileRef = BABB22E42D1779C700FCF47D /* SPFallbackTextContainer.swift */; }; BABFFF2226CF9094003A4C25 /* WidgetDefaults.swift in Sources */ = {isa = PBXBuildFile; fileRef = BABFFF2126CF9094003A4C25 /* WidgetDefaults.swift */; }; BABFFF2326CF9094003A4C25 /* WidgetDefaults.swift in Sources */ = {isa = PBXBuildFile; fileRef = BABFFF2126CF9094003A4C25 /* WidgetDefaults.swift */; }; BABFFF2426CF9094003A4C25 /* WidgetDefaults.swift in Sources */ = {isa = PBXBuildFile; fileRef = BABFFF2126CF9094003A4C25 /* WidgetDefaults.swift */; }; @@ -1245,7 +1244,6 @@ BAB6C04626BA4CAF007495C4 /* WidgetController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WidgetController.swift; sourceTree = ""; }; BAB898D22BEC404200E238B8 /* CreateNewNoteIntentHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreateNewNoteIntentHandler.swift; sourceTree = ""; }; BABB22DE2D14DA6300FCF47D /* SPTextView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SPTextView.swift; sourceTree = ""; }; - BABB22E42D1779C700FCF47D /* SPFallbackTextContainer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SPFallbackTextContainer.swift; sourceTree = ""; }; BABFFF2126CF9094003A4C25 /* WidgetDefaults.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WidgetDefaults.swift; sourceTree = ""; }; BAD0F1EC2BED49C200E73E45 /* FindNoteIntentHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FindNoteIntentHandler.swift; sourceTree = ""; }; BAE08625261282D1009D40CD /* Note+Publish.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Note+Publish.swift"; sourceTree = ""; }; @@ -1881,7 +1879,6 @@ E21F57B817C1244E001F02D3 /* SPEditorTextView.m */, A6BBDA45255034E6005C8343 /* SPEditorTextView+Simplenote.swift */, B52E2B142537480A0074509A /* SPEditorTapRecognizerDelegate.swift */, - BABB22E42D1779C700FCF47D /* SPFallbackTextContainer.swift */, ); name = Editor; sourceTree = ""; @@ -3451,7 +3448,6 @@ 46A3C96317DFA81A002865AE /* NSString+Metadata.m in Sources */, B5E4082B235DDFC800D4E1DF /* ColorStudio.swift in Sources */, B552AB8724B8E75E00E5E115 /* SPNoteEditorViewController+Extensions.swift in Sources */, - BABB22E52D1779D000FCF47D /* SPFallbackTextContainer.swift in Sources */, A69F851D253EC877005140F2 /* UISlider+Simplenote.swift in Sources */, 46A3C96617DFA81A002865AE /* SPAcitivitySafari.m in Sources */, B5E951E424FEE26E004B10B8 /* NSURL+Links.swift in Sources */, diff --git a/Simplenote/SPFallbackTextContainer.swift b/Simplenote/SPFallbackTextContainer.swift deleted file mode 100644 index e69de29bb..000000000 From 0a48d6320a59997ddacfdb82c01514968bc2a792 Mon Sep 17 00:00:00 2001 From: Charlie Scheer Date: Thu, 26 Dec 2024 11:58:14 -1000 Subject: [PATCH 7/7] Setup layoutmanager explicitly when setting up sptextview --- Simplenote/SPTextView.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Simplenote/SPTextView.swift b/Simplenote/SPTextView.swift index a34315b24..047cd8429 100644 --- a/Simplenote/SPTextView.swift +++ b/Simplenote/SPTextView.swift @@ -22,6 +22,7 @@ extension SPTextView { textLayoutManager.textContainer = container } else { + let layoutManager = NSLayoutManager() layoutManager.addTextContainer(container) textStorage.addLayoutManager(layoutManager) }