Skip to content

Commit d5b7a58

Browse files
committed
修改类名AttributedString为ASAttributedString, 解决与Xcode13中Foundation.AttributedString类名冲突问题.
1 parent a23728c commit d5b7a58

33 files changed

Lines changed: 362 additions & 317 deletions

AttributedString.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Pod::Spec.new do |s|
22

33
s.name = "AttributedString"
4-
s.version = "1.6.9"
4+
s.version = "2.0.0"
55
s.summary = "基于Swift字符串插值快速构建你想要的富文本, 支持点击按住等事件获取, 支持多种类型过滤"
66

77
s.homepage = "https://github.com/lixiang1994/AttributedString"

AttributedString.xcodeproj/project.pbxproj

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,7 @@
838838
"@executable_path/Frameworks",
839839
"@loader_path/Frameworks",
840840
);
841-
MARKETING_VERSION = 1.6.8;
841+
MARKETING_VERSION = 2.0.0;
842842
PRODUCT_BUNDLE_IDENTIFIER = com.attributedstring.watchos;
843843
PRODUCT_NAME = AttributedString;
844844
SDKROOT = watchos;
@@ -866,7 +866,7 @@
866866
"@executable_path/Frameworks",
867867
"@loader_path/Frameworks",
868868
);
869-
MARKETING_VERSION = 1.6.8;
869+
MARKETING_VERSION = 2.0.0;
870870
PRODUCT_BUNDLE_IDENTIFIER = com.attributedstring.watchos;
871871
PRODUCT_NAME = AttributedString;
872872
SDKROOT = watchos;
@@ -893,7 +893,7 @@
893893
"@executable_path/Frameworks",
894894
"@loader_path/Frameworks",
895895
);
896-
MARKETING_VERSION = 1.6.8;
896+
MARKETING_VERSION = 2.0.0;
897897
PRODUCT_BUNDLE_IDENTIFIER = com.attributedstring.tvos;
898898
PRODUCT_NAME = AttributedString;
899899
SDKROOT = appletvos;
@@ -920,7 +920,7 @@
920920
"@executable_path/Frameworks",
921921
"@loader_path/Frameworks",
922922
);
923-
MARKETING_VERSION = 1.6.8;
923+
MARKETING_VERSION = 2.0.0;
924924
PRODUCT_BUNDLE_IDENTIFIER = com.attributedstring.tvos;
925925
PRODUCT_NAME = AttributedString;
926926
SDKROOT = appletvos;
@@ -996,7 +996,7 @@
996996
"@loader_path/Frameworks",
997997
);
998998
MACOSX_DEPLOYMENT_TARGET = 10.13;
999-
MARKETING_VERSION = 1.6.8;
999+
MARKETING_VERSION = 2.0.0;
10001000
PRODUCT_BUNDLE_IDENTIFIER = com.lee.attributedstring.macos;
10011001
PRODUCT_NAME = AttributedString;
10021002
SDKROOT = macosx;
@@ -1023,7 +1023,7 @@
10231023
"@loader_path/Frameworks",
10241024
);
10251025
MACOSX_DEPLOYMENT_TARGET = 10.13;
1026-
MARKETING_VERSION = 1.6.8;
1026+
MARKETING_VERSION = 2.0.0;
10271027
PRODUCT_BUNDLE_IDENTIFIER = com.lee.attributedstring.macos;
10281028
PRODUCT_NAME = AttributedString;
10291029
SDKROOT = macosx;
@@ -1170,7 +1170,7 @@
11701170
"@executable_path/Frameworks",
11711171
"@loader_path/Frameworks",
11721172
);
1173-
MARKETING_VERSION = 1.6.8;
1173+
MARKETING_VERSION = 2.0.0;
11741174
PRODUCT_BUNDLE_IDENTIFIER = com.lee.attributedstring.ios;
11751175
PRODUCT_NAME = AttributedString;
11761176
SKIP_INSTALL = YES;
@@ -1199,7 +1199,7 @@
11991199
"@executable_path/Frameworks",
12001200
"@loader_path/Frameworks",
12011201
);
1202-
MARKETING_VERSION = 1.6.8;
1202+
MARKETING_VERSION = 2.0.0;
12031203
PRODUCT_BUNDLE_IDENTIFIER = com.lee.attributedstring.ios;
12041204
PRODUCT_NAME = AttributedString;
12051205
SKIP_INSTALL = YES;

Demo-Mac/Demo-Mac/AllViewController.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ extension AllViewController {
5454

5555
struct Item {
5656
let title: (String, String)
57-
let content: AttributedString
57+
let content: ASAttributedString
5858
let code: String
5959
}
6060

@@ -899,7 +899,7 @@ extension AllViewController {
899899
tableView.selectRowIndexes(.init(integer: 0), byExtendingSelection: true)
900900
}
901901

902-
func clicked(_ result: AttributedString.Action.Result) {
902+
func clicked(_ result: ASAttributedString.Action.Result) {
903903
switch result.content {
904904
case .string(let value):
905905
print("点击了文本: \n\(value) \nrange: \(result.range)")
@@ -909,7 +909,7 @@ extension AllViewController {
909909
}
910910
}
911911

912-
func pressed(_ result: AttributedString.Action.Result) {
912+
func pressed(_ result: ASAttributedString.Action.Result) {
913913
switch result.content {
914914
case .string(let value):
915915
print("按住了文本: \n\(value) \nrange: \(result.range)")

Demo-Mac/Demo-Mac/ViewController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class ViewController: NSViewController {
4747
/// , .paragraph(.alignment(.center)))
4848
/// """
4949

50-
let array: [AttributedString] = [
50+
let array: [ASAttributedString] = [
5151
.init(
5252
"""
5353
\(.image(#imageLiteral(resourceName: "swift-icon"), .custom(size: .init(width: 64, height: 64))))
@@ -129,7 +129,7 @@ class ViewController: NSViewController {
129129
"""
130130
]
131131

132-
let string = array.reduce(into: AttributedString(stringLiteral: "")) {
132+
let string = array.reduce(into: ASAttributedString(stringLiteral: "")) {
133133
$0 += $1 + "\n"
134134
}
135135
label.attributed.string = string

Demo-TV/Demo-TV/AllDetailViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class AllDetailViewController: UIViewController {
2424

2525
func set(item: Item) {
2626
list = [
27-
AttributedString(item.content, .font(.systemFont(ofSize: 38))).value,
27+
ASAttributedString(item.content, .font(.systemFont(ofSize: 38))).value,
2828
.init(string: item.code)
2929
]
3030

Demo-TV/Demo-TV/AllTableViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ extension AllTableViewController {
5757

5858
struct Item {
5959
let title: (String, String)
60-
let content: AttributedString
60+
let content: ASAttributedString
6161
let code: String
6262
}
6363

Demo-TV/Demo-TV/ViewController.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class ViewController: UIViewController {
4949
/// """
5050

5151

52-
let array: [AttributedString] = [
52+
let array: [ASAttributedString] = [
5353
.init(
5454
"""
5555
\(.image(#imageLiteral(resourceName: "swift-icon"), .custom(size: .init(width: 64, height: 64))))
@@ -183,10 +183,10 @@ extension ViewController: UITableViewDataSource {
183183
extension ViewController {
184184

185185
struct Model {
186-
let content: AttributedString
186+
let content: ASAttributedString
187187
let height: CGFloat
188188

189-
init(_ content: AttributedString) {
189+
init(_ content: ASAttributedString) {
190190
self.content = content
191191
self.height = content.value.boundingRect(
192192
with: .init(

Demo-Watch/Demo-Watch WatchKit Extension/InterfaceController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class InterfaceController: WKInterfaceController {
1616
override func awake(withContext context: Any?) {
1717
super.awake(withContext: context)
1818

19-
let array: [AttributedString] = [
19+
let array: [ASAttributedString] = [
2020
.init(
2121
"""
2222
\("Swift", .font(.systemFont(ofSize: 48, weight: .semibold)))
@@ -96,7 +96,7 @@ class InterfaceController: WKInterfaceController {
9696
"""
9797
]
9898

99-
let string = array.reduce(into: AttributedString(stringLiteral: "")) {
99+
let string = array.reduce(into: ASAttributedString(stringLiteral: "")) {
100100
$0 += $1 + "\n"
101101
}
102102

Demo-Watch/Demo-Watch.xcodeproj/project.pbxproj

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
9B267B6324405CFD002F571E /* InterfaceController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B267B6224405CFD002F571E /* InterfaceController.swift */; };
1515
9B267B6524405CFD002F571E /* ExtensionDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B267B6424405CFD002F571E /* ExtensionDelegate.swift */; };
1616
9B267B6724405CFD002F571E /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9B267B6624405CFD002F571E /* Assets.xcassets */; };
17+
9B2E319D26A0312000BA33A8 /* AttributedString.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9B2E319C26A0312000BA33A8 /* AttributedString.framework */; };
18+
9B2E319E26A0312000BA33A8 /* AttributedString.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9B2E319C26A0312000BA33A8 /* AttributedString.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
1719
/* End PBXBuildFile section */
1820

1921
/* Begin PBXContainerItemProxy section */
@@ -56,6 +58,17 @@
5658
name = "Embed Watch Content";
5759
runOnlyForDeploymentPostprocessing = 0;
5860
};
61+
9B2E319F26A0312000BA33A8 /* Embed Frameworks */ = {
62+
isa = PBXCopyFilesBuildPhase;
63+
buildActionMask = 2147483647;
64+
dstPath = "";
65+
dstSubfolderSpec = 10;
66+
files = (
67+
9B2E319E26A0312000BA33A8 /* AttributedString.framework in Embed Frameworks */,
68+
);
69+
name = "Embed Frameworks";
70+
runOnlyForDeploymentPostprocessing = 0;
71+
};
5972
/* End PBXCopyFilesBuildPhase section */
6073

6174
/* Begin PBXFileReference section */
@@ -69,6 +82,7 @@
6982
9B267B6424405CFD002F571E /* ExtensionDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExtensionDelegate.swift; sourceTree = "<group>"; };
7083
9B267B6624405CFD002F571E /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
7184
9B267B6824405CFD002F571E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
85+
9B2E319C26A0312000BA33A8 /* AttributedString.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = AttributedString.framework; sourceTree = BUILT_PRODUCTS_DIR; };
7286
/* End PBXFileReference section */
7387

7488
/* Begin PBXFrameworksBuildPhase section */
@@ -79,6 +93,14 @@
7993
);
8094
runOnlyForDeploymentPostprocessing = 0;
8195
};
96+
9B2E318B26A02FC900BA33A8 /* Frameworks */ = {
97+
isa = PBXFrameworksBuildPhase;
98+
buildActionMask = 2147483647;
99+
files = (
100+
9B2E319D26A0312000BA33A8 /* AttributedString.framework in Frameworks */,
101+
);
102+
runOnlyForDeploymentPostprocessing = 0;
103+
};
82104
/* End PBXFrameworksBuildPhase section */
83105

84106
/* Begin PBXGroup section */
@@ -88,6 +110,7 @@
88110
9B267B5224405CFA002F571E /* Demo-Watch WatchKit App */,
89111
9B267B6124405CFD002F571E /* Demo-Watch WatchKit Extension */,
90112
9B267B4B24405CFA002F571E /* Products */,
113+
9B2E318726A02FC900BA33A8 /* Frameworks */,
91114
);
92115
sourceTree = "<group>";
93116
};
@@ -122,6 +145,14 @@
122145
path = "Demo-Watch WatchKit Extension";
123146
sourceTree = "<group>";
124147
};
148+
9B2E318726A02FC900BA33A8 /* Frameworks */ = {
149+
isa = PBXGroup;
150+
children = (
151+
9B2E319C26A0312000BA33A8 /* AttributedString.framework */,
152+
);
153+
name = Frameworks;
154+
sourceTree = "<group>";
155+
};
125156
/* End PBXGroup section */
126157

127158
/* Begin PBXNativeTarget section */
@@ -148,6 +179,8 @@
148179
buildPhases = (
149180
9B267B4C24405CFA002F571E /* Resources */,
150181
9B267B6E24405CFD002F571E /* Embed App Extensions */,
182+
9B2E318B26A02FC900BA33A8 /* Frameworks */,
183+
9B2E319F26A0312000BA33A8 /* Embed Frameworks */,
151184
);
152185
buildRules = (
153186
);
@@ -446,6 +479,10 @@
446479
DEVELOPMENT_TEAM = "";
447480
IBSC_MODULE = Demo_Watch_WatchKit_Extension;
448481
INFOPLIST_FILE = "Demo-Watch WatchKit App/Info.plist";
482+
LD_RUNPATH_SEARCH_PATHS = (
483+
"$(inherited)",
484+
"@executable_path/Frameworks",
485+
);
449486
PRODUCT_BUNDLE_IDENTIFIER = com.attributedstring.watchos;
450487
PRODUCT_NAME = "$(TARGET_NAME)";
451488
SDKROOT = watchos;
@@ -465,6 +502,10 @@
465502
DEVELOPMENT_TEAM = "";
466503
IBSC_MODULE = Demo_Watch_WatchKit_Extension;
467504
INFOPLIST_FILE = "Demo-Watch WatchKit App/Info.plist";
505+
LD_RUNPATH_SEARCH_PATHS = (
506+
"$(inherited)",
507+
"@executable_path/Frameworks",
508+
);
468509
PRODUCT_BUNDLE_IDENTIFIER = com.attributedstring.watchos;
469510
PRODUCT_NAME = "$(TARGET_NAME)";
470511
SDKROOT = watchos;

Demo/Demo/Cell/TableViewCell.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class TableViewCell: UITableViewCell {
2121
textView.textContainerInset = .zero
2222
}
2323

24-
func set(_ string: AttributedString) {
24+
func set(_ string: ASAttributedString) {
2525
textView.attributed.text = string
2626
}
2727

0 commit comments

Comments
 (0)