Skip to content

Commit 49a881d

Browse files
committed
移除调试代码
1 parent 90b29b9 commit 49a881d

3 files changed

Lines changed: 101 additions & 46 deletions

File tree

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "1160"
4+
version = "1.3">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
<BuildActionEntries>
9+
<BuildActionEntry
10+
buildForTesting = "YES"
11+
buildForRunning = "YES"
12+
buildForProfiling = "YES"
13+
buildForArchiving = "YES"
14+
buildForAnalyzing = "YES">
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "9B6E898523823F47009EBEBE"
18+
BuildableName = "Demo.app"
19+
BlueprintName = "Demo"
20+
ReferencedContainer = "container:Demo.xcodeproj">
21+
</BuildableReference>
22+
</BuildActionEntry>
23+
</BuildActionEntries>
24+
</BuildAction>
25+
<TestAction
26+
buildConfiguration = "Debug"
27+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
shouldUseLaunchSchemeArgsEnv = "YES">
30+
<Testables>
31+
</Testables>
32+
</TestAction>
33+
<LaunchAction
34+
buildConfiguration = "Debug"
35+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
36+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
37+
launchStyle = "0"
38+
useCustomWorkingDirectory = "NO"
39+
ignoresPersistentStateOnLaunch = "NO"
40+
debugDocumentVersioning = "YES"
41+
debugServiceExtension = "internal"
42+
allowLocationSimulation = "YES">
43+
<BuildableProductRunnable
44+
runnableDebuggingMode = "0">
45+
<BuildableReference
46+
BuildableIdentifier = "primary"
47+
BlueprintIdentifier = "9B6E898523823F47009EBEBE"
48+
BuildableName = "Demo.app"
49+
BlueprintName = "Demo"
50+
ReferencedContainer = "container:Demo.xcodeproj">
51+
</BuildableReference>
52+
</BuildableProductRunnable>
53+
</LaunchAction>
54+
<ProfileAction
55+
buildConfiguration = "Release"
56+
shouldUseLaunchSchemeArgsEnv = "YES"
57+
savedToolIdentifier = ""
58+
useCustomWorkingDirectory = "NO"
59+
debugDocumentVersioning = "YES">
60+
<BuildableProductRunnable
61+
runnableDebuggingMode = "0">
62+
<BuildableReference
63+
BuildableIdentifier = "primary"
64+
BlueprintIdentifier = "9B6E898523823F47009EBEBE"
65+
BuildableName = "Demo.app"
66+
BlueprintName = "Demo"
67+
ReferencedContainer = "container:Demo.xcodeproj">
68+
</BuildableReference>
69+
</BuildableProductRunnable>
70+
</ProfileAction>
71+
<AnalyzeAction
72+
buildConfiguration = "Debug">
73+
</AnalyzeAction>
74+
<ArchiveAction
75+
buildConfiguration = "Release"
76+
revealArchiveInOrganizer = "YES">
77+
</ArchiveAction>
78+
</Scheme>

Demo/Demo/Details/CheckingViewController.swift

Lines changed: 19 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -36,50 +36,27 @@ class CheckingViewController: ViewController<CheckingView> {
3636
}
3737

3838
do {
39-
40-
// 目前的问题是, 如果内容显示全 是OK的, 如果显示不全 就会有问题, 比如numberOfLines = x 或者 height较小.
41-
42-
let label = UILabel(frame: .init(x: 12, y: 80, width: 414 - 24, height: 750))
43-
label.backgroundColor = .white
44-
view.addSubview(label)
45-
label.attributed.observe(.regex("a")) { (result) in
46-
// 随便添加个监听 以便触发点击事件 显示DebugView
47-
}
48-
// label.font = UIFont(name: "Georgia", size: 20)!
49-
label.font = .systemFont(ofSize: 20)
50-
label.numberOfLines = 0 // 限制行数后会存在显示不一致的问题 目前无法解决
51-
label.lineBreakMode = .byTruncatingTail
52-
53-
let string: AttributedString = .init(
54-
"""
55-
\("iCloud 🤗能将你的 GarageBand 创作进度在你所有的 iOS 设备间保持更新🤗。", .font(UIFont(name: "Georgia-Italic", size: 30)!), .paragraph(.lineSpacing(10)))\n它还可以让你在 iPad、iPhone 或 iPod\(.image(#imageLiteral(resourceName: "huaji"), .custom(.center, size: .init(width: 133, height: 133)))) touch 上开始勾勒(灬ꈍ ꈍ灬)一首歌的灵感,然后用 iCloud Drive 将音轨导入 Mac 做进一步创作,再将完成的作品共享到你的任何设备。你还可以导入 Logic Pro 项目的便携版本,接着创作其他音轨。\n\n当你重新在 \("Logic Pro", .font(UIFont(name: "HelveticaNeue", size: 30)!)) 打开该项目时,所😺有原始音轨以及在 GarageBand 中另外添加的音轨,都将🥔同时显示出来。Hello world\(.image(#imageLiteral(resourceName: "swift-icon"), .proposed()))
56-
""", .paragraph(.firstLineHeadIndent(10), .paragraphSpacing(5))
57-
)
58-
label.attributed.text = string
39+
var string: AttributedString = """
40+
我的名字叫李响,我的手机号码是18611401994,我的电子邮件地址是18611401994@163.com,现在是2020/06/28 20:30。我的GitHub主页是https://github.com/lixiang1994。欢迎来Star! \("点击联系我", .action(clicked))
41+
"""
42+
string.add(attributes: [.foreground(#colorLiteral(red: 0.9529411793, green: 0.6862745285, blue: 0.1333333403, alpha: 1)), .font(.systemFont(ofSize: 20, weight: .medium))], checkings: [.phoneNumber])
43+
string.add(attributes: [.foreground(#colorLiteral(red: 0.1764705926, green: 0.4980392158, blue: 0.7568627596, alpha: 1)), .font(.systemFont(ofSize: 20, weight: .medium))], checkings: [.link])
44+
string.add(attributes: [.foreground(#colorLiteral(red: 0.1764705926, green: 0.01176470611, blue: 0.5607843399, alpha: 1)), .font(.systemFont(ofSize: 20, weight: .medium))], checkings: [.date])
45+
string.add(attributes: [.font(.systemFont(ofSize: 20, weight: .medium))], checkings: [.action])
46+
container.label.attributed.text = string
5947
}
6048

61-
// do {
62-
// var string: AttributedString = """
63-
// 我的名字叫李响,我的手机号码是18611401994,我的电子邮件地址是18611401994@163.com,现在是2020/06/28 20:30。我的GitHub主页是https://github.com/lixiang1994。欢迎来Star! \("点击联系我", .action(clicked))
64-
// """
65-
// string.add(attributes: [.foreground(#colorLiteral(red: 0.9529411793, green: 0.6862745285, blue: 0.1333333403, alpha: 1)), .font(.systemFont(ofSize: 20, weight: .medium))], checkings: [.phoneNumber])
66-
// string.add(attributes: [.foreground(#colorLiteral(red: 0.1764705926, green: 0.4980392158, blue: 0.7568627596, alpha: 1)), .font(.systemFont(ofSize: 20, weight: .medium))], checkings: [.link])
67-
// string.add(attributes: [.foreground(#colorLiteral(red: 0.1764705926, green: 0.01176470611, blue: 0.5607843399, alpha: 1)), .font(.systemFont(ofSize: 20, weight: .medium))], checkings: [.date])
68-
// string.add(attributes: [.font(.systemFont(ofSize: 20, weight: .medium))], checkings: [.action])
69-
// container.label.attributed.text = string
70-
// }
71-
72-
// do {
73-
// var string: AttributedString = """
74-
// My name is Li Xiang, my mobile phone number is 18611401994, my email address is 18611401994@163.com, I live in No.10 Xitucheng Road, Haidian District, Beijing, China, and it is now 20:30 on June 28, 2020. My GitHub homepage is https://github.com/lixiang1994. Welcome to star me! \("Contact me", .action(clicked))
75-
// """
76-
// string.add(attributes: [.foreground(#colorLiteral(red: 0.9529411793, green: 0.6862745285, blue: 0.1333333403, alpha: 1))], checkings: [.address])
77-
// string.add(attributes: [.foreground(#colorLiteral(red: 0.4666666687, green: 0.7647058964, blue: 0.2666666806, alpha: 1))], checkings: [.link, .phoneNumber])
78-
// string.add(attributes: [.foreground(#colorLiteral(red: 0.1764705926, green: 0.01176470611, blue: 0.5607843399, alpha: 1))], checkings: [.date])
79-
// string.add(attributes: [.foreground(#colorLiteral(red: 0.9098039269, green: 0.4784313738, blue: 0.6431372762, alpha: 1))], checkings: [.regex("Li Xiang")])
80-
// string.add(attributes: [.font(.systemFont(ofSize: 16, weight: .medium))], checkings: [.action])
81-
// container.textView.attributed.text = string
82-
// }
49+
do {
50+
var string: AttributedString = """
51+
My name is Li Xiang, my mobile phone number is 18611401994, my email address is 18611401994@163.com, I live in No.10 Xitucheng Road, Haidian District, Beijing, China, and it is now 20:30 on June 28, 2020. My GitHub homepage is https://github.com/lixiang1994. Welcome to star me! \("Contact me", .action(clicked))
52+
"""
53+
string.add(attributes: [.foreground(#colorLiteral(red: 0.9529411793, green: 0.6862745285, blue: 0.1333333403, alpha: 1))], checkings: [.address])
54+
string.add(attributes: [.foreground(#colorLiteral(red: 0.4666666687, green: 0.7647058964, blue: 0.2666666806, alpha: 1))], checkings: [.link, .phoneNumber])
55+
string.add(attributes: [.foreground(#colorLiteral(red: 0.1764705926, green: 0.01176470611, blue: 0.5607843399, alpha: 1))], checkings: [.date])
56+
string.add(attributes: [.foreground(#colorLiteral(red: 0.9098039269, green: 0.4784313738, blue: 0.6431372762, alpha: 1))], checkings: [.regex("Li Xiang")])
57+
string.add(attributes: [.font(.systemFont(ofSize: 16, weight: .medium))], checkings: [.action])
58+
container.textView.attributed.text = string
59+
}
8360

8461
container.tintAdjustmentMode = .normal
8562
}

Sources/Extension/UIKit/UILabel/UILabelExtension.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -295,10 +295,10 @@ fileprivate extension UILabel {
295295
point.y -= (bounds.height - height) / 2
296296

297297
// Debug
298-
subviews.filter({ $0 is DebugView }).forEach({ $0.removeFromSuperview() })
299-
let view = DebugView(frame: .init(x: 0, y: (bounds.height - height) / 2, width: bounds.width, height: height))
300-
view.draw = { layoutManager.drawGlyphs(forGlyphRange: .init(location: 0, length: textStorage.length), at: .zero) }
301-
addSubview(view)
298+
// subviews.filter({ $0 is DebugView }).forEach({ $0.removeFromSuperview() })
299+
// let view = DebugView(frame: .init(x: 0, y: (bounds.height - height) / 2, width: bounds.width, height: height))
300+
// view.draw = { layoutManager.drawGlyphs(forGlyphRange: .init(location: 0, length: textStorage.length), at: .zero) }
301+
// addSubview(view)
302302

303303
// 获取字形下标
304304
var fraction: CGFloat = 0

0 commit comments

Comments
 (0)