本集简介
双语字幕
仅展示文本字幕,不包含中文音频;想边听边看,请使用 Bayt 播客 App。
好的,开始了。这是我们实际会读出来的部分,之后我会搞砸,因为我们有编辑器,但无法实时编辑。欢迎收听《Swift Over Coffee》第四季第六集。
Okay. Here we go. So this is the one part of it that we actually read. And then I screw up because we have an editor, but we can't edit live. Welcome to season four episode six of Swift Over Coffee.
我是Mikaela Karin。
I'm Mikaela Karin.
我是Paul Hudson。
And I'm Paul Hudson.
在这一集中,我们讨论了WWDC 25以及其他线下活动。在Dub Dub之前,你会谈论将要发生的事情;在发布之后,你会谈论刚刚发生了什么。
In this episode, we discuss WWDC twenty five and other in person events. Right before dub dub, you're talking about what's gonna happen. Right after the announcements, you're talking about what just happened.
我们会分享你对如何在苹果平台之外使用Swift的看法。我想没人会怀疑我有多喜欢Swift。但在跨平台开发方面,我有点犹豫不决。
We'll share your thoughts on how to use Swift outside of Apple's platforms. I don't think anyone doubts how much I like Swift very much. I'm on the fence a little bit when it comes to cross platform work.
此外
Plus
如果我那么做的话,我可能会离婚,你知道
I think if I did that, I would probably, get a divorce as you We
我们现在在Tri Swift现场。我们正在直播录制所有内容,这非常有趣。这是我第二次这样做,而且我们刚刚做完演讲。今天早上我是第一个发言的人,我谈到了为Vision OS设计的Tabletop Kit,用来制作桌面游戏,有点像桌游,但不需要真正的桌子,所以他们称之为桌面游戏。
are here at Tri Swift. So we are recording everything live, which is super fun. This is the second time I've done this, and we just gave our talks. I was the very first speaker this morning, and I talked about tabletop kit for Vision OS, which is, like, to build tabletop games, which is kind of like board games except you don't have to have a board, so they called it tabletop games.
这是仅限于VisionOS还是适用于所有平台?
And is it VisionOS only or, like, all platforms?
这个特定框架仅支持VisionOS,并且不只是VisionOS,还要求是VisionOS 2.0及以上版本。
Only VisionOS for this specific framework. And it's not only VisionOS, it's VisionOS two point o and greater.
对,所以在这个问题上,维恩图的交集可以说是非常小。
Right. So sort of the the Venn diagram intersection on that one is is remarkably small.
是的。你其实并不一定需要一个VisionPRO设备才能使用它,但有了设备会方便很多。因为当你进行开发时,你可能想把某个东西从A点移动到B点。但如果你想在深度方向上移动它,你就得在模拟器里不断旋转相机,这会变得非常别扭。因此如果你有一个设备的话会容易得多,你知道,很多人都是这样认为的。
Yes. It's you have to have you don't have to have a VisionPRO to actually use it, but it makes it a lot easier. Because when you do development, you wanna try to move something from point a to point b. But if you wanna try to move it like depth wise, you have to like rotate the camera a bunch in the simulator and it gets all awkward. So it's, like, easier if you have a device, which, you know, is like a lot of people out there.
嗯,有道理。那我的演讲主题也很小众,只是类型不同而已。我讲的是TextRenderer,也就是如何用SwiftUI文本制作特效。
Yeah. Fair enough. Well, my talk was equally niche, but different kind of niche. Mine was on TextRenderer. So how to make special effects with SwiftUI text.
基本上就是如何尽可能快地耗尽电池电量。效果非常酷炫,我们做了一些很花哨的效果,重现了早期Microsoft Office的一些WordArt效果。我甚至引入了一些Metal,并发布了一个新的开源项目,叫做Prismic。
Basically, how to burn through battery life as fast as possible. It was very, very cool. We made some fancy effects. We recreated some WordArt effects from early Microsoft Office stuff. I even brought in some Metal and released a new open source project called Prismic.
现在它已经在GitHub上了。我们会把链接放在节目备注里,大家可以通过这些方式去试试看。
It's on GitHub now. We'll put the link in the show notes and so forth so folks can try it out.
我很喜欢这个。Try Swift已经发布了多少个框架?
I love that. Try Swift has now been you've released how many frameworks here?
嗯,两年了,连续两年发布了两个。没错吧?我现在正保持着连胜纪录呢。
Well, it's it's two years. Two in a row. Two. Right? I'm I'm on a streak.
是啊,那么明年这个时候,你得再回来等着看Paul要宣布什么了。
Yeah. So it's next year. You'll have to come back and just wait to see what Paul announces.
哦,我的家人会非常喜欢这样的。我们都非常喜欢日本。现在我们在观众席点头微笑呢。我们太喜欢日本了,所以我们来这里旅行。
Oh, my family would love that so much. We we love Japan so much. Well, we're in an audience nodding and smiling right now. We love Japan so much. We come here.
我们去吉野居酒屋,我们去温泉,我们去电子游戏厅,我们还去动漫商店。在这里我们可以连续两周不停地体验日本文化,他们肯定也会非常喜欢的。
We go to Yoshinnoi. We go to the onsen. We go to the video game arcade. We go to the anime stores. It's just nonstop Japan for, like, two weeks straight here, so they would like that very much.
那是不是说你看过Switch 2了?比如,看到发布的消息了吗?
Does that mean have you seen the Switch two? Like, saw the announcement?
我预定了两台,狡猾吧?我其实挺内疚的,因为有些美国的朋友现在还买不到。我是从一家英国本地零售商那里订的,然后收到了任天堂的邮件,说嘿,你玩了很多游戏啊。你知道的,我确实玩得很多。你在购买Switch 2的队列里排得很靠前哦。
What I've pre ordered, cunningly, two. I feel really guilty because some folks in The US can't get them yet. I ordered from a local UK retailer, and then I got the email from Nintendo saying, hey, you've played a lot of games. You know, I do, sadly. You're early in the queue to get a a Switch two.
所以我取消了第一台订单,现在我在任天堂的官方名单里,但我已经等不及了,超级兴奋。
So I canceled the first one. I'm on the official Nintendo list now, but I can't wait. I'm super psyched.
太棒了。我还没有,因为我没有Switch。哦,它在我想买的清单上,因为我想,嗯,我经常旅行,我可以考虑用这个。但是一直没买,我还买了Vision Pro。
Love it. I I haven't because I don't have a Switch. So Oh. It's it's on my list of things to get because I'm like, well, I travel, and I'm like, oh, I could definitely use this. But it was never I And I bought the Vision Pro.
我只是很遗憾我们的友谊这么短暂。好了。
I'm just sorry our friendship was so short. Okay.
我想是的,我们彼此彼此。
I guess so are we.
说到日本,你真的去过日本一些地方吗?你看过樱花吗?
Speaking of Japan, have you actually seen some Japan bits? Have you seen the cherry blossom?
看过了。至少我做过这件事。太壮观了,对吧?
Yes. Good. I did do that at least. It's remarkable. Right?
我看到了樱花,然后去了山里滑雪,那感觉太棒了。
It's I saw that, and I went to the mountains to go snowboarding, which was amazing.
是的。
Yes.
这就是为什么我来到日本,然后几乎每天吃拉面。
And that's why I came to Japan and eat ramen, like, every single day.
是的。在进入新闻之前,我必须问一下你,过去一年几乎每一集,米哈都会谈到她正在开发的应用程序的进展。完成了吗?
Yes. And before we go into the news, I've gotta ask you, almost every episode for the last year, Mihael has talked about the progress of the app she's building. It's done?
它没有实现,而是变成了FruPartition(令人沮丧的分割)。
It instead of coming to fruition, it has come to FruPartition.
所以还没完成?
So it's not done?
它现在处于TestFlight测试阶段。我已经提交到App Store,但苹果审核团队偏偏选择了我应用中尚未编写代码的那一部分路径。我知道那里还没有编码,但我心想,好吧。屏幕上有一个大按钮,还有一个箭头指向这个按钮。我想,点这个就行了,但他们没这么做。
It's in test flight. It's I submitted it to the App Store, and Apple review team decided to take the one path in my app I have not coded. And I know that I haven't coded, but I was like, okay. There's a big button on the screen and there's an arrow pointing to the button. I'm like, tap this one, and they didn't.
他们点了另一个。所以目前算是完成了一半,因为它已经上线TestFlight。现在每个人都可以下载了。我会把链接放在我们的节目备注里,我展示的时候也提到了。欢迎来Discord找我。
They tapped the other one. So it's halfway there because it's in test flight. So everyone can download it now. I'll put the link in our show notes too, and it was on my presentation. Hit me up on Discord.
我可以发布链接。除此之外,基本上差不多完成了。
I can post it. But other than that, like, it's sorta there.
我希望最终剪辑这一集中能听到悲伤的womp womp号声。
I wanna hear a sad womp womp trombone in the final cut of
这集。
this episode.
记得我们之前那段悲伤而富有成果的小号声,我们就这么称呼它好吗?好的。让我们聊聊一些新闻。当然,这次最大的新闻就是WWDC 25,现在这里来了很多相关人员。
Remember the sad fruitful trombone we'll call that, shall we? Okay. Let's talk about some news. Of course, the biggest news this time is dub dub d c 25. There's a bunch of folks here right now.
谁今年拿到了票,dub dub?一个、两个、三个。三个?很好。谁今年申请了票?
Who got a ticket, dub dub this year? One, two Three. Three? Good. Who who applied for a ticket this year?
好的,实际上有很多人申请。是的。我觉得今年要进去不容易。我想随着我们离疫情越来越远,每次都有更多的人申请。
Okay. Quite a few, actually. Yeah. It's it's not easy to get in this year, I think. I think as we're increasingly further away from the pandemic, more folks are applying every time.
如果你有票的话,做得好。我拿到了一张。你拿到票了吗,Nikayla?
Well done, if had a ticket. I I did get one. Did you get one, Nikayla?
我没有拿到票,所以我需要悲伤的长号声。
I did not get one, so I need the sad trombone.
忧郁的长号声可以再回来一次。天哪,有一集就是关于这个的,对吧?那是一段令人紧张的时间,因为你会开始看到,比如,凌晨三点的时候邮件来了,所有的录取邮件先到,然后拒信才来,于是不停地刷新页面,刷新,刷新,刷新。我会幸运吗?
The fretful trombone can come back again. Dear me, there's an episode about it, is it? It's a stressful time because, like, you start seeing you know, it's, like, 03:00, I think, comes in the emails, and all the acceptance emails come first. Then the rejection emails come in, and so refresh, refresh, refresh, refresh. Am I lucky?
这并不愉快,但至少我们现在已经过了那个阶段了。
It's not pleasant, but we're past that now at least.
是的。所以我只能不断截图显示我没有拿到票,希望有一天能突然弄到一张票。
Yeah. So I just have to continually screenshot me not getting a ticket, and then hopefully one day that'll manifest itself to, like, procure a ticket out of nowhere.
忠诚卡。对吧?常旅客里程。你申请的时候正是这样。没错,你的坚持最终会换来一杯免费咖啡之类的东西。
Loyalty card. Right? Frequent flyer miles. You apply Exactly. Your life, it eventually adds up to a free coffee or something.
没错。就应该是这样的。
Exactly. That's that's how it should work.
不过还有第二轮。
But there is also round two.
还有第二轮。第二轮的意思是他们会公布所有获得门票的人名单,但有时由于某些原因,有些人最终没有收到或无法接受这张门票。他们可能无法参加。所以会有一个第二轮通知说,哦,实际上你确实获得了门票。希望我们能收到这样的通知。
There is round two. So round two is like they announce all the people who got tickets, but sometimes people end up not getting or not accepting that ticket for whatever reason. They can't go. So there will be a round two that says, oh, actually, you do get a ticket. So hopefully, we'll get that.
否则的话,偶尔还会有第三轮。到时候我们再看吧。
Otherwise, every so often, there's a round three. We'll see though.
是的。如果你真的拿到了门票,你现在可以期待的是至少三天苹果官方的活动。周日开始是一个持续四小时的大型无限循环特别活动,有游戏、交流、食物、饮料、冰淇淋等等,还有许多与苹果员工击掌庆祝的环节。所以如果你有点内向,这可能不太适合你,因为那里的人们都非常非常热情。然后当然了,周一在苹果园区还有一个特别活动。
Yeah. If you did get a ticket, what you can expect now is at least three official days from Apple. They start on Sunday as a massive infinite loop special event lasting four hours with games and mingling and food and drinks and ice cream and stuff and lots of high fiving from Apple people. So if you are a bit on the introvert side, maybe not for you because they are very, very happy there. And then, of course, on Monday, there's a special event at Apple Park.
那就是他们举办主题演讲的地方。那里设有实验区,还提供早餐和午餐。苹果园区还有参观活动。抱歉,Mikaela。
That's where they'll have the keynote. They have labs. They had breakfast and lunch there. There are tours at Apple Park. Sorry, Mikaela.
不是为你准备的。不,他们已经参观过苹果园区了。你可以去主园区彩虹旁边的草坪上休息一下。去年的活动持续到很晚。
Not for you. No. They've toured Apple Park. You can go and get a pitch next to the rainbow in the main Apple Park area. And there's last year, went on really late.
还有晚餐活动。
There was dinner stuff too.
是的。一直持续到下午六七点以后。比如,是的。有些活动发生在周一晚上,人们无法参加。但是周二也有些活动,整个白天都有。
Yes. It went to, like, six or 7PM into everything. So, like Yeah. Some events happened Monday night and people couldn't attend. But then, like, Tuesday, there were also some events, like, the entire day.
所以这是拥有门票的情况。但如果你是那些幸运没有拿到门票的人之一,那就意味着你不会被这些活动所束缚,可以自由地去参加很多不同的活动。今年,我们将组织一个名为Community Kit的新活动。这将由我和Paul以及社区的一些其他人共同组织,它将成为一个聚集地,可以一起参加不同的活动,与不同的人交流。
So that's like if you have a ticket. But if you're the lucky ones who don't have a ticket, that means you're not tied to all these events and you can kinda go to a lot of different things. So this year, we are putting on community kit, which is a new event. So that will be by Paul and I and some others from the community. It's going to be a place to come together and actually go to different events and talk to different people.
我们会安排一些组织好的活动,但也可以随时过来跟大家随便聊聊。
So we'll have a couple, like, hosted events, but then also just, like, come and just chitchat with people.
是的。如果你没拿到门票,那周还有很多精彩的活动,事实上那周会非常忙碌。第一个活动是在WWDC之前周六晚上的活动。然后是周日,整天都是社区活动。
Yeah. If you didn't get a ticket, there's so many amazing things happening that week. It really is very busy. The first event took place Saturday night before dub dub. Then Sunday, basically all day were community events.
周一有社区活动,周二有社区活动,周三也有社区活动。日程非常紧凑。我们之后可能会再详细讨论一下。
Monday were community events. Tuesday community events. Wednesday community events. It's extremely packed. We'll talk about it more later perhaps on that one.
但社区套件的举办地点就在库比蒂诺市中心主街附近,如果你熟悉这个区域的话,那里有一家很棒的Phil's Coffee咖啡店,步行一分钟就到了。所以我们希望看到很多人前来参加,无论有没有金票。来交朋友吧,来见面、闲聊、了解VisionOS,并尝试一些Swift数据。
But community kit, we've got a venue right in the middle of Main Street Cupertino near, if you know the area, has a very good Phil's Coffee there. It's a one minute walk from there. So we hope to see a lot of folks come by with or without a golden ticket. Just come and make friends. Come and meet, hang hang out, learn about VisionOS, try some Swift data.
有什么新内容,我们都会在那里讨论。接下来的内容。
Whatever's new, we're talking about it there. Next up.
接下来是刚刚发布的Swift 6.1。大家都知道大家都在关注Swift并发方面的更新,其中也包括了一些这方面的内容。此外还有一些小的改进,比如提升使用体验的功能。例如,你可以在数组中添加尾随逗号,而不会产生错误。这简直太棒了。
Next we have Swift 6.1, which just released. So, you know, everyone's watching all the Swift concurrency things, but there's some of that. But also, some little, like, quality of life improvements. Like, you can add a trailing comma in arrays, and it won't produce an error. It's amazing.
鼓掌。掌声。
Clap. Claps.
那些想为此鼓掌的人基本上会想到,当你有一个数组的时候,比如你知道的,一个逗号 b 逗号 c 逗号 d 各自成行。如果你重新排列数组,它基本上会惹恼像版本控制这样的小问题。或者如果你在下面添加另一个元素,也会让版本控制不爽。所以在里面加个尾随逗号就能轻松解决这一小小的版本控制烦恼。虽然只是一个微小的改动,但我很高兴他们做了这个改动。
The the folks who wanna clap for that are thinking, basically, when you have, like, array of things, you got, like, you know, a comma b comma c comma d as lines by themselves. If you rearrange the array, it basically annoys small things like source control. Or if you add another one below it, it annoys source control. So having like a trailing comma in there just reaches one little source control annoyance very easily. So in a tiny change, I'm glad they made it.
没错。他们还做了一些Doxy的更新。比如,你如何引用不同的文档。如果你有相同的功能,但它用不同的参数进行了重载,他们在那方面也添加了很多新的功能。
Yeah. And they've also done things like Doxy updates. So, like, how you refer to different documents. If you have, like, the same function, but it's overloaded with different parameters, there's all sorts of stuff they added with that too.
没错。还有改进的Swift测试功能。在过去,当我们使用XCTest时,它是绑定到Xcode上的,对吧?所以每当新的Xcode发布时,就会带来新的XCTest功能。
Yeah. And improved Swift testing. So in the olden days when we had XCTest, it was kinda bound to Xcode. Right? So a new Xcode would come out with new XCTest features.
现在则是Swift Testing,它是开源的,并且在每年主要版本更新之外定期进行开发。因此我们现在看到了不错的Swift测试方面的变化。你现在可以在测试前后运行代码以进行设置和清理工作。同样,这是一个小小的使用体验改进,但我很高兴看到它的出现。
Now it's Swift testing. It's open source and being developed regularly outside of the major annual stream. And so we've seen good swift testing changes now. You can you can run code before and after your tests to do setup and tear down stuff. Again, small quality of life change, but I'm glad to see it.
还有一个新的任务组更改。如果你现在正在使用任务组,你会知道你必须为子任务指定确切的类型。虽然不是特别麻烦,但现在你不需要这么做了。Swift将正确地推断出来。所以这是在即将到来的重大变革之前的一些小小的生活质量改进,当然,更大的变化WWDC很快就要来了。
There's a new task group change. If you use task groups right now, you'll know you must specify the exact type for your children. Not a massive pain, but now you don't have to. It'll be inferred by Swift correctly. So small quality of life improvements ahead of presumably earth changing All the big changes Dub Dub coming up soon.
对吧?
Right?
是的。另外还有一个新的公告,他们发布了Swiftly 1.0。我很喜欢这个名字。如果你需要经常进行开发,或者你希望在持续集成(CI)环境中这么做,这就是在你的机器上安装不同版本 Swift 的方法。
Yeah. And we have, like, another new announcement is they announced Swiftly one point o. Love the name. And this is how you can install different versions of Swift on your machine if you're going to do that like regular development, but also you could do it in CI.
我想目前我们大多数人使用的是 macOS 应用 Xcodes,它可以非常快速地下载多个版本的 Xcode。我认为这是标准做法。而 Swiftly 就相当于 Swift 自己的版本管理工具。例如,如果你想获取工具链版本的 Swift,想尝试最新的 6.2 Nightly 来跟进最新动态,那么就用它。
So I think right now, most of us use XCodes, the macOS app, which downloads XCode itself, many versions very, very quickly. It's, I think, the standard way of doing it. And Swiftly is basically that for Swift itself. So if you're getting tool chain versions of Swift down, you wanna try a 6.2 Nightly, for example, to keep on track of what's coming. Boom.
使用 Swiftly。
Use Swiftly.
他们特别引用了官网的说法:Swiftly 是用 Swift 编写的,并且能够将自己更新到最新版本。因此,你可以理解为这是一个用 Swift 编写的 Swift 工具链,可以更新自己的 Swift 版本。希望不会出现某些循环问题的情况,如果有的话……
And they said, and I'm quoting specifically from the website, naturally, Swiftly is written in Swift and is able to update itself to the latest version. So you have like the Swift tool chain that is written in Swift that can update its Swift version. Hopefully, there's not a loop of something happening here if there's a
可能会出点问题。是的。最后一点。
possibly go wrong. Yeah. And finally.
还有好多会议呢。我们现在正处在 Tri Swift 大会期间。大家对各种会议的热情真是怎么都满足不了。接下来 Deep Dish Swift 将于4月29日举行,IOS Conf 在5月15日,Swift Craft 则是在5月21日。
So many more conferences. So we are currently at Tri Swift right now. Cannot get enough of all the conferences. Deep dish Swift will be coming up April '29. IOS conf is May '15, and Swift Craft is May '21.
所以其中一场在美国,两场在欧洲。如果你现在在日本的朋友,这正是你环游世界的机会。不过等来到东京,也可以来我们国家尝尝我们的食物。提前剧透一下,味道没那么好。
So it's one in The US and two in Europe. This if you're from Japan right now, folks, it's your chance to travel the world. But coming to Tokyo, you can come into our country and try our food. Spoiler. It's not as good.
你说的是 Swiftcraft 对吧?别这样,Josh。
You're talking about Swiftcraft. Right? You can't Josh
他是个好朋友,但说实话,Deep Fresh Pizza 不是我的风格。不过,是的。如果你是会议组织者,我们很乐意介绍更多的会议。我们乐于帮助大家参加活动,结识朋友并建立人脉网络。请随时联系我们,告诉我们相关信息。
is a good friend, but Deep Fresh Pizza is not my kind of style now, I'm afraid. But, yes. And if you're a conference organizer, we'd love to feature more conferences. We love helping folks go to events and meet friends and network there. So reach out to us and let us know.
我们接下来继续。
We'll continue next.
本期的主题是我们的WWDC实用攻略。马上就要开始了,虽然我没有门票,但依然会非常有趣。有很多很多活动。Paul 通常会在他的 GitHub 上建立一个名为 just dub dub dc 的仓库。
The theme that we have this episode is our tips for making the most of WWDC. So it's all coming up, and I won't have a ticket. But it'll still be super fun. There's so many so many things going on. Paul usually makes a repository called, like, just dub dub dc, on his GitHub.
它只是一个 README 文件,但它包含了所有活动的链接。所以你随时可以了解最新动态。
It's just a read me, but it has all the links to everything that's going on. So you can always find out what's happening.
给你看看我的门票会不会让你感觉好点?
Would it make you feel better to see my ticket?
不过还是谢谢你。
I thanks, though.
Robusty。我
Robusty. I
我不认为事情是那样运作的,但也许我们可以,比如,如果我能集中所有的能量,也许能实现。
don't think that's how it worked, but maybe we could, like, manifest it if if I get, like, all of the energy of it.
Dub dub d c。
Dub dub d c.
它就会像传过来一样。
It'll just, like, come over her.
没错。大家看,你们不必非得有一张金票。很明显,我觉得自己很幸运今年中奖了。但你们真的不需要一张。
Yes. Look, folks. You don't have to have a golden ticket. I'm obviously, I feel so lucky to have won this year. You don't have to have one.
有太多体验活动了。老实说,我运行着Meg Kelly在GitHub上提到的那个Git仓库。我们会在节目说明中放一个链接。这个仓库几乎每天都在更新,因为人们不断添加全球各地的活动信息。所以是的,有很多活动可以在库比蒂诺免费参加,比如Revenue Cat Barcade或者James Dempsey和Breakpoints之类的活动。
There are so many experience events. Honestly, I've run this Git repo that Meg Kelly mentioned on GitHub. We'll put a link in the show notes. And it's updated almost daily ahead of the June date as people add events around the world. So, yes, there are stacks in Cupertino to go to for free, like the Revenue Cat Barcade or the James Dempsey and the Breakpoints, whatever.
有很多这样的活动。但同时,世界各地也会有直播观看发布会等活动,包括日本、中国、新加坡、英国或法国等地区。有很多地方可以去。因此即使你没有门票,仍然可以与其他开发者见面,感受现场热烈的氛围。这非常有趣。
There's stacks of them, lots of them. But there are also livestream live watches Keynote stuff around the world, including here in Japan or China or Singapore or The UK or France. There's many to go to. So even without a ticket, you can still meet other developers and enjoy the live buzz, basically. It's a blast.
对吧?
Right?
是的,完全正确。而且几乎所有东西都是免费的。你可以去那里,当然你需要自己支付交通费、酒店住宿费以及吃饭等费用。
Yeah. A 100%. And else and also, almost everything is free. Like, you can go there. You kind of have to, you know, pay to get there and pay to have a hotel and food and everything.
但是你能参加的很多不同活动完全是免费的。里面有一些是收费的,但大多数只需要预订一张票来表明你会出席,因为它们是在某些场地举行的,所以需要预留位置。但你只要拿着你的免费票到场,跟大家聊天就可以了。随便聊聊,认识新朋友。
But a lot of the different events that you can attend are completely free. There's a few in there that are paid. But most of them are kinda just like reserve a ticket to show up because they're in some kind of venue and so they have to hold space. But it's you just show up with your like free ticket and chat with people. Just chitchat, meet new people Yeah.
谈论各种话题。你总能找到一些话题与每个人交谈,因为现在正值WWDC前夕。所以在大会开始前,你们可以讨论即将发生的事情;发布之后,你们又可以讨论刚刚发生的事。
Talk about all the things. You can always, like, find something too to talk about with everybody because it's dub dub time. So, like, right before dub dub, you're talking about what's gonna happen. Right after the announcements, you're talking about what just happened. Yeah.
所以即使你比较内向,不确定该跟别人聊什么,也可以提前准备一些问题。例如,直接问:你看过哪些会议内容?你喜欢哪些API?你以前去过加州吗?
So you can always, like, kind of find some common ground if you're, like, more introverted and, like, not sure what you wanna talk to everybody with. Like, have the questions in your back pocket. Literally, just be like, have you watched any sessions? What APIs did you like? Have you been to California before?
总有一些话题能让你轻松地开启对话,毕竟跟陌生人交谈总是有点奇怪和尴尬的。
There's always something to, like, kind of easily, you know, get the conversation going because it is weird and awkward talking to somebody that, like, you don't know.
你会发现几乎每个人都来自外地。显然,只有少数苹果员工住在当地并在那里工作。其他几乎所有人都是从世界其他地方来的。所以很容易找到人聊天和一起玩乐。说实话,有些活动进行得非常快,比如去年Revenue Cat举办的Barcade派对或者Emerge Tools的饮品聚会。
What you'll find is almost everyone flies out of town. Like, a handful of Apple folks obviously lived there and worked there. Almost everyone else has come from somewhere else in the world. So looking for someone to chat and hang out with. And honestly, yes, some events go very quick, like the the Revenue Cat Barcade Bash or the Emerge Tools drink thing they had last year.
这些活动都非常棒。一定要去参加一下。不过这些活动很快就结束了。如果你还没看过我的仓库,请给它点个星,关注一下仓库的变化,因为变化真的非常快。
Wonderful events. Great events. Go and see them. They're very quick. So if you haven't seen my repository, put a little star, a little watch repository, look at changes because it's very, very fast.
那些活动的门票会非常快被抢光。iOS Dev Happy Hour聚会也是如此,对吧?
Tickets go extremely quickly for those. Same for the iOS Dev Happy Hour meetup. Right?
是的。去年我们举办了线下iOS Dev Happy Hour活动。这是我们唯一一年线下的活动,因为通常都是在线上每月举行一次。那次活动的门票在二十分钟内就售罄了,在我们还没来得及把消息发布到所有社交媒体之前就已经卖完了。当时我们还在发帖的时候,就开始收到私信说,嘿。
Yes. Last year, we have iOS Dev Happy Hour in person event. So it's the one year we come in person, all get a talk because normally it's online and it's monthly. Those tickets sold out in, like, twenty minutes, and they sold out before we were done, like, posting to all the social medias. We were, like, in the middle of posting and already we started getting DMs saying, hey.
门票已经没了。我们当时还奇怪,什么你说门票没了?你是不能注册了吗?还是有什么问题?他们说不是。
The tickets are gone. And we're like, what do you mean the tickets are gone? Like, you can't register? Like, there's an issue? They're like, no.
他们的意思是门票真的卖完了。于是我们登录系统一看,一百张左右的票在二十分钟内就被抢空了。所以你必须先注册,但即使这样,很多活动还是要进候补名单,因为有些人不会来,他们无法参加。如果你进了候补名单,那么当其他人退出后,你就有可能进去。
They're, like, gone. So we, like, went and logged in and all of them were like, a 100 some tickets were gone in, like, twenty minutes. So you have to register first, but, like, still get on the wait list for a lot of things because people don't show up, then they can't go. It's like if you get on the wait list, then you can get in after some other people have also, like, declined.
不过你们现在就在现场,Mikaela也在。她拿着一个装着几千日元现金的牛皮信封,可以早点进场。朋友们,那就是你们的机会。
But you folks are here live right now. Mikaela's here too. A nice brown envelope full of a few thousand yen. You can get early in there. Know, that was your chance, folks.
如果我是你们的话,我就会这么做。顺便说一下,并非所有活动都是免费的。例如每年James Dempsey和Breakpoints都会表演,这是一场很棒的活动。这是一场音乐演出,来自Swift社区的很多人会在舞台上演奏乐器,演唱关于iOS和Swift之类的歌曲,我们这些极客们则作为观众出席。这场活动并不是免费的,因为所有的收入都会捐给当地的慈善机构。
So I would do that if I were you. Not all events are free, by the way. For example, every year, James Dempsey and the Breakpoints perform, and it's a wonderful event. It's a a musical event with various folks from around the Swift community playing instruments on the stage, songs about iOS and Swift and similar, and a bunch of geeks like us attend as the audience. And it's not free, but that's because all the money for that goes to local charities.
我记得这个活动已经持续了很多年,也非常受欢迎。是的,我想我今年也会赞助。很期待这次活动,挺好的。
It's been taking place for as long as I can remember, so that was also very popular. Yes. I think I'm sponsoring this year too. Just looking forward to that. It's good.
还有Talk Show Live,对吧?Gruber的那个活动。
And there's talk show live. Right? Gruber's thing.
没错。Talk Show Live,John Gruber主持,过去几年都是现场直播的。是的,每次看都很震撼。
Yep. Yeah. Talk show live, John Gruber, that was live the last couple years. Yeah. It's always amazing to see.
比如前年那一次,Craig还在台上弹吉他,真是令人惊叹。所以有很多精彩的活动正在进行中。如果你觉得无聊,你可以去参加各种不同的活动。如果你不想一直跟人聊天,也可以找个地方放松一下,比如Community Kit区域。我们也会营造更轻松的氛围,这样你不必整周都在不停地交谈。
We saw a year before last, it was Craig was, like, on stage playing the the guitar and amazing to see. So there's so many just things happening, things going on. Like, if you're bored, you can just go out and go to all these different things. If you don't wanna, like, chat with everyone, you can go, like, chill somewhere, community kit. We're gonna have it more, like, laid back too so you don't have to, like, actively be talking the entire week.
但就是非常有趣,可以随便和别人见面,一直聊整整一周的开发相关话题。
But it's super fun to just, like, hang out and meet other people and just, you know, talk about development for, like, a whole week the entire time.
我很惊讶你们已经跟Federigi sama以名字相称了。哦,Hair Force One,紧致团队配紧身牛仔裤。是的,那个银发帅哥。
I'm very impressed you're on first name terms of Federigi sama. Oh, Hair Force One. Tight team with tight jeans. Yeah. The silver fox.
无论如何,重点是要充分利用这个机会,只要出现并参与其中,因为大家对即将发生的事情以及刚刚发生的事情都感到非常兴奋。老实说,如果你认识在苹果公司工作的朋友,就直接在社交媒体上给他们发个信息,问问他们要不要一起喝杯咖啡。因为说实话,他们见到我们的机会和我们见到他们一样少,他们也非常期待与开发人员见面。
Anyway, the point is that to make most of it, just turn up and hang out because folks are so excited about what's to come, what's just happened. And honestly, if you're able to, if you know Apple folks who work there, just ping them on social media saying, hey. Do you want me to some coffee? Because honestly, they get to meet us as rarely as we get to meet them. They are super psyched about meeting developers.
这就是为什么他们会参加像iOS欢乐时光、营收峰会晚宴以及emerge工具相关的活动。他们来这些地方就是为了与我们这些开发者见面。所以他们很乐意了解你是如何使用他们的API的。哦,你在做这个?哇。
That's why they come along to things like iOS of happy hour and the revenue cap barquet and the emerge tool stuff. They come along there to meet us as developers. And so they'd love to see how you're using their APIs. Oh, you're doing this. Woah.
别那样做。随便吧。对他们来说这是很好的反馈,对吧?他们和我们一样喜欢这样。所以至少,你只需要到场。老实说,你会发现有一群人正朝着正确的方向前进,充满活力,有很多有趣的事情可做。
Don't do that. Whatever. It's good feedback, right, for them, and they they love it as much as we do. So at the very least, just turn up. Honestly, you'll find sort of a a tide of people taking in the right direction full of buzz and and fun things to do.
这也是提交所有反馈的最佳时机。因为当你尽早提交反馈时,他们可以在正式发布之前,在测试期间修复这些问题。
And it's the time to file all the feedbacks. Because when you file feedbacks early, they can then fix them within like that beta period before everything like goes out officially.
是的。
Yeah.
告诉他们你向他们提交了反馈,他们会很高兴的。
It's like, tell them you filed a feedback, like, at them. They they do like it.
哦,是的。我想大家可能没有完全意识到这一点。我们知道,今年第一个种子测试版beta一通常是在六月的某个时候发布,对吧?我想是的。大概是星期一,6月的某日。
Oh, yeah. So I don't think folks realize that fully. We get, you know, the first seed drop beta one on, you know, June this year, is it, I think? Yes. Monday, June the I think it is, approximately.
但他们工作进度超前很多,那时他们已经在为beta三版本收尾了。所以如果你在beta五中提交反馈,这个问题很可能不会在9月的正式发布版中被修复。除非是一些严重的崩溃或iCloud问题,否则不会被修复。因此,为了最大限度地获得修复的机会,请尽量在最初的两到三周内提交你的反馈。
But they work so far ahead, they're sort of putting the finishing touches to beta three at that point. K? And so if you if you file feedback in beta five, it is not gonna be fixed for the September release date. It's just not unless it's like some massive crashing iCloud problem, it won't be fixed. So file your feedbacks ideally in the first sort of two weeks, maybe three weeks, to maximize your chance of being fixed.
最后,是的。这是我的号码。如果给他们一个打印件说,请帮我修复我的反馈。这会带来很大帮助。我们的公开投票。
In the end, yes. Here's my number. If give them a printout saying, please fix my feedbacks for me. It goes a long way. Our open ballot.
所以每集节目里,朋友们,我们都会提前向观众提出一个问题。而这次我的问题是,你在苹果平台之外是如何使用 Swift 的?无论是用在服务器上还是嵌入式 Swift 或者其他地方?我们收到了很多回复。第一个回复,通常我会简化名字,抱歉,来自 Alexandre Wavon。
So every episode, folks, we ask the audience a question ahead of time. And this time, my question was, how are you using Swift outside of Apple's platforms? Whether that's on a server or embedded Swift or somewhere else? We got a whole bunch of responses here. The first one, and I usually mince the names, apologies, is from Alexandre Wavon.
他说,我用它为我的 iOS 应用构建了一个小型网关服务器。这个服务器充当了 TMDB(电影数据库)的代理。对吧?没错。所以我打算将 API 密钥打包在应用本身中。
He said, I use it to build a small gateway server for my iOS app. The server acts as a proxy to TMDB, is the movie database. Right? Yep. So I am gonna bundle my API key in the app itself.
我是用 Swift 和 Vapor 构建的,然后加入了苹果的设备检查功能来验证请求。另外,非常感谢 Mikayla Karen,因为她关于将 Vapor 部署到 fly.io 的视频提供了巨大帮助,让整个设置过程变得非常顺利。
I built it with Swift and Vapor, then added in Apple's device check to validate requests. Also, big thanks to Mikayla Karen because her video on deploying Vapor to flyo.i0 was a huge help and made setup super smooth.
我很喜欢这一点。是的。你太棒了。谢谢。很高兴能做一件事。
I love that. Yeah. You're the best. Thank you. Happy to can do one thing.
我没有获得门票,但至少我可以部署 Vapor。是的。通过这种方式,使用苹果的设备检查功能非常酷,它可以让你验证请求是否确实来自你的应用、你的服务器,而不是把你的 API 密钥放在自己的 iOS 应用中。这样别人就可能反编译你的应用,或者破解它,然后找到你的 API 密钥并发起请求。现在很多随机 AI 应用都存在这个问题。
I don't get a ticket, but at least I can deploy Vapor. But yeah. With that, it's super cool that, use Apple's device check, which allows you to, like, just validate that the requests are coming from, like, your app, your server, and not putting your API key in your own iOS app. So then somebody can just, like, you know, destruct your app or, like, break it and then, like, find your API key and then make requests. That's a big thing that's happening with a lot of, like, random AI apps.
但是你可以通过使用服务端 Swift 和 Vapor 来解决这个问题。
But you can fix that problem by using server side Swift and Vapor.
听起来好像这里几乎可以用 Swift 为你自己的应用编写代码,然后发现,其实不行。这部分应该放在别的地方。你基本上可以使用相同的代码,放到别的地方,然后加入 Vapor 并删除请求处理程序。
It sounds like here, almost, you could build your code, like, for your app in Swift, and then go, actually, no. This wants to be somewhere else. You'll get out same code pretty much Yeah. Somewhere else, and then add in Vapor and delete the request handler.
是的,基本上就是这样。因为当你全部用 Swift 编写时,可以在你的 iOS 应用和 Vapor 应用之间共享代码,因为大部分逻辑和内容都是完全一样的。当然,有一些东西是特定于 iOS 或 Vapor 的。但其中一个重要点是你能够共享模型。
Yeah. Basically. Because you can share code between your iOS app and your Vapor app, when you write everything in Swift, because most logic and stuff is all the exact same. You have a couple things that are specific, of course, to iOS or to Vapor. But then, like, one of the big things is you can share the models.
因此,从一端发送、另一端接收的数据传输对象可以直接作为一个 Swift 包进行共享,导入到两个项目中,你就无需重复编写两次。
So the data transfer objects that you write from one side to the other of send this one, receive this one. Just share that as a swift package, import it into both of them, and you don't have to write it twice.
我听到有人提到了贾斯汀。照我说的做,你会没事的。总之,是的,Michael Kritt 说:'我一直在使用 Skip 工具来构建一个 Android 应用,而且是用 Swift 开发的。' 实际上 Michael 还补充道:'Skip 出人意料地稳健。'
I heard the word Justin there. Just do this You'll be fine. Anyway, yes. Michael Kritt says, I've been using Skip tools to build an Android app with Swift. And Michael actually added, Skip is surprisingly robust.
我建议大家尝试一下。所以,朋友们,很明显我很喜欢 Swift,对吧?我想没人会怀疑我有多么喜欢 Swift。但在跨平台开发方面,我有点犹豫不决。
I recommend giving it a try. So look, folks, I obviously love Swift. Right? I don't think anyone doubts how much I like Swift very much. I'm on the fence a little bit when it comes to cross platform work.
比如,当有人使用 React Native 来开发 iOS 应用时,我们并不是特别喜欢这种方式。感觉不太对劲。或者当你使用谷歌地图应用或 Gmail 应用时,它们感觉有点奇怪,因为它们有自己的一套 UI。是的,就是那种材质风格。
Like, we don't particularly like it when someone uses React Native to build iOS apps. So, like, it doesn't feel quite right. Or if you use the Google Maps app or the Gmail app, it feels a bit weird because they have their own UI. Yeah. The material.
材质风格。没错,就是它。这些应用并不完全像原生应用那样自然,对我们来说总有些怪异。
Material. That's the one. Yeah. It doesn't feel they feel native fully. It feels a bit odd to us.
所以在其他地方也这样做的话,坦白说,我还没试过 Skip Tools。也许他们能够完全适配,真正使用 Swift 编写实际的原生控件。
And so doing that same thing elsewhere, I haven't tried Skip Tools, mind you. Maybe they adapt fully to have actual native controls just written in Swift.
我相信现在有一个 Swift on Android 的工作组,而 Skip Tools 也将成为其中的一部分。因此,将 Swift 拿来在 Android 上编写正在逐渐变成现实。但是,我非常有兴趣了解,这种跨平台的方式在 Android 上的实际体验如何,或者 Android 用户是否根本不在乎这些。
And I believe there is a Swift on Android work group, and skip tools is going to be a part of that too. So, like, it is becoming a thing of taking Swift, writing it on Android. But, yeah, I'm very interested to see on, like, what is how cross platform y does it actually feel on Android or, you know, if Android users just don't care.
哦,这可以作为一集的主题。不如这样,如果 Skip Tools 正在收听的话,请给我们发送一个月的许可证,然后我们俩一起用 Skip Tools 开发一个小应用怎么样?
Oh, that'd be the episode theme. How about we ask Skip Tools, if they're listening, send us a, like, a one month license, and we both build a small app Oh. With Skip Tools.
我得抽时间做这个才行。
I have to find time for that.
嗯,滑雪板玩得太多了。
Well, too much snowboarding.
是的,这就是为什么我来到日本的原因,还有参加会议。
Yes. That's why I came to Japan. And the conference.
来到日本,更多尝试撕开东京,碰巧是脚趾滑雪。
Came to Japan, more tries to rip Tokyo, happened to be toe skiing.
就是这样,就是这样,没错。
That's it. That's it. Yeah.
没错。不过我喜欢这个想法。Skip Tools,如果你在听,请告诉我们。和我的经纪人谈谈。
Yeah. I like the idea though. Skip Tools. If you're listening, let us know. Talk to my agent.
Smith Schmidt说,服务端Swift百分之百。这是一个伟大的服务端开发语言,在macOS上开发并部署到Linux,支持x86和ARM 64架构。
Smith Schmidt said, server side Swift 100%. It's a great language of server side development developing on macOS deploying to Linux, both x 86 and ARM 64.
是的。它最棒的地方在于Swift通常是一种苹果平台的语言,但你可以在macOS上编写代码,然后部署到Linux上运行。你可以直接编译实现这一点。有一些WWDC视频也讲到了相关内容,我相信他们在服务端Swift会议上也谈到了如何做到这点。另外,如果你使用Docker,也可以用来测试所有内容。
Yes. It's you what's so nice about it is that Swift, you know, is generally an Apple platform language, but you can write your code on macOS and then deploy on Linux. So you can just compile it to do that. There's a couple dub dub videos on that, and I believe they spoke at server side Swift on how to do that too. But then also, if you're running Docker, you can do that as well to test everything too.
因为Foundation中有些功能只能在macOS上使用,而你直到上线生产环境才会发现这个问题,然后你会说哦,这行不通。你可以先在macOS上运行你的代码,再将其部署到运行Linux的Docker容器中,这样就能提前发现问题,哪些能用,哪些不能用。或者就直接上线看看会发生什么。
Because you have some things in Foundation you could only use on macOS, and you won't find that until you hit production. And you're like, oh, that does not work. So you can kind of like fix that a little bit by first running your code on macOS, deploying it to Docker that runs Linux, and then kind of see what works, what doesn't. Or just send it. See what happens.
这就是终极的bug测试对吧?就是如此,我们继续吧。
That's the ultimate bug test. Right? Just It is. Let's go.
好,会没事的。就像你已经精心培育了它,应该没问题。
Good It'll be fine. Like, you you've nurtured it. It'll it'll be okay.
如果你还不知道的话,Sven与davewer一起维护着Swift Package Index(Swift包索引),这是一个庞大的GitHub Swift包收集和索引项目,从GitHub读取数据展示出来,还提供诸如显示readme、Swift版本等信息。里面包含大量信息,而且他们还在后台实际构建这些项目。他们用Swift本身做了大量的工作。因此,他们可能是最大的公开Swift使用者。我是说,我知道亚马逊也在内部使用Swift,显然苹果自己也在内部使用,但我认为他们是最大的公开用户。
If you don't know, Sven runs with davewer, the Swift Package Index, which is a gigantic collection indexing GitHub for Swift packages, reading the data out from there onto screen, but also doing things like showing the read me, showing the Swift version, and more. There's stacks of information in there, plus they actually build the projects too behind the scenes. They're doing stacks and stacks of work there with Swift all through Swift itself. So they're probably the biggest open user of Swift. I mean, I think Amazon use it behind the scenes, and obviously Apple use it behind the scenes, but I think they're the biggest public user of Swift.
总之,去看看他们的项目吧:Swift Package Index。接下来,Morten Beck Detlevsen说:“我和我女儿正在使用嵌入式Swift在一个ESP32-C6上制作一个小游戏设备,希望我没念错型号,是ESP32-C6。Mikaela,我知道你,你是ESP32-C6的忠实粉丝。”
Anyway, check them out. Swift Package Index. Next up, we have Morten Beck Detlevsen saying, I'm making a small game device with my daughter using embedded Swift on an, I get this right, an ESP 32 c six. I know you, Mikaela. I'm a big fan of the ESP 32 c six.
我听说这是一个
I've heard it's a
不错的产品。
good one.
是的,特别是Frank说的这个,没错,就是它。
Yeah. That's that's particularly Frank Yeah. That one.
Frank竖起大拇指了,这确实是个不错的选择。
Frank said thumbs up. It it's a good one.
说实话,我之前从没听说过这种设备。我想它应该是一个小型的嵌入式Swift设备吧。
I'll be honest more than I have never heard of one of those. I guess it's a small embedded Swift device.
因为嵌入式系统有很多不同的处理器类型。所以你可能只能在某些处理器上运行Swift,而其他则不行。我不清楚哪些可以哪些不行,但他说的那个确实不错。
Because embedded has a bunch of different, like, processors, basically. So you may or may not be able to run Swift on some of them versus others. I don't know which ones you can and can't, but that one, that's a good one.
对,实际上,Frank就在观众席里,而且他给我们留言了。Frank,如果你还不知道的话,他是我们的老朋友,我们非常喜欢他。Frank开办了Embedded Swift研讨会。
Yeah. Well, actually, so Frank's in the audience, and Frank wrote in. So Frank, if you don't know, Frank's a friend of the show. We like him very much. So Frank runs Embedded Swift Workshops.
他在这里写道,我会把它放到屏幕上。他说除了通常的平台(比如macOS和iOS),他在实际工作中还专业地将Swift用于服务器端项目,这太棒了。这意味着这里面是有商业价值的。另外,他业余时间研究嵌入式Swift,所以他才知道ESP 32 C6是什么东西。
He actually wrote here. I'll put it on the screen here. He said, besides usual platform, which is macOS and iOS case, in his case, he uses Swift on the server professionally for client projects, which is awesome. So there's money there, folks. And embedded Swift as a hobby, which is why he knows what an ESP 32 c six is.
他有很长的后端开发背景,使用Java和Swift进行Web开发,这让他能够充分利用自己的经验,并使用自己热爱的语言,真是太棒了。对吧?因为你可以在任何地方使用Swift。
He has a long time back end background with web objects in Java and Surfside Swift, which lets him capitalize on the experience and use the language he loves, which is fantastic. Right? Because you can use Swift in the everywhere.
没错,而且好处是你必须编译所有内容。因此当你真正将其部署到生产环境时,它的运行速度非常快。这也是为什么它适合嵌入式系统的原因之一,因为嵌入式设备需要比普通的iOS应用或者从服务器获取JSON数据要快得多。
Yes. And it's what's nice is you gotta compile everything. So you have to compile it. And then when it actually is running in production, it's super fast. And that's what really makes it work for embedded because embedded things have to go so much faster than, like, your basic iOS apps and, like, you know, fetching JSON from a server.
嵌入式设备基本上是一直在运行的,所以速度是非常关键的。
Embedded is, like, kind of always running, so the speed is, like, essential.
是的。实际上他们在诸如类型化抛出(typed throws)方面做了很多工作,这在将 Swift 引入更小空间时帮助不大,因为整个类型混乱的问题是个麻烦,但现在这个问题已经不存在了。我认为苹果更大的目标是尝试让 Swift 进入他们能想象到的所有可能的地方。例如,你 Mac 上的安全飞地(secure enclave)未来可能就可以运行 Swift。
Yeah. Yeah. They've done a lot of work actually with things like typed throws, which weren't weren't very helpful for getting Swift into smaller spaces where the whole type of rage thing was a problem and that isn't. I I think Apple's bigger goal here is try and get Swift into every possible thing they can imagine. Things like, you know, secure enclave in your Mac, for example, could run Swift in the future.
有趣的是,弗兰克(Frank)最后提到他用它制作基于微控制器的个人家庭自动化小工具。我想如果我这么做的话,可能会被离婚。她会说不行。我家里的人都会抱怨,什么都没法用了。灯为什么又不亮了?不是吗?
Now interestingly, Frank ends by saying he uses it to make personal microcontroller based gadgets for home automation. I think if I did that, I would probably get a divorce. So she was like, no. I could my family would go, nothing works anymore. None of the lights why is the lights not working, wasn't it?
然后我会被赶出家门。那可一点都不好玩。无论如何,接下来我们有 Sean Robinson 说,我正在开发一个用于嵌入式 Swift 的应用的早期阶段。我正试图让自定义硬件、应用程序和服务器都使用 Swift。我计划在这三个平台之间共享代码。
And then I'd I'd be kicked out of the house. It wouldn't be much fun. Anyway, next up, we have Sean Robinson saying, I'm in the early stages of developing an app for embedded Swift. I'm trying to get a custom piece of hardware, app, and server all with Swift. I plan on sharing code between all three platforms.
你可以做到的。这就是重点。你能。相信自己。你可以尝试。
You can do it. That's the thing. You can. Believe. You can attempt it.
我还没看到太多关于完成所有工作的例子,比如 iOS、嵌入式和后端。看,这时候你可以把模型打包起来,在这些所有组件之间共享模型,因为它们都需要完全相同的模型。这可能是这一切的起点,而且像这样的共享逻辑也是可能的。当你写一些不针对任何特定平台的代码时,比如对你的模型进行某种处理,这种代码可以轻松地在所有地方共享。
I haven't seen too many examples of, like, doing all of what was it? IOS embedded and the back end. Like, see, this is where you would bake a package of just your models and share your models between all of these pieces because the models will be exactly the same for them all. And that would probably be the start of all of this, but, like, shared logic is possible too. So when you write something that's not specific to any of them, but it's do doing some kind of processing, for example, of your models too, that code you can just ease easily share between everything.
容易吗?容易。你只需要共享就可以了。
Easily? Easily. You just share it.
只要共享就行。按下按钮就行了。就像以前 Catalyst 功能一样?只要按下加号按钮,添加 macOS 支持,它就能正常运行。
Just share it. Just press the button. It's like the old was it a catalyst thing? Just press the plus button, add macOS. It's just gonna work.
做到了吗?它就正常运行了。
Did it? It just works.
它就正常运行了。在这种情况下,“just”这个词有不同的含义。我的意思是,它只是勉强能运行而已。没错。
It just works. Has a different meaning of just in that sense, I think. It only it just about works. Yes. Yeah.
显然,共享代码非常棒。这意味着更少的时间浪费,更少的测试。如果你还能共享测试代码,那就更好了。但模型应该是排在第一位的,对吧?
I obviously, sharing code is fantastic. It means less time wasting, less testing. If you can share tests as well, even better. But models are sort of the first thing in line. Right?
因为它们没有附加UI。它们应该是完全可编码的。它们可以用于像Vapor这样的部署,通过Leaf进行模板化等等。这应该是一件容易实现的事情。而且你能将越多的逻辑放在这里越好,理论上剩下的只是你的UI在其他设备上个性化呈现。
Because there's no UI attached to them. They should be fully codable. They can go across to things like Vapor for deploying through Leaf for templating and so forth. They should be an easy thing to do. And the more logic you can get there as well, the better, leaving just in theory your UI being personalized across the rest of devices.
理论上是这样。
In theory.
理论上是这样。
In theory.
应该如此。接下来,Eric Barrios说,他终极的项目是在任何地方都使用Swift:用嵌入式Swift开发固件,用SwiftUI开发移动应用,后端使用Vapor,以及一些Web Assembly来处理网页UI中更高级的部分。我得提一下,Eric过去已经开源了很多相关工作。如果你看到他在Twitter上给我们的回复,你会发现他做了很多关于嵌入式Swift的开源工作,这是非常令人欣喜的。
Just should. Next up, we have Eric Barrios saying, my ultimate project is to use Swift everywhere. Firmware with embedded Swift, mobile app with SwiftUI, back end using Vapor, and some web assembly for the more advanced parts of the web UI. I should say Eric has open sourced a lot of work in the past here. If you if you see his reply to us on Twitter, he's done a lot of open source embedded Swift work, which is great to see.
Swift WebAssembly已经完全实现了吗?我想现在是了吧?
Is Swift WebAssembly fully there? I think it is now. Right?
是的。现在运行并完成所有这些操作已经成为可能,但我相信现在又成立了一个新的工作组,或者论坛上也新增了一个版块,专门讨论如何在WebAssembly方面做更多的事情。
Yes. It is possible to run and, like, do all of that, but there is, I believe, a new work group or there is also a section on the forums for, like, doing way more with WebAssembly.
太棒了。好的。对我来说,这感觉非常令人兴奋。我知道很多人已经用比如Python做过类似的事情,把Python移植到网络上,从而可以在随机网站上交互式地运行Python代码。而我们离真正优秀的在线Swift Playground已经非常接近了。
Damn. Okay. That that feels very, very exciting to me. I know a lot of folks have done things with, say, Python, for example, to port Python to the web so you can run Python code interactively on random websites and stuff. And we could be very, very close to an actually good online Swift playgrounds.
没错。那将会非常好,因为这也是人们不学习Swift或从事iOS开发的主要原因之一,即入门门槛太高。你需要一台MacBook,而这就要花费几千美元,仅仅是几台而已。但你必须拥有它才能开始学习这门语言和相关知识。然而,正如我们所知,Swift是一门通用编程语言。
Yes. That would be super nice because that's one of the top reasons, of course, why people, like, don't learn Swift or do iOS development is it's a high barrier to entry. You need a MacBook, and that's a couple thousand dollars, just a couple. But you have to get that just to even learn the language and, like, learn something. But, like, Swift, as we all know, is a general purpose programming language.
所以,像if语句、for循环等这些东西,在Swift中的写法与其他语言完全一样。但由于Swift主要与苹果有关,因此你无法测试任何东西。但如果能把它放到Wasm(即WebAssembly)中,并让它在网络上运行,那么对于更多人来说,进入这门语言并以不同的方式真正使用它就会变得容易得多。
So, like, if statements, for loops, all of that stuff is the exact same in Swift as it is in other languages. But because of how, like, Swift is all more Apple, then you can't test anything. But if you can, like, get it within Wasm, so WebAssembly, and have it on the web, it would make it so much more accessible to, like, more people of actually, like, getting into the language and really using it in different ways.
是的。显然,Swift过去是,现在仍然是苹果公司的技术语言,对吧?但苹果在过去一两年,甚至三年里一直努力改变这种印象,包括去年在伦敦公开赞助了Service Hide Switch活动,可能今年也是一样。在去年WWDC开发者大会上发布的State of the Union视频中,他们明确展示了类似这样的信息:你现在可以在Vim中使用Swift了。
Yeah. So Swift obviously was and still is technically an Apple language. Right? But Apple have been working so hard over the last year, two years, maybe even three years to change that perception, including sponsoring publicly Service Hide Switch in London last year, maybe again this year. At the Developer State of the Union video at WW last year, they featured very clear things like, hey, you can use it in Vim now.
你现在也可以在Versus Code中使用它。他们在努力传达这样一个信息:嘿,这不仅仅局限于Xcode、SwiftUI和iOS,Swift从一开始就是一门通用编程语言。但这其实是一个品牌定位问题,对吧?
Use it in Versus Code now. They're trying really hard to say, hey, this is not just Xcode and SwiftUI and iOS, but just use Swift as the general purpose language, always has been. But it's a it's a branding issue. Right?
没错。我们总是把Swift与苹果联系在一起,我想这种情况至少还会持续相当长的一段时间。不过他们已经发布了一个叫做SourceKit LSP的包,这样你就可以在任何支持LSP的语言服务器协议的编辑器比如Versus Code中运行Swift代码。
Yeah. Definitely. It's just we associate Swift with Apple, and, I mean, that's probably gonna be the exact same thing for, like, at least quite a while. But it's they make a package called, like, SourceKit LSP. So then you can run Swift all within, like, Versus Code or anything that uses LSP.
比如NeoVim之类的工具。有了这些工具,你可以直接运行你的项目,不需要依赖Xcode。除了iOS开发以及所有苹果平台相关的内容之外,我们讨论的所有这些事情都不需要Xcode。你可以用Versus Code和命令行完成这一切。
So I think it's, like, NeoVim and stuff like that. But with that, it's you can just run your project. Like, you don't actually have to be tied to Xcode for, you know, everything outside of iOS dev and all the Apple platforms. All of the stuff we're talking about, you don't need Xcode for. You can do all of it with, like, Versus Code and the command line.
另外,你在Fosdem会议上提到过,记得吗?是的,那个自由开放源码的Mhmm应用程序,对吧?
Also, you're at Fosdim, remember? Yes. The free and open source Mhmm. App. Right?
就在布鲁塞尔,他们对此非常投入。
So in Brussels, that's how committed they are.
是的,Swift团队参加了比利时的FOSDEM开源会议,所有的演讲内容都围绕着我们正在讨论的问题展开。你能看到一些关于嵌入式Swift的入门级演示,例如如何让LED闪烁。对于嵌入式系统来说,这就相当于'Hello World'程序,你能做到让一个LED灯亮起来或灭掉,这就是入门。
Yeah. So Swift was attending FOSDEM in Belgium, open source conference, and all the talks were about like, the questions and answers that we're reading off, there were talks about these things. So you can see, like, what the hello world equivalent of embedded Swift is blinking LED. So can you make an LED turn off and on? That's hello world.
你还可以观看一些相关的演讲来了解它是如何实现的。而苹果公司愿意投资并参与这类活动意味着他们确实希望将Swift推广到其他平台上。至于效果如何,如果有相关的资源,这才是大家真正关心的地方。
And you can, like, see some of the talks of how that is done. And Apple investing and wanting to go to that means, like, they are trying to move Swift onto other platforms. Like, they do that? How well? If there's resources around it, like, that's what everyone's looking for.
所以如果你正在Swift之外做一些东西,请写一篇博客文章分享出来。告诉大家你在做什么。因为我知道有人在互联网上的某个地方发帖说他正在做一个家庭自动化项目。
So if you are doing something outside of Swift, write a blog post. Post about it. Yeah. Say you're doing it. Because I believe somebody just Massanon Blue Sky somewhere on the Internet posted like they're doing I think it was like a home automation project.
这篇帖子被Swift语言官方Twitter账号和其他社交媒体转发了,它就是一篇普通的博客文章。你也有可能因此获得关注。我们之前好几期节目都谈到过主页展示之类的话题。
And it got retweeted on the Swift language Twitter and, like, all the other social medias. It was like a blog post. So you could be featured. And the homepage, we talked about that, like, several episodes ago.
是的。接下来,有位朋友说他正在尝试使用Paul开发的Ignite静态网站生成器来创建一个博客,这非常棒。我认为将Swift用于网页前端是一个非常酷的概念。我认为你把它添加到了落地页的UI应用中,以通过更新后的开发方式突出展示这一旅程。
Yeah. Next up, we have something who said, I'm trying to use the Ignite static site generator by Paul, awesome, to make a blog. I think Swift for web front end is a really cool concept. I think you're adding it to the landing page UI app to highlight the journey with updated development.
我很喜欢。这是由Paul Ridigan以及Paul和另外一位自由开发者开发的Ignite静态网站生成器。我应该读一下相关的内容介绍才对,那样理解起来会更清楚一些。不过如果有人还没用过Ignite,Paul在他的YouTube频道上有一个关于它的演讲。
Love it. Static site generation with Ignite by Paul Ridigan as Paul and the free person. I should've I feel like I should've read that one probably. Makes a little more sense. But if anyone hasn't used Ignite, Paul has a talk on it on his YouTube.
简单来说,它不像传统那样编写HTML和CSS代码,而是可以使用Swift语言,然后它会自动将其转换为HTML和CSS并生成相应的内容。例如,你可以写一段代码:这里有一个包含卡片的HStack,它就会据此生成看起来像Bootstrap风格的HTML代码。
But it's basically instead of writing HTML and CSS, you can use Swift and it will turn it into HTML and CSS for you and generate that. So you can write, here is an HStack with a card, and it will take that and make it into what the HTML should look like using Bootstrap.
是的。听起来可能像是,哦,我自己也能直接写HTML。当然了,你确实可以直接使用HTML,但重点不是我们把Swift转成了HTML,而是在此过程中你能开箱即用地获得诸如移动端网站优化等功能。
Yeah. So it sounds like, oh, I could just do HTML myself. And you could, of course, use HTML yourself. But the point isn't that we've converted Swift to HTML. The point is you get things like mobile site optimization out of the box.
因此它可以很好地适配iPhone、iPad或Apple TV等设备,并且能自动提供类似carousels(轮播图)、dropdowns(下拉菜单)、导航栏、菜单以及动画等高级控件,这些都采用了类似SwiftUI的语法风格。所以编码过程非常自然,也帮助你在未来更加规范地进行开发。我得提一下,今年东京Tri Swift团队的人非常友好,他们用Ignite搭建了自己的网站。我一开始还以为是iMashita做的呢。
So it works with an iPhone or iPad or Apple TV scalably. You get things like advanced controls like carousels and dropdowns and navigation bars and menus and animations and stuff just automatically in a SwiftUI style syntax. So it's very natural to code in and helps you do it more correctly in the future. I should say, I'm very grateful for the Tri Swift people here in Tokyo because they made their site in Ignite this year. So I think I thought it was iMashita.
非常感谢他们的支持,也希望将来能看到更多这样的案例。接下来,Ryan Token提到他正在AWS Lambda上运行Swift,远程控制飞利浦Hue灯泡闪烁。这又是一个完全跨界的应用场景。当我的主队得分或者获胜时,灯光会变成不同的颜色。
So very kind of to do that and looking forward to seeing more of that in the future. Next up, we have Ryan Token saying, I'm running Swift on AWS Lambda to remotely flash my Philips Hue light bulbs. Again, this is total divorce territory. Different colors. Whether my favorite sports teams score or win.
好的。我为此写了一篇博客文章,详细介绍了如何在Lambda上部署RunSwift。我们会把这篇博客链接放在节目备注里。这听起来太棒了。我喜欢——毕竟这是让灯光随着比分变化而闪烁。
Okay. I wrote a blog post about it that goes into some detail on how to deploy RunSwift on Lambda. We'll put the blog post in the show notes. That sounds awesome. I love I mean, it's it's making lights flash on this score.
我现在脑海里已经能想象出来了。虽然我说的可能不对,Ryan,但我猜大概是向某个服务器发送请求,可能会有大约十五秒的延迟。然后系统响应:'是的,他们得分了!'然后再去控制灯泡。
I can imagine it now in my head. I mean, I'm wrong here, Ryan, but I can imagine it's pinging a server somewhere, which has got a sort of fifteen second delay. It goes, yes. They've scored. Back to the thing, then to the light bulbs.
所以当你在电视上看比赛直播的时候,一旦得分,灯光就闪一下,就像这样:“好嘞!” 我想实际情况不会那么慢吧?
So you're watching it live on TV and they score. Flash like, okay. I don't think it's that Right?
我觉得没那么慢。哦。很多体育相关的应用都需要快速响应,因为人们关注实时数据,甚至有人靠体育博彩赚钱,所以他们希望所有信息都能快速更新。
I don't think it's that slow though. Oh. A lot of sports things are fast because people want up I mean, people bet on sports. So like they want fast updates with everything.
比如网络套接字,那种即时的东西
Like web sockets perhaps, like instant kind of
也许吧。
Maybe.
也许吧。
Maybe.
不过我确实喜欢这个想法。我很喜欢。AWS Lambda,对于不了解的人来说,它就像一个在云端运行的函数。所以如果你想要打印一个'Hello World',但你希望能在云端调用它,你就可以做到。或者如果你有一些人工智能模型之类的东西,你可以调用我的Lambda函数,做一些计算密集型的任务,然后将结果返回到你的iOS应用中。
But it it's definitely I like that idea. I love it. AWS Lambda, also for anyone who doesn't know, is kind of just like a function that is running in the cloud. So if you wanted to like print hello world, but you wanted to call it in the cloud, you can do that. Or if you have like some AI model kinda thing, you could say, call my Lambda function, does some computational heavy thing, and then bring it back down to your iOS app.
这就是AWS Lambda的作用。我喜欢这个。我想把它拿过来,做一个小灯,每次我的代码构建成功时就变绿。如果失败了,它就会变红,或者播放一个大音效,比如喇叭声。
That would be the purpose of AWS Lambda. And I love this. I like wanna I would wanna take that and be like, make a little light that would like turn green every time my like, code builds. And then it would like turn red if it like fails or like you have a big sound effect. Trombone sound.
是的,我们现实中就需要这样的东西。
Yes. We need that like in person.
是的,听起来不错。那么你父母支持哪个运动队?
Yes. That sounds good. So what is your parent's sports team?
我没有支持的球队。
I don't have one.
对啊,太棒了,不涉及体育。哦,你让我咳嗽了一下。我不知道怎么和你互动。
Yeah. Yay. No sports. Oh, you cough me. I don't know how touch you.
恶心。
Gross.
是的,我有洗手液。
Yeah. I have hand sanitizer.
好的,接下来我们有 Rafael Koblinski,他说他们最近刚刚发布了他们的第一个 Vapor/Leaf/Fluent 应用。厉害的是,这距离他上一次涉足 Web 开发(使用 WebObjects 和 Enterprise Objects Framework)已经大约二十五年了。哇塞。
Okay. Next up, we have Rafael Koblinski who says, they just recently launched their very first vapor slash leaf slash fluent app. Brilliantly, this is roughly twenty five years after his last foray into web development with WebObjects and the Enterprise Objects Framework. Dang.
那已经是很久以前的事了。
That was a long time ago.
差不多是一个 McKayla 那么久。
That's almost one McKayla ago.
那正好是一个 McKayla 的时间,在 Michaela 来说。
That's just about a McKayla. In Michaela time.
是啊,我知道,对吧?
Yeah. I know. Right?
确实很久了。而且我也非常喜欢,如果有人还不知道的话,Leaf 和 Fluent 是 Vapor 的一部分,它们各自都是独立的包。Leaf 可以让你将服务器端的一些内容展示到网页上,而 Fluent 则是用来在通常使用 Vapor 时与数据库通信的 ORM。
That's a lot. And I love so also, if anyone doesn't know, Leaf and Fluent are parts of Vapor. They're their own packages. Leaf is how you can kind of push some things that are from your server and then show them on the web. And then Fluent is the ORM for communicating with databases usually when using, like, Vapor.
所以把这些组合在一起,我很喜欢它作为你的第一个小项目,因为你即使对服务端了解不多也可以做很多事情。你可以简单地编写一些 CRUD 操作,也就是创建、读取、更新和删除。这些在示例项目中默认都提供了。然后你就可以以此为例子,继续开发出各种不同的东西。
So putting all of us together, I love it's like your first little project because you can do so much without knowing like a ton yet about the server. You can kinda just like write your CRUD operations. So create, read, update, delete. All of those like come by default in the example project. And then you can, like, use that as your example to, like, go forward and make a bunch of different things.
Fluent 我得说,总体而言,它基本上就是网络版的 Swift 数据处理工具,但非常漂亮。我的意思是,Fluent 的 API 非常棒,去看看它的文档就知道了。你甚至不需要写任何代码,只要看看这个系统设计得多好。我记得几年前我遇到过一个参与大型 Python CMS 项目的人,他说他们构建优秀 API 的最好建议是第一步:写出你希望它看起来是什么样的文档。
Fluent, I should say, generally, it's bay it's basically Swift data for the web, but it's beautiful. I mean, the API of Fluent, just go and look at the docs. You haven't gonna write any code. Just go and look at how nice the system is. I remember years ago meeting one of the guys who worked on a major Python CMS project, and he said their best advice for building great API was step one, write documentation of how you want it to look.
第二步,再写代码让它变成那样。我想很多人会直接跳进代码里碰运气。这才是理想的方式,老实说,Fluent 看起来就是这样。它正是我希望使用 Swift 数据时应该有的样子,只不过更加完善了一些。未来我们拭目以待吧。
Step two, write the code to make it look that way. I suppose it's sort of diving into the code and hoping for the best. This is the ideal way, and honestly, Fluent looks like that. It's exactly the way I'd expect to use Swift data if it was slightly more polished. We'll see in the future.
那真是太好了。是的。还有一个开放的API生成器。你可以使用YAML语法,它会定义你的API看起来是什么样的,然后它会为你生成Swift代码。
That was so nice. Yeah. There's also a open API generator. So you can use YAML syntax, and that will define what your API is going to look like. And then it generates the Swift code for you.
所以你实际上就是在做你刚才描述的事情,比如用文档来驱动开发,先写出文档的样子,再生成代码。但之后你也可以把它交给你的移动开发团队,他们也可以做同样的事情。他们可以生成调用这些API请求的方式。
So you literally are doing what you just described of, like, document yeah. Documentation driven development of write your documentation how it looks, generate the code. But then you can also take that and give it to your mobile team. They can do the same thing too. They can generate, like, how you call those API requests.
你有一个移动开发团队?
You've got a mobile team?
是的,就是我,我自己和我一个人。
Yeah. Me, myself, and I.
哦,我明白了。他们今年不配拿奖金了。
Oh, I see. They don't deserve a bonus this year.
我们快到了
We're getting
不,然后我们还有Guy Hambo,也被称为Rambo,他今年也在本次活动上发表了演讲。Guy说,我运行着一堆小服务器。顺便说一句,Guy有一个非常棒的网站。
there. No. And then we have Guy Hambo, also known as Rambo, who's here speaking, by the way, at the event this year. Guy says, I run a bunch of little servers. By the way, Guy has a fantastic site.
是iosarchitecture.top吗?是的。这个网站只是随机生成三到四个字母的缩写,用来作为你下一个项目的架构名称,比如MVVM、MCPQ之类的。那个网站挺不错的。此外,他还用publish来制作他的博客和其他网站。
Is it iosarchitecture.top? Yeah. It lists it just generates random three to four letter acronyms for your next project to say what your architecture is, MVVM, MCPQ, or something like that. Good site, that one. Anyway and also makes his blog and other websites using publish.
publish还继续支持吗?还在维护吗?
Is publish still supported? Is it still going?
publish仍然存在。最近好像没有太多更新,但我相信John Sandel最近在他的博客上发了一篇文章,可能是第一次发布一段时间以来的新内容。也许这意味着他会回来清理一下大家提交的一些PR和问题。不过你知道的,这是开源项目,你总是可以自己fork项目并自行维护。
Publish is still there. I don't think there's been a ton of updates lately, but I believe John Sandel posted on his blog for the first time in a little bit. So maybe that means he's gonna come up and, like, clean up some of the PRs and issues that people have, like, posted. But, you know, it's open source. You can always fork the project and do it yourself.
你可以。开源非常棒。最后,我们来结束一下。我特别喜欢这个。Telemetry Deck 的代码有 99% 是 Swift 写的。
You can. Open source is great. And finally, one to end on. I love this one. Telemetry deck is 99% swift.
太棒了。感谢大家收听。记得告诉你的朋友去订阅,当然还要留下评价。我们下一次的开放投票话题是:你如何决定应用的盈利方式?你是如何定价的,是定期订阅、可消费型应用内购买,还是其他方式?你又是如何实现它的?
Love it. Thank you to everyone for listening. Be sure to tell your friends to subscribe and of course, leave a review. Our next open ballot is what is your approach to monetizing apps? How do you decide a price, reoccurring subscription, consumable IAP, and how do you implement it?
告诉我们吧,我们下次再见。再见。
Let us know, and we'll see you next time. Bye.
再见。手电筒。好了。
Bye. Flashlight. Okay.
关于 Bayt 播客
Bayt 提供中文+原文双语音频和字幕,帮助你打破语言障碍,轻松听懂全球优质播客。