Skip to content

Commit be59f85

Browse files
committed
添加文字效果
1 parent 4db156d commit be59f85

File tree

3 files changed

+35
-18
lines changed

3 files changed

+35
-18
lines changed

SwiftPamphletApp/App/IntroView.swift

+25-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,26 @@
88
import SwiftUI
99
import MarkdownUI
1010

11+
struct LightingView<Content: View>: View {
12+
@Environment(\.colorScheme) var colorSchemeMode
13+
let content: Content
14+
init(@ViewBuilder content: () -> Content) {
15+
self.content = content()
16+
}
17+
var body: some View {
18+
ZStack {
19+
content
20+
.blendMode(colorSchemeMode == .dark ? .colorDodge : .colorBurn)
21+
content
22+
.blendMode(colorSchemeMode == .dark ? .softLight : .softLight)
23+
content
24+
.blur(radius: 1)
25+
content
26+
27+
}
28+
}
29+
}
30+
1131
struct IntroView: View {
1232
var body: some View {
1333
VStack(spacing: 15) {
@@ -16,7 +36,11 @@ struct IntroView: View {
1636
.aspectRatio(contentMode: .fit)
1737
.frame(width: 120, height: 120)
1838
Text("戴铭的开发小册子").bold()
19-
Text("Swift Pamphlet App").gradientTitle(color: .mint)
39+
LightingView {
40+
Text("Swift Pamphlet App").gradientTitle(color: .mint)
41+
}
42+
43+
2044
HStack {
2145
Text("一本活的开发手册")
2246
Link("GitHub 地址", destination: URL(string: "https://github.com/ming1016/SwiftPamphletApp")!)

SwiftPamphletApp/InfoOrganizer/Info/EditInfoView.swift

+8-16
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ struct EditInfoView: View {
4343
VStack {
4444
Form {
4545
Section {
46-
titleInputView()
47-
urlInputView()
46+
titleInputView
47+
urlInputView
4848
} // end Section
4949

5050
Section {
51-
categoryInputView()
51+
categoryInputView
5252
}
5353
// MARK: Tab 切换
5454
Section(footer: Text("文本支持 markdown 格式")) {
@@ -252,7 +252,7 @@ struct EditInfoView: View {
252252

253253
// MARK: WebView
254254
@ViewBuilder
255-
func webViewView() -> some View {
255+
private func webViewView() -> some View {
256256
if let url = URL(string: info.url) {
257257
VStack {
258258
WebUIViewWithSave(
@@ -271,7 +271,7 @@ struct EditInfoView: View {
271271

272272
// MARK: Text And Preview
273273
@ViewBuilder
274-
func textAndPreviewView() -> some View {
274+
private func textAndPreviewView() -> some View {
275275
TextEditor(text: $info.des).border()
276276
.padding(10)
277277
.tabItem { Label("文本", systemImage: "circle") }
@@ -284,8 +284,7 @@ struct EditInfoView: View {
284284

285285

286286
// MARK: Category
287-
@ViewBuilder
288-
func categoryInputView() -> some View {
287+
private var categoryInputView: some View {
289288
HStack {
290289
Picker("分类:", selection: $info.category) {
291290
Text("未分类")
@@ -340,15 +339,9 @@ struct EditInfoView: View {
340339
}
341340

342341
// MARK: URL
343-
@ViewBuilder
344-
func urlInputView() -> some View {
342+
private var urlInputView: some View {
345343
HStack {
346344
TextField("地址:", text: $info.url, prompt: Text("输入或粘贴 url,例如 https://www.starming.com")).rounded()
347-
// .onSubmit {
348-
// Task.detached(priority: .background, operation: {
349-
//
350-
// })
351-
// }
352345
if info.url.isEmpty == false {
353346
Button {
354347
Task {
@@ -392,8 +385,7 @@ struct EditInfoView: View {
392385
}
393386

394387
// MARK: 标题
395-
@ViewBuilder
396-
func titleInputView() -> some View {
388+
private var titleInputView: some View {
397389
HStack {
398390
TextField("标题:", text: $info.name).rounded()
399391
Toggle(isOn: $info.star) {

SwiftPamphletApp/Resource/Guide/1.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
## 动态
22
## 版本
33

4+
* 6.0 使用 WWDC23 技术进行了重构
45
* 5.0 增加 WWDC22 内容
56

67
## Todo
78

89
* 设计功能
10+
* 内容增加和更新
911

1012
## 当前在用开发工具速链
1113

12-
* [SQLite.swift/Index.md](https://github.com/stephencelis/SQLite.swift/blob/master/Documentation/Index.md) 文档
1314
* [GitHub REST API - GitHub Docs](https://docs.github.com/cn/rest)
1415
* 在线工具:[TinyPNG](https://tinypng.com/)[JSON校验](http://www.1json.com/json/)

0 commit comments

Comments
 (0)