From ceec51f03477c52be5d604a4a69d85d63e799096 Mon Sep 17 00:00:00 2001 From: Kyle Date: Fri, 7 Jun 2024 14:01:29 +0800 Subject: [PATCH 1/2] Add SwiftPM support --- .gitignore | 4 ++++ Package.swift | 15 +++++++++++++++ YYText/include/NSAttributedString+YYText.h | 1 + YYText/include/NSParagraphStyle+YYText.h | 1 + YYText/include/UIPasteboard+YYText.h | 1 + YYText/include/UIView+YYText.h | 1 + YYText/include/YYLabel.h | 1 + YYText/include/YYText.h | 1 + YYText/include/YYTextArchiver.h | 1 + YYText/include/YYTextAsyncLayer.h | 1 + YYText/include/YYTextAttribute.h | 1 + YYText/include/YYTextContainerView.h | 1 + YYText/include/YYTextDebugOption.h | 1 + YYText/include/YYTextEffectWindow.h | 1 + YYText/include/YYTextInput.h | 1 + YYText/include/YYTextKeyboardManager.h | 1 + YYText/include/YYTextLayout.h | 1 + YYText/include/YYTextLine.h | 1 + YYText/include/YYTextMagnifier.h | 1 + YYText/include/YYTextParser.h | 1 + YYText/include/YYTextRubyAnnotation.h | 1 + YYText/include/YYTextRunDelegate.h | 1 + YYText/include/YYTextSelectionView.h | 1 + YYText/include/YYTextTransaction.h | 1 + YYText/include/YYTextUtilities.h | 1 + YYText/include/YYTextView.h | 1 + YYText/include/YYTextWeakProxy.h | 1 + 27 files changed, 44 insertions(+) create mode 100644 Package.swift create mode 120000 YYText/include/NSAttributedString+YYText.h create mode 120000 YYText/include/NSParagraphStyle+YYText.h create mode 120000 YYText/include/UIPasteboard+YYText.h create mode 120000 YYText/include/UIView+YYText.h create mode 120000 YYText/include/YYLabel.h create mode 120000 YYText/include/YYText.h create mode 120000 YYText/include/YYTextArchiver.h create mode 120000 YYText/include/YYTextAsyncLayer.h create mode 120000 YYText/include/YYTextAttribute.h create mode 120000 YYText/include/YYTextContainerView.h create mode 120000 YYText/include/YYTextDebugOption.h create mode 120000 YYText/include/YYTextEffectWindow.h create mode 120000 YYText/include/YYTextInput.h create mode 120000 YYText/include/YYTextKeyboardManager.h create mode 120000 YYText/include/YYTextLayout.h create mode 120000 YYText/include/YYTextLine.h create mode 120000 YYText/include/YYTextMagnifier.h create mode 120000 YYText/include/YYTextParser.h create mode 120000 YYText/include/YYTextRubyAnnotation.h create mode 120000 YYText/include/YYTextRunDelegate.h create mode 120000 YYText/include/YYTextSelectionView.h create mode 120000 YYText/include/YYTextTransaction.h create mode 120000 YYText/include/YYTextUtilities.h create mode 120000 YYText/include/YYTextView.h create mode 120000 YYText/include/YYTextWeakProxy.h diff --git a/.gitignore b/.gitignore index 01875062..664235da 100644 --- a/.gitignore +++ b/.gitignore @@ -65,3 +65,7 @@ fastlane/test_output # https://github.com/johnno1962/injectionforxcode iOSInjectionProject/ + +# SwiftPM +.swiftpm +.vscode diff --git a/Package.swift b/Package.swift new file mode 100644 index 00000000..b101daa8 --- /dev/null +++ b/Package.swift @@ -0,0 +1,15 @@ +// swift-tools-version:5.9 +import PackageDescription + +let package = Package( + name: "YYText", + products: [ + .library(name: "YYText", targets: ["YYText"]), + ], + targets: [ + .target( + name: "YYText", + path: "YYText" + ), + ] +) diff --git a/YYText/include/NSAttributedString+YYText.h b/YYText/include/NSAttributedString+YYText.h new file mode 120000 index 00000000..4417cdad --- /dev/null +++ b/YYText/include/NSAttributedString+YYText.h @@ -0,0 +1 @@ +../Utility/NSAttributedString+YYText.h \ No newline at end of file diff --git a/YYText/include/NSParagraphStyle+YYText.h b/YYText/include/NSParagraphStyle+YYText.h new file mode 120000 index 00000000..c229d8a7 --- /dev/null +++ b/YYText/include/NSParagraphStyle+YYText.h @@ -0,0 +1 @@ +../Utility/NSParagraphStyle+YYText.h \ No newline at end of file diff --git a/YYText/include/UIPasteboard+YYText.h b/YYText/include/UIPasteboard+YYText.h new file mode 120000 index 00000000..ec2b6e98 --- /dev/null +++ b/YYText/include/UIPasteboard+YYText.h @@ -0,0 +1 @@ +../Utility/UIPasteboard+YYText.h \ No newline at end of file diff --git a/YYText/include/UIView+YYText.h b/YYText/include/UIView+YYText.h new file mode 120000 index 00000000..5f6d1ad4 --- /dev/null +++ b/YYText/include/UIView+YYText.h @@ -0,0 +1 @@ +../Utility/UIView+YYText.h \ No newline at end of file diff --git a/YYText/include/YYLabel.h b/YYText/include/YYLabel.h new file mode 120000 index 00000000..bb4768a8 --- /dev/null +++ b/YYText/include/YYLabel.h @@ -0,0 +1 @@ +../YYLabel.h \ No newline at end of file diff --git a/YYText/include/YYText.h b/YYText/include/YYText.h new file mode 120000 index 00000000..cfeb78ef --- /dev/null +++ b/YYText/include/YYText.h @@ -0,0 +1 @@ +../YYText.h \ No newline at end of file diff --git a/YYText/include/YYTextArchiver.h b/YYText/include/YYTextArchiver.h new file mode 120000 index 00000000..0d397774 --- /dev/null +++ b/YYText/include/YYTextArchiver.h @@ -0,0 +1 @@ +../String/YYTextArchiver.h \ No newline at end of file diff --git a/YYText/include/YYTextAsyncLayer.h b/YYText/include/YYTextAsyncLayer.h new file mode 120000 index 00000000..9dc79857 --- /dev/null +++ b/YYText/include/YYTextAsyncLayer.h @@ -0,0 +1 @@ +../Utility/YYTextAsyncLayer.h \ No newline at end of file diff --git a/YYText/include/YYTextAttribute.h b/YYText/include/YYTextAttribute.h new file mode 120000 index 00000000..4b4e97cb --- /dev/null +++ b/YYText/include/YYTextAttribute.h @@ -0,0 +1 @@ +../String/YYTextAttribute.h \ No newline at end of file diff --git a/YYText/include/YYTextContainerView.h b/YYText/include/YYTextContainerView.h new file mode 120000 index 00000000..840cb7bf --- /dev/null +++ b/YYText/include/YYTextContainerView.h @@ -0,0 +1 @@ +../Component/YYTextContainerView.h \ No newline at end of file diff --git a/YYText/include/YYTextDebugOption.h b/YYText/include/YYTextDebugOption.h new file mode 120000 index 00000000..750eecba --- /dev/null +++ b/YYText/include/YYTextDebugOption.h @@ -0,0 +1 @@ +../Component/YYTextDebugOption.h \ No newline at end of file diff --git a/YYText/include/YYTextEffectWindow.h b/YYText/include/YYTextEffectWindow.h new file mode 120000 index 00000000..a0d7920d --- /dev/null +++ b/YYText/include/YYTextEffectWindow.h @@ -0,0 +1 @@ +../Component/YYTextEffectWindow.h \ No newline at end of file diff --git a/YYText/include/YYTextInput.h b/YYText/include/YYTextInput.h new file mode 120000 index 00000000..96eefe77 --- /dev/null +++ b/YYText/include/YYTextInput.h @@ -0,0 +1 @@ +../Component/YYTextInput.h \ No newline at end of file diff --git a/YYText/include/YYTextKeyboardManager.h b/YYText/include/YYTextKeyboardManager.h new file mode 120000 index 00000000..13978dfc --- /dev/null +++ b/YYText/include/YYTextKeyboardManager.h @@ -0,0 +1 @@ +../Component/YYTextKeyboardManager.h \ No newline at end of file diff --git a/YYText/include/YYTextLayout.h b/YYText/include/YYTextLayout.h new file mode 120000 index 00000000..c182aff2 --- /dev/null +++ b/YYText/include/YYTextLayout.h @@ -0,0 +1 @@ +../Component/YYTextLayout.h \ No newline at end of file diff --git a/YYText/include/YYTextLine.h b/YYText/include/YYTextLine.h new file mode 120000 index 00000000..85c68a88 --- /dev/null +++ b/YYText/include/YYTextLine.h @@ -0,0 +1 @@ +../Component/YYTextLine.h \ No newline at end of file diff --git a/YYText/include/YYTextMagnifier.h b/YYText/include/YYTextMagnifier.h new file mode 120000 index 00000000..c1665c48 --- /dev/null +++ b/YYText/include/YYTextMagnifier.h @@ -0,0 +1 @@ +../Component/YYTextMagnifier.h \ No newline at end of file diff --git a/YYText/include/YYTextParser.h b/YYText/include/YYTextParser.h new file mode 120000 index 00000000..f97762c7 --- /dev/null +++ b/YYText/include/YYTextParser.h @@ -0,0 +1 @@ +../String/YYTextParser.h \ No newline at end of file diff --git a/YYText/include/YYTextRubyAnnotation.h b/YYText/include/YYTextRubyAnnotation.h new file mode 120000 index 00000000..fc6d278e --- /dev/null +++ b/YYText/include/YYTextRubyAnnotation.h @@ -0,0 +1 @@ +../String/YYTextRubyAnnotation.h \ No newline at end of file diff --git a/YYText/include/YYTextRunDelegate.h b/YYText/include/YYTextRunDelegate.h new file mode 120000 index 00000000..b1452d8e --- /dev/null +++ b/YYText/include/YYTextRunDelegate.h @@ -0,0 +1 @@ +../String/YYTextRunDelegate.h \ No newline at end of file diff --git a/YYText/include/YYTextSelectionView.h b/YYText/include/YYTextSelectionView.h new file mode 120000 index 00000000..f734549b --- /dev/null +++ b/YYText/include/YYTextSelectionView.h @@ -0,0 +1 @@ +../Component/YYTextSelectionView.h \ No newline at end of file diff --git a/YYText/include/YYTextTransaction.h b/YYText/include/YYTextTransaction.h new file mode 120000 index 00000000..b31dfa28 --- /dev/null +++ b/YYText/include/YYTextTransaction.h @@ -0,0 +1 @@ +../Utility/YYTextTransaction.h \ No newline at end of file diff --git a/YYText/include/YYTextUtilities.h b/YYText/include/YYTextUtilities.h new file mode 120000 index 00000000..4871e250 --- /dev/null +++ b/YYText/include/YYTextUtilities.h @@ -0,0 +1 @@ +../Utility/YYTextUtilities.h \ No newline at end of file diff --git a/YYText/include/YYTextView.h b/YYText/include/YYTextView.h new file mode 120000 index 00000000..45c695a7 --- /dev/null +++ b/YYText/include/YYTextView.h @@ -0,0 +1 @@ +../YYTextView.h \ No newline at end of file diff --git a/YYText/include/YYTextWeakProxy.h b/YYText/include/YYTextWeakProxy.h new file mode 120000 index 00000000..2f1ba045 --- /dev/null +++ b/YYText/include/YYTextWeakProxy.h @@ -0,0 +1 @@ +../Utility/YYTextWeakProxy.h \ No newline at end of file From 9ed6ea67fc8f5ff78164177a756e5602dd248297 Mon Sep 17 00:00:00 2001 From: Kyle Date: Tue, 25 Jun 2024 15:32:56 +0800 Subject: [PATCH 2/2] Fix layoutWithContainers bug --- YYText/Component/YYTextLayout.m | 1 + 1 file changed, 1 insertion(+) diff --git a/YYText/Component/YYTextLayout.m b/YYText/Component/YYTextLayout.m index 708ba1dd..30612a0c 100644 --- a/YYText/Component/YYTextLayout.m +++ b/YYText/Component/YYTextLayout.m @@ -902,6 +902,7 @@ + (NSArray *)layoutWithContainers:(NSArray *)containers text:(NSAttributedString YYTextContainer *container = containers[i]; YYTextLayout *layout = [self layoutWithContainer:container text:text range:range]; if (!layout) return nil; + [layouts addObject:layout]; NSInteger length = (NSInteger)range.length - (NSInteger)layout.visibleRange.length; if (length <= 0) { range.length = 0;