Skip to content

Commit

Permalink
Move initialization of spTextView text storage out of setupTextContainer
Browse files Browse the repository at this point in the history
  • Loading branch information
charliescheer committed Dec 28, 2024
1 parent fa0f31b commit 2fde51e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
5 changes: 3 additions & 2 deletions Simplenote/Classes/SPTextView.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@
@implementation SPTextView

- (instancetype)init {
NSTextContainer *container = [self setupTextContainer];
SPInteractiveTextStorage *textStorage = [[SPInteractiveTextStorage alloc] init];
NSTextContainer *container = [self setupTextContainerWith:textStorage];

self = [super initWithFrame:CGRectZero textContainer:container];
if (self) {

self.interactiveTextStorage = textStorage;
/*
Issue #188:
===========
Expand Down
5 changes: 1 addition & 4 deletions Simplenote/SPTextView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,11 @@

extension SPTextView {
@objc
func setupTextContainer() -> NSTextContainer {
func setupTextContainer(with textStorage: SPInteractiveTextStorage) -> NSTextContainer {
let container = NSTextContainer(size: .zero)
container.widthTracksTextView = true
container.heightTracksTextView = true

let textStorage = SPInteractiveTextStorage()
interactiveTextStorage = textStorage

if #available(iOS 16.0, *) {
let textLayoutManager = NSTextLayoutManager()
let contentStorage = NSTextContentStorage()
Expand Down

0 comments on commit 2fde51e

Please sign in to comment.