Skip to content

Commit

Permalink
add new wwdc content
Browse files Browse the repository at this point in the history
  • Loading branch information
ming1016 committed Jun 27, 2022
1 parent aaad83b commit 1e5b9be
Show file tree
Hide file tree
Showing 43 changed files with 1,517 additions and 24 deletions.
88 changes: 86 additions & 2 deletions SwiftPamphletApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,23 @@
objects = {

/* Begin PBXBuildFile section */
08026C412869B1BF00792EF1 /* 183.md in Resources */ = {isa = PBXBuildFile; fileRef = 08026C402869B1BF00792EF1 /* 183.md */; };
08026C432869B22E00792EF1 /* 176.md in Resources */ = {isa = PBXBuildFile; fileRef = 08026C422869B22E00792EF1 /* 176.md */; };
08026C442869B24F00792EF1 /* 177.md in Resources */ = {isa = PBXBuildFile; fileRef = 08026C2F2869945300792EF1 /* 177.md */; };
08026C452869B25700792EF1 /* 178.md in Resources */ = {isa = PBXBuildFile; fileRef = 08026C302869948400792EF1 /* 178.md */; };
08026C462869B26000792EF1 /* 179.md in Resources */ = {isa = PBXBuildFile; fileRef = 08026C322869991200792EF1 /* 179.md */; };
08026C472869B26900792EF1 /* 180.md in Resources */ = {isa = PBXBuildFile; fileRef = 08026C34286999BB00792EF1 /* 180.md */; };
08026C482869B28A00792EF1 /* 181.md in Resources */ = {isa = PBXBuildFile; fileRef = 08026C3528699AAA00792EF1 /* 181.md */; };
08026C492869B38300792EF1 /* 182.md in Resources */ = {isa = PBXBuildFile; fileRef = 08026C3628699C8700792EF1 /* 182.md */; };
08026C4A2869B38F00792EF1 /* 184.md in Resources */ = {isa = PBXBuildFile; fileRef = 08026C3828699EB700792EF1 /* 184.md */; };
08026C4B2869B39700792EF1 /* 185.md in Resources */ = {isa = PBXBuildFile; fileRef = 08026C392869A17800792EF1 /* 185.md */; };
08026C4C2869B39F00792EF1 /* 186.md in Resources */ = {isa = PBXBuildFile; fileRef = 08026C3A2869A21000792EF1 /* 186.md */; };
08026C4D2869B3A600792EF1 /* 187.md in Resources */ = {isa = PBXBuildFile; fileRef = 08026C3B2869A2F100792EF1 /* 187.md */; };
08026C4E2869B3B500792EF1 /* 188.md in Resources */ = {isa = PBXBuildFile; fileRef = 08026C3C2869A35800792EF1 /* 188.md */; };
08026C4F2869B3BE00792EF1 /* 189.md in Resources */ = {isa = PBXBuildFile; fileRef = 08026C3D2869A51200792EF1 /* 189.md */; };
08026C512869B43500792EF1 /* 190.md in Resources */ = {isa = PBXBuildFile; fileRef = 08026C502869B41B00792EF1 /* 190.md */; };
08026C522869B43D00792EF1 /* 191.md in Resources */ = {isa = PBXBuildFile; fileRef = 08026C3E2869AD7800792EF1 /* 191.md */; };
08026C532869B44400792EF1 /* 192.md in Resources */ = {isa = PBXBuildFile; fileRef = 08026C3F2869B00D00792EF1 /* 192.md */; };
08038767276700F100519B15 /* CCYRESTfulAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08038766276700F100519B15 /* CCYRESTfulAPI.swift */; };
083554E12756503B0095E0EE /* AnimateLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 083554E02756503B0095E0EE /* AnimateLayout.swift */; };
083554E327572BB60095E0EE /* AppVM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 083554E227572BB60095E0EE /* AppVM.swift */; };
Expand Down Expand Up @@ -251,6 +268,23 @@

/* Begin PBXFileReference section */
080124FD27EC62DC00E44222 /* SwiftPamphletAppDebug.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = SwiftPamphletAppDebug.entitlements; sourceTree = "<group>"; };
08026C2F2869945300792EF1 /* 177.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = 177.md; sourceTree = "<group>"; };
08026C302869948400792EF1 /* 178.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = 178.md; sourceTree = "<group>"; };
08026C322869991200792EF1 /* 179.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = 179.md; sourceTree = "<group>"; };
08026C34286999BB00792EF1 /* 180.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = 180.md; sourceTree = "<group>"; };
08026C3528699AAA00792EF1 /* 181.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = 181.md; sourceTree = "<group>"; };
08026C3628699C8700792EF1 /* 182.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = 182.md; sourceTree = "<group>"; };
08026C3828699EB700792EF1 /* 184.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = 184.md; sourceTree = "<group>"; };
08026C392869A17800792EF1 /* 185.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = 185.md; sourceTree = "<group>"; };
08026C3A2869A21000792EF1 /* 186.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = 186.md; sourceTree = "<group>"; };
08026C3B2869A2F100792EF1 /* 187.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = 187.md; sourceTree = "<group>"; };
08026C3C2869A35800792EF1 /* 188.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = 188.md; sourceTree = "<group>"; };
08026C3D2869A51200792EF1 /* 189.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = 189.md; sourceTree = "<group>"; };
08026C3E2869AD7800792EF1 /* 191.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = 191.md; sourceTree = "<group>"; };
08026C3F2869B00D00792EF1 /* 192.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = 192.md; sourceTree = "<group>"; };
08026C402869B1BF00792EF1 /* 183.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = 183.md; sourceTree = "<group>"; };
08026C422869B22E00792EF1 /* 176.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = 176.md; sourceTree = "<group>"; };
08026C502869B41B00792EF1 /* 190.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = 190.md; sourceTree = "<group>"; };
08038766276700F100519B15 /* CCYRESTfulAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CCYRESTfulAPI.swift; sourceTree = "<group>"; };
083554E02756503B0095E0EE /* AnimateLayout.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnimateLayout.swift; sourceTree = "<group>"; };
083554E227572BB60095E0EE /* AppVM.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppVM.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -508,6 +542,25 @@
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
08026C312869990100792EF1 /* Tool */ = {
isa = PBXGroup;
children = (
08026C322869991200792EF1 /* 179.md */,
);
path = Tool;
sourceTree = "<group>";
};
08026C332869999800792EF1 /* APMAndBuilder */ = {
isa = PBXGroup;
children = (
08026C34286999BB00792EF1 /* 180.md */,
08026C3528699AAA00792EF1 /* 181.md */,
08026C3628699C8700792EF1 /* 182.md */,
08026C402869B1BF00792EF1 /* 183.md */,
);
path = APMAndBuilder;
sourceTree = "<group>";
};
080387652766FF3200519B15 /* Network */ = {
isa = PBXGroup;
children = (
Expand All @@ -533,6 +586,7 @@
08448F45279E7E1A00B61353 /* Features */ = {
isa = PBXGroup;
children = (
08026C312869990100792EF1 /* Tool */,
0850445227B110A50096D556 /* InsideProtocol */,
0850445127B110950096D556 /* InsidePropertyWrapper */,
08448F90279EB8A300B61353 /* Engineering */,
Expand All @@ -550,6 +604,7 @@
08448F46279E7E3400B61353 /* Subject */ = {
isa = PBXGroup;
children = (
08026C332869999800792EF1 /* APMAndBuilder */,
084E1A6127B517990072BBB6 /* SwiftThoseThings */,
08448F61279EB2B700B61353 /* Standard */,
08448F5F279EB25F00B61353 /* RecommendedMaterials */,
Expand Down Expand Up @@ -595,6 +650,7 @@
08448F56279EA84100B61353 /* 51.md */,
08448F57279EA84100B61353 /* 52.md */,
08448F58279EA84100B61353 /* 131.md */,
08026C3F2869B00D00792EF1 /* 192.md */,
);
path = macOS;
sourceTree = "<group>";
Expand Down Expand Up @@ -708,6 +764,7 @@
08448F9B279EBA8200B61353 /* 7.md */,
08448F9D279EBAA800B61353 /* 8.md */,
08448F9F279EBAD900B61353 /* 9.md */,
08026C422869B22E00792EF1 /* 176.md */,
);
path = Base;
sourceTree = "<group>";
Expand Down Expand Up @@ -840,6 +897,8 @@
08449021279ECDEF00B61353 /* 68.md */,
08449023279ECE2200B61353 /* 69.md */,
08449025279ECE5400B61353 /* 70.md */,
08026C2F2869945300792EF1 /* 177.md */,
08026C302869948400792EF1 /* 178.md */,
);
path = Intro;
sourceTree = "<group>";
Expand All @@ -848,6 +907,7 @@
isa = PBXGroup;
children = (
08449028279ECEB100B61353 /* 71.md */,
08026C3828699EB700792EF1 /* 184.md */,
);
path = Intro;
sourceTree = "<group>";
Expand Down Expand Up @@ -879,6 +939,12 @@
0896FB9127BA486900676B7F /* 145.md */,
0844902B279ECEFB00B61353 /* 100.md */,
0844902D279ECF1C00B61353 /* 92.md */,
08026C392869A17800792EF1 /* 185.md */,
08026C3A2869A21000792EF1 /* 186.md */,
08026C3B2869A2F100792EF1 /* 187.md */,
08026C3C2869A35800792EF1 /* 188.md */,
08026C3D2869A51200792EF1 /* 189.md */,
08026C502869B41B00792EF1 /* 190.md */,
);
path = UseViewComponent;
sourceTree = "<group>";
Expand Down Expand Up @@ -960,6 +1026,7 @@
085BB77327D22FCA00E8F69A /* 172.md */,
08522BE827CF6E3A005FF059 /* 169.md */,
08522BE327CF5C55005FF059 /* 168.md */,
08026C3E2869AD7800792EF1 /* 191.md */,
);
path = Vsion;
sourceTree = "<group>";
Expand Down Expand Up @@ -1349,6 +1416,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
08026C512869B43500792EF1 /* 190.md in Resources */,
0850445027B0FDBD0096D556 /* 137.md in Resources */,
08449015279ECC8300B61353 /* 59.md in Resources */,
08448FFC279ECA7C00B61353 /* 79.md in Resources */,
Expand All @@ -1361,6 +1429,7 @@
08448FA3279EBB1B00B61353 /* 3.md in Resources */,
08AEAEFA277F3C7400B969E2 /* css.html in Resources */,
086A5F502744EF3B00FECE02 /* developers.json in Resources */,
08026C492869B38300792EF1 /* 182.md in Resources */,
0850444E27B0D4EA0096D556 /* 136.md in Resources */,
08C3BBA227CF1B2B00ACF0FE /* 164.md in Resources */,
086A5F5A274CC17700FECE02 /* lib-Combine.json in Resources */,
Expand All @@ -1379,6 +1448,7 @@
08448FB8279EC3C200B61353 /* 22.md in Resources */,
0844900F279ECC0C00B61353 /* 56.md in Resources */,
08448F9A279EBA2900B61353 /* 6.md in Resources */,
08026C472869B26900792EF1 /* 180.md in Resources */,
08448F8C279EB84800B61353 /* 93.md in Resources */,
08BE638727CDF1DD002BC6A8 /* D-技术播客.json in Resources */,
08448FC1279EC4B500B61353 /* 26.md in Resources */,
Expand All @@ -1390,6 +1460,7 @@
08BE632A27BE220D002BC6A8 /* 146.md in Resources */,
08448F5B279EA84100B61353 /* 131.md in Resources */,
0844900A279ECB8C00B61353 /* 86.md in Resources */,
08026C4D2869B3A600792EF1 /* 187.md in Resources */,
08B4C93C2774786800742084 /* archiveRepos.json in Resources */,
08449011279ECC3E00B61353 /* 57.md in Resources */,
08448FE2279EC7CF00B61353 /* 43.md in Resources */,
Expand All @@ -1398,7 +1469,10 @@
0844901E279ECD9D00B61353 /* 66.md in Resources */,
08448FD3279EC60300B61353 /* 36.md in Resources */,
08448F64279EB32C00B61353 /* 50.md in Resources */,
08026C482869B28A00792EF1 /* 181.md in Resources */,
08448FD7279EC64600B61353 /* 38.md in Resources */,
08026C412869B1BF00792EF1 /* 183.md in Resources */,
08026C4F2869B3BE00792EF1 /* 189.md in Resources */,
08522BE927CF6E3B005FF059 /* 169.md in Resources */,
08449004279ECB2900B61353 /* 83.md in Resources */,
08BE634A27C4BDDB002BC6A8 /* 151.md in Resources */,
Expand All @@ -1407,6 +1481,7 @@
08449018279ECD2400B61353 /* 63.md in Resources */,
086A5F58274CB8B500FECE02 /* guide-subject.json in Resources */,
08448FAD279EC2E900B61353 /* 14.md in Resources */,
08026C532869B44400792EF1 /* 192.md in Resources */,
08448F66279EB33F00B61353 /* 103.md in Resources */,
08448FDA279EC6F500B61353 /* 39.md in Resources */,
08C3BB8027CE4A8500ACF0FE /* 162.md in Resources */,
Expand All @@ -1424,6 +1499,7 @@
0850445627B110DA0096D556 /* 138.md in Resources */,
08449020279ECDCE00B61353 /* 67.md in Resources */,
0896FB9227BA486900676B7F /* 145.md in Resources */,
08026C442869B24F00792EF1 /* 177.md in Resources */,
08A4FDC227B25A140068E5BC /* 141.md in Resources */,
08448FC3279EC4D600B61353 /* 27.md in Resources */,
08AEAEE9277EDD9000B969E2 /* rssfeed.json in Resources */,
Expand All @@ -1446,6 +1522,7 @@
08448F83279EB78A00B61353 /* 49.md in Resources */,
08448F81279EB75800B61353 /* 106.md in Resources */,
08448FF6279EC9E800B61353 /* 76.md in Resources */,
08026C452869B25700792EF1 /* 178.md in Resources */,
0844902C279ECEFB00B61353 /* 100.md in Resources */,
085BB77627D22FE300E8F69A /* 173.md in Resources */,
08BE635827C63F3A002BC6A8 /* 153.md in Resources */,
Expand All @@ -1456,13 +1533,16 @@
08448F8F279EB88500B61353 /* 129.md in Resources */,
08448FA0279EBAD900B61353 /* 9.md in Resources */,
08448FFA279ECA5300B61353 /* 78.md in Resources */,
08026C462869B26000792EF1 /* 179.md in Resources */,
08448FF8279ECA2000B61353 /* 77.md in Resources */,
08448F86279EB7D200B61353 /* 53.md in Resources */,
08448FA5279EBB4100B61353 /* 10.md in Resources */,
08026C522869B43D00792EF1 /* 191.md in Resources */,
084E1A5F27B4F7BB0072BBB6 /* 142.md in Resources */,
08448FDC279EC71800B61353 /* 40.md in Resources */,
08448F43279B83C000B61353 /* archiveDevelopers.json in Resources */,
0844902E279ECF1C00B61353 /* 92.md in Resources */,
08026C4A2869B38F00792EF1 /* 184.md in Resources */,
08448F5E279EB23600B61353 /* 99.md in Resources */,
08BE635427C63828002BC6A8 /* 152.md in Resources */,
08448FEA279EC86700B61353 /* 47.md in Resources */,
Expand All @@ -1486,11 +1566,14 @@
08448FEF279EC93D00B61353 /* 54.md in Resources */,
08448FA9279EBBB900B61353 /* 12.md in Resources */,
08448FE8279EC84B00B61353 /* 46.md in Resources */,
08026C4C2869B39F00792EF1 /* 186.md in Resources */,
086A5F0E2744E89100FECE02 /* Preview Assets.xcassets in Resources */,
08448F0F2799328700B61353 /* css_cn.html in Resources */,
08448F5A279EA84100B61353 /* 52.md in Resources */,
08448F9E279EBAA800B61353 /* 8.md in Resources */,
08448FEC279EC8BE00B61353 /* 5.md in Resources */,
08026C4E2869B3B500792EF1 /* 188.md in Resources */,
08026C432869B22E00792EF1 /* 176.md in Resources */,
08BE636427C886D2002BC6A8 /* 156.md in Resources */,
08449030279ECF7D00B61353 /* 1.md in Resources */,
08522BDA27CF5029005FF059 /* 166.md in Resources */,
Expand All @@ -1503,6 +1586,7 @@
08449022279ECDEF00B61353 /* 68.md in Resources */,
086A5F0B2744E89100FECE02 /* Assets.xcassets in Resources */,
08448FBF279EC45E00B61353 /* 25.md in Resources */,
08026C4B2869B39700792EF1 /* 185.md in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -1739,7 +1823,7 @@
"$(inherited)",
"@executable_path/../Frameworks",
);
MARKETING_VERSION = 4.6;
MARKETING_VERSION = 5.0;
OTHER_LDFLAGS = (
"-Xlinker",
"-interposable",
Expand Down Expand Up @@ -1779,7 +1863,7 @@
"$(inherited)",
"@executable_path/../Frameworks",
);
MARKETING_VERSION = 4.6;
MARKETING_VERSION = 5.0;
PRODUCT_BUNDLE_IDENTIFIER = com.starming.SwiftPamphletAppByMing;
PRODUCT_NAME = "戴铭的开发小册子";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
2 changes: 1 addition & 1 deletion SwiftPamphletApp/IntroView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ struct IntroView: View {
Text("一本活的开发手册")
Link("GitHub 地址", destination: URL(string: "https://github.com/KwaiAppTeam/SwiftPamphletApp")!)
}
Text("版本4.6").font(.footnote)
Text("版本5.0").font(.footnote)
}
.frame(minWidth: SPC.detailMinWidth)
.enableInjection()
Expand Down
4 changes: 4 additions & 0 deletions SwiftPamphletApp/Resource/Archive/archiveRepos.json
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,10 @@
{
"id":"hoppscotch/hoppscotch",
"des":"开源接口开发生态系统"
},
{
"id":"lukepistrol/Pexels-Swift",
"des":"照片展示 pexel 接口"
}
]
},
Expand Down
3 changes: 3 additions & 0 deletions SwiftPamphletApp/Resource/Guide/1.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
## 动态
## 版本

* 5.0 增加 WWDC22 内容

## Todo

Expand Down
49 changes: 49 additions & 0 deletions SwiftPamphletApp/Resource/Guide/Concurrency/Intro/177.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
session [Eliminate data races using Swift Concurrency](https://developer.apple.com/videos/play/wwdc2022-110351)[Visualize and optimize Swift concurrency](https://developer.apple.com/videos/play/wwdc2022-110350)[Meet Swift Async Algorithms](https://developer.apple.com/videos/play/wwdc2022-110355)

表示持续时间有了新的放来来表达,对应提案是 [SE-0329 Clock, Instant, and Duration](https://github.com/apple/swift-evolution/blob/main/proposals/0329-clock-instant-duration.md) ,continuous clock 是在系统睡眠状态还会增加时间,suspending clock 在系统睡眠状态不会增加时间。Instants 表示一个确定的时间。Duration 表示两个时间经历了多久。

新增 [SE-0338 Clarify the Execution of Non-Actor-Isolated Async Functions](https://github.com/apple/swift-evolution/blob/main/proposals/0338-clarify-execution-non-actor-async.md) 通过收紧可发送性检查的规则来避免潜在的数据竞争。

[SE-0343 Concurrency in Top-level Code](https://github.com/apple/swift-evolution/blob/main/proposals/0343-top-level-concurrency.md) 这个提案主要是更好地支持命令行工具的开发,可以直接将 concurrency 代码写到 main.swift 文件里。

[SE-0340 Unavailable From Async Attribute](https://github.com/apple/swift-evolution/blob/main/proposals/0340-swift-noasync.md) 提供 noasync 语法以允许我们将类型和函数标记为在异步上下文不可用。

Task 是按顺序执行的,是异步的,在 await 时可以暂停任意次数。task 是自包含的,有自己的资源,可以独立于任何其他 task 独立运行。task 通过在 body 末尾返回一个值来传递对象,值类型没问题,如果是引用类型有可能出现数据竞争。

通过 Sendable 协议 Swift 可以帮助告诉我们什么时候 task 之间共享数据是安全的。Sendable 描述的类型可以跨隔离 domain,不会有数据竞争,Swift 编译器会在构建时检查数据竞争。task 的返回类型要符合 Sendable。

引用类型只能在很少的情况下符合 Sendable。比如 final class 只有不可变的存储。对于自己内部同步的引用类型,比如锁,可以用 `@unchecked Sendable`
```swift
class ConcurrentCache<Key: Hashable & Sendable, Value: Sendable>: @unchecked Sendable {
var lock: NSLock
var storage: [Key: Value]

// ...
}
```

Actor 提供了一种隔离状态的方法可以消除数据竞争。使用 task 来执行 actor 定义的代码。一次只能在一个 actor 上执行一个 task。actor 也是依赖 Sendable。actor 是引用类型,但隔离了他们所有属性和代码来防止并发访问。`@MainActor` 表示的是主线程,你要在应用中更新 UI 时来用它。
```swift
@MainActor func updateView() { }

Task { @MainActor in
// update UI here
}
```

`@MainActor` 也可以用于类,类的属性和方法只能在主 main actor 上访问,除非标记为 `nonisolated`
```swift
@MainActor
class ChickenValley: Sendable {
var flock: [Chicken]
var food: [Pineapple]

func advanceTime() {
for chicken in flock {
chicken.eat(from: &food)
}
}
}
```


Loading

0 comments on commit 1e5b9be

Please sign in to comment.