1
00:00:00,000 --> 00:00:02,680
So we had a YouTube comment this week,

2
00:00:02,680 --> 00:00:03,980
which asked us a question,

3
00:00:03,980 --> 00:00:07,080
which I think we should kick off this week's show

4
00:00:07,080 --> 00:00:08,740
by answering it.

5
00:00:08,740 --> 00:00:15,180
So the comment was from Encapsulatio,

6
00:00:15,180 --> 00:00:18,740
or Encapsulatio, I'm not quite sure how to say that.

7
00:00:18,740 --> 00:00:23,240
And it's about Swift on Linux and Windows.

8
00:00:23,240 --> 00:00:26,440
So we talked a little bit about Swift on Windows,

9
00:00:26,440 --> 00:00:28,880
and I think probably a little bit about Swift on Linux

10
00:00:28,880 --> 00:00:30,780
in the last episode.

11
00:00:30,780 --> 00:00:34,240
And this comment says,

12
00:00:34,240 --> 00:00:36,200
"Does Swift work on Linux and Windows

13
00:00:36,200 --> 00:00:37,660
just as well as on Mac

14
00:00:37,660 --> 00:00:39,820
when it comes to a developer experience?

15
00:00:39,820 --> 00:00:42,500
What about developing apps that work on Android?

16
00:00:42,500 --> 00:00:46,640
Can you talk about cross-platform development in Swift

17
00:00:46,640 --> 00:00:50,420
and also cross-platform compilation of Swift software?"

18
00:00:50,420 --> 00:00:53,680
So I think the answer to that is yes, we can.

19
00:00:53,680 --> 00:00:54,560
(laughing)

20
00:00:54,560 --> 00:00:56,420
Well, we can certainly try.

21
00:00:57,760 --> 00:01:00,080
Well, we can certainly try, yeah, exactly.

22
00:01:00,080 --> 00:01:01,880
So let's try, shall we?

23
00:01:01,880 --> 00:01:03,120
- Yeah, because can.

24
00:01:03,120 --> 00:01:04,840
Have we actually?

25
00:01:04,840 --> 00:01:08,760
Have you made any attempts to run Swift on Windows

26
00:01:08,760 --> 00:01:09,920
or Android?

27
00:01:09,920 --> 00:01:11,040
- On Windows, no.

28
00:01:11,040 --> 00:01:13,880
On Android, no.

29
00:01:13,880 --> 00:01:16,520
On Linux, kind of.

30
00:01:16,520 --> 00:01:17,720
- Yeah, I feel more comfortable

31
00:01:17,720 --> 00:01:20,760
about that side of the fence.

32
00:01:20,760 --> 00:01:22,720
- Yeah, and I think that's probably potentially

33
00:01:22,720 --> 00:01:24,640
where we should focus,

34
00:01:24,640 --> 00:01:28,040
because, and I do think that the question,

35
00:01:28,040 --> 00:01:29,680
'cause there was a follow-up post afterwards

36
00:01:29,680 --> 00:01:32,240
and it did talk about Linux specifically.

37
00:01:32,240 --> 00:01:35,760
So I think the question is mainly around Linux

38
00:01:35,760 --> 00:01:37,600
rather than Windows and Android,

39
00:01:37,600 --> 00:01:40,600
but we should potentially touch on those too.

40
00:01:40,600 --> 00:01:44,760
- Well, the good news is if we talk about Linux,

41
00:01:44,760 --> 00:01:49,160
I guess a lot of it will apply to Windows

42
00:01:49,160 --> 00:01:52,000
because as we probably get into it fairly quickly,

43
00:01:52,000 --> 00:01:55,200
the primary editor on Linux is gonna be VS Code,

44
00:01:55,200 --> 00:01:58,160
which is a first-class citizen on Windows, right?

45
00:01:58,160 --> 00:01:59,120
- Exactly, yeah.

46
00:01:59,120 --> 00:02:02,040
And in terms of developer experience,

47
00:02:02,040 --> 00:02:05,120
which is what this question is primarily about,

48
00:02:05,120 --> 00:02:09,800
I think that is really all we probably need to say.

49
00:02:09,800 --> 00:02:12,880
As far as I know, VS Code works on Linux.

50
00:02:12,880 --> 00:02:14,200
It certainly works on Windows.

51
00:02:14,200 --> 00:02:15,800
It definitely works also on Mac.

52
00:02:17,280 --> 00:02:22,280
- So there is a relatively official these days

53
00:02:22,280 --> 00:02:26,200
extension for VS Code,

54
00:02:26,200 --> 00:02:29,400
which I think is under the stewardship

55
00:02:29,400 --> 00:02:31,200
of the server work group, is it?

56
00:02:31,200 --> 00:02:33,360
Or is it completely independent?

57
00:02:33,360 --> 00:02:34,200
- It is.

58
00:02:34,200 --> 00:02:37,480
I think it has moved into the official servers,

59
00:02:37,480 --> 00:02:40,600
Swift account and is officially maintained, I believe.

60
00:02:40,600 --> 00:02:41,760
- Yeah, I thought so, yeah.

61
00:02:41,760 --> 00:02:43,480
- And the maintainer is Adam Fowler.

62
00:02:43,480 --> 00:02:45,920
We should mention him because he's done a lot of work there

63
00:02:45,920 --> 00:02:47,480
to make that really nice.

64
00:02:47,480 --> 00:02:49,960
- An enormous amount of work, yeah.

65
00:02:49,960 --> 00:02:54,400
And yeah, so that extension is available

66
00:02:54,400 --> 00:02:59,160
in the VS Code extensions store, if it's called the store,

67
00:02:59,160 --> 00:03:01,080
but whatever you install the extensions from,

68
00:03:01,080 --> 00:03:02,360
it's available there.

69
00:03:02,360 --> 00:03:05,760
And it comes along with a whole load of stuff by default.

70
00:03:05,760 --> 00:03:09,080
So it hooks into the LSP,

71
00:03:09,080 --> 00:03:12,280
which is the language server protocol, is it?

72
00:03:12,280 --> 00:03:13,120
- Yes.

73
00:03:13,120 --> 00:03:15,240
- Yes.

74
00:03:15,240 --> 00:03:16,760
- We've done our homework.

75
00:03:16,760 --> 00:03:21,760
- As you can tell, this podcast is excruciatingly researched.

76
00:03:21,760 --> 00:03:24,200
(laughing)

77
00:03:24,200 --> 00:03:27,800
Language server protocol, yeah.

78
00:03:27,800 --> 00:03:32,040
So that gives you things like completion and highlighting

79
00:03:32,040 --> 00:03:33,280
and that kind of stuff.

80
00:03:33,280 --> 00:03:37,960
And then there's also some extras in that extension

81
00:03:37,960 --> 00:03:42,680
that do, for example, when you open up a Swift package

82
00:03:42,680 --> 00:03:47,680
with VS Code, it does a dependency resolution for you.

83
00:03:47,680 --> 00:03:49,320
There are also some commands in there

84
00:03:49,320 --> 00:03:54,320
that you can build and test your package.

85
00:03:54,320 --> 00:03:57,840
So I would say it's a pretty good experience.

86
00:03:57,840 --> 00:03:59,560
In fact, I would say it's actually getting on

87
00:03:59,560 --> 00:04:04,560
for a great experience to develop Swift in VS Code

88
00:04:04,560 --> 00:04:07,360
with that extension installed.

89
00:04:07,360 --> 00:04:11,760
And of course you can then do that on all those platforms,

90
00:04:11,760 --> 00:04:13,680
Linux, Windows, and Mac.

91
00:04:13,680 --> 00:04:16,600
- Yeah, and just to extend that a bit, VS Code,

92
00:04:16,600 --> 00:04:19,000
I've been using it a couple of times

93
00:04:19,000 --> 00:04:23,280
because while we do development mainly on the Mac

94
00:04:23,280 --> 00:04:28,280
for the SPI server project, we deploy on Linux.

95
00:04:28,280 --> 00:04:33,280
So we sometimes have the need to actually run the,

96
00:04:33,280 --> 00:04:35,640
or compile and test on Linux,

97
00:04:35,640 --> 00:04:38,800
because sometimes there might be small differences

98
00:04:38,800 --> 00:04:41,520
or things that we're debugging

99
00:04:41,520 --> 00:04:43,480
that might only happen on Linux.

100
00:04:43,480 --> 00:04:46,680
So we have a certain need to actually run it on Linux

101
00:04:46,680 --> 00:04:50,320
ourselves as well, not just when we actually

102
00:04:50,320 --> 00:04:51,800
deploy the server.

103
00:04:51,800 --> 00:04:56,720
And that's when I use VS Code and even Nova recently,

104
00:04:56,720 --> 00:04:59,880
because that also has now a Swift extension

105
00:04:59,880 --> 00:05:01,960
with LSP support.

106
00:05:01,960 --> 00:05:05,240
So while it doesn't have the test runner stuff,

107
00:05:05,240 --> 00:05:09,880
it does have the autocomplete and the pop-up stuff

108
00:05:09,880 --> 00:05:12,080
for the autocomplete, so that's quite nice.

109
00:05:12,080 --> 00:05:18,040
And VS Code brings in addition the little test runner UI,

110
00:05:18,040 --> 00:05:21,480
like on the Mac you have these little diamonds

111
00:05:21,480 --> 00:05:22,400
that you can click.

112
00:05:22,400 --> 00:05:27,800
I believe that also works on Linux.

113
00:05:27,800 --> 00:05:31,560
I don't try that often because of the nature of things

114
00:05:31,560 --> 00:05:34,800
I tend to do when I get to that point,

115
00:05:34,800 --> 00:05:37,880
but I believe that is now supported and should be working

116
00:05:37,880 --> 00:05:40,680
so you can run tests that way individually

117
00:05:40,680 --> 00:05:42,160
or just all of them.

118
00:05:42,160 --> 00:05:44,000
That's quite nice.

119
00:05:44,000 --> 00:05:46,280
- And I think it is worth saying that,

120
00:05:46,280 --> 00:05:48,200
as far as I know, both of our experience

121
00:05:48,200 --> 00:05:50,840
with running this extension in VS Code

122
00:05:50,840 --> 00:05:55,200
is running the extension in the Mac version of VS Code.

123
00:05:55,200 --> 00:05:58,040
And as you say, you can run those developer containers

124
00:05:58,040 --> 00:06:03,040
to run the software that you're working on

125
00:06:03,080 --> 00:06:05,200
under Linux inside a container.

126
00:06:05,200 --> 00:06:10,200
But certainly I haven't tried all of this in VS Code

127
00:06:10,200 --> 00:06:12,040
on different platforms,

128
00:06:12,040 --> 00:06:14,120
although I do believe it all works.

129
00:06:14,120 --> 00:06:16,840
- Yeah, I imagine that might even be a good way

130
00:06:16,840 --> 00:06:18,360
to get started on Windows

131
00:06:18,360 --> 00:06:23,360
while support is probably not there fully.

132
00:06:23,360 --> 00:06:26,600
There was just recently someone said they tried

133
00:06:26,600 --> 00:06:29,400
using Swift on Windows and didn't have a great experience.

134
00:06:29,400 --> 00:06:32,360
And a better experience for now might be

135
00:06:32,360 --> 00:06:35,520
to run the same way we do on the Mac.

136
00:06:35,520 --> 00:06:39,040
You run VS Code and then you run a dev container

137
00:06:39,040 --> 00:06:44,040
with the Swift image of a Swift image

138
00:06:44,040 --> 00:06:46,000
as a Linux container on Windows.

139
00:06:46,000 --> 00:06:48,560
I would imagine that works just the same

140
00:06:48,560 --> 00:06:50,440
as it does on the Mac.

141
00:06:50,440 --> 00:06:51,360
I haven't tried that.

142
00:06:51,360 --> 00:06:54,680
I don't know how good the experience is in Docker

143
00:06:54,680 --> 00:06:56,200
for Windows, but I would imagine

144
00:06:56,200 --> 00:06:57,840
that would work the same way.

145
00:06:57,840 --> 00:07:01,920
- All of the component pieces are certainly available.

146
00:07:01,920 --> 00:07:03,200
- Yeah, yeah, definitely.

147
00:07:03,200 --> 00:07:06,800
So that's certainly probably the easiest way

148
00:07:06,800 --> 00:07:07,800
to get started.

149
00:07:07,800 --> 00:07:10,760
And if you're worried about performance,

150
00:07:10,760 --> 00:07:12,000
that's actually an interesting thing

151
00:07:12,000 --> 00:07:13,000
I found out the other day

152
00:07:13,000 --> 00:07:17,080
because I ran our test suite in a Linux container

153
00:07:17,080 --> 00:07:17,920
on the Mac.

154
00:07:17,920 --> 00:07:21,040
This is an Apple Silicon Mac.

155
00:07:21,040 --> 00:07:23,440
And to my surprise, the tests actually run faster

156
00:07:23,440 --> 00:07:25,920
in the container.

157
00:07:25,920 --> 00:07:29,640
So in Xcode, they run in, I think, like 60 seconds

158
00:07:29,640 --> 00:07:33,160
and in the container, it ran in 40 or 45

159
00:07:33,160 --> 00:07:34,000
or something like that.

160
00:07:34,000 --> 00:07:35,120
It was a noticeable difference.

161
00:07:35,120 --> 00:07:39,000
- I was gonna say, that's quite a significant difference.

162
00:07:39,000 --> 00:07:40,120
- That's why I actually timed it

163
00:07:40,120 --> 00:07:43,000
because I noticed, yeah, it was really,

164
00:07:43,000 --> 00:07:45,720
I posted about it because I was so surprised

165
00:07:45,720 --> 00:07:47,520
that it was so much faster.

166
00:07:47,520 --> 00:07:50,880
I think it might be the terminal output.

167
00:07:50,880 --> 00:07:54,720
So the console in Xcode is pretty slow, I believe.

168
00:07:54,720 --> 00:07:56,960
And I wonder if that's the reason.

169
00:07:56,960 --> 00:08:00,040
I haven't actually tried running it in terminal

170
00:08:00,040 --> 00:08:02,840
on the Mac to see if that makes a difference.

171
00:08:02,840 --> 00:08:05,400
- Well, maybe rather than upgrading my Mac,

172
00:08:05,400 --> 00:08:06,920
I should switch to Linux.

173
00:08:06,920 --> 00:08:09,680
- Well, good luck.

174
00:08:09,680 --> 00:08:11,920
(laughing)

175
00:08:11,920 --> 00:08:17,360
- Yeah, so I think, and I was gonna,

176
00:08:17,360 --> 00:08:18,960
so I'm glad you brought up Nova

177
00:08:18,960 --> 00:08:21,120
because I know you've been using it recently

178
00:08:21,120 --> 00:08:24,880
and I'm glad to hear that at least some of that

179
00:08:24,880 --> 00:08:27,280
is going across to other editors.

180
00:08:27,280 --> 00:08:32,480
I don't know of any others apart from VS Code and Nova.

181
00:08:32,480 --> 00:08:35,600
I mean, almost certainly you can get this working in Emacs

182
00:08:35,600 --> 00:08:38,240
because you can get anything working in Emacs, right?

183
00:08:38,240 --> 00:08:40,480
(laughing)

184
00:08:40,480 --> 00:08:44,040
But I haven't heard of any other editors

185
00:08:44,040 --> 00:08:46,040
that have at least advertised.

186
00:08:46,040 --> 00:08:48,000
I know other editors do use the LSP,

187
00:08:48,000 --> 00:08:51,120
but I haven't heard of any others

188
00:08:51,120 --> 00:08:52,800
kind of advertising support for Swift.

189
00:08:52,800 --> 00:08:55,520
So if you do know of any,

190
00:08:55,520 --> 00:08:59,080
then please drop us a comment either on the YouTube video

191
00:08:59,080 --> 00:09:01,960
or actually I don't think we have comments

192
00:09:01,960 --> 00:09:02,920
on the podcast, do we?

193
00:09:02,920 --> 00:09:05,000
So yeah, if you know of any,

194
00:09:05,000 --> 00:09:06,600
then drop us a comment on the YouTube video.

195
00:09:06,600 --> 00:09:09,800
- Yeah, and I believe that there should be a fair number

196
00:09:09,800 --> 00:09:12,560
because LSP seems to be like the common way

197
00:09:12,560 --> 00:09:14,080
to do this sort of thing these days.

198
00:09:14,080 --> 00:09:17,040
And that should open up support

199
00:09:17,040 --> 00:09:19,200
for quite a number of editors.

200
00:09:19,200 --> 00:09:21,440
- And like I say, there is that certainly,

201
00:09:21,440 --> 00:09:25,000
that LSP is in a lot of editors.

202
00:09:25,000 --> 00:09:26,080
But if it does more than that,

203
00:09:26,080 --> 00:09:29,240
because I think that's where code stands out, right?

204
00:09:29,240 --> 00:09:30,080
- Yeah.

205
00:09:30,080 --> 00:09:32,120
- So yes, thank you to Adam and everyone else

206
00:09:32,120 --> 00:09:35,720
who worked on the VS Code plugin

207
00:09:35,720 --> 00:09:38,760
because I'm sure there are more people.

208
00:09:38,760 --> 00:09:44,920
It's something I use,

209
00:09:44,920 --> 00:09:48,840
'cause I use code to develop all the JavaScript and CSS

210
00:09:48,840 --> 00:09:51,280
for the package index.

211
00:09:51,280 --> 00:09:52,600
And so when I'm doing that,

212
00:09:52,600 --> 00:09:54,920
in fact, I was doing it this afternoon,

213
00:09:54,920 --> 00:09:58,520
I also ran the server through VS Code.

214
00:09:58,520 --> 00:10:03,040
And so that's the situation in which I use VS Code

215
00:10:03,040 --> 00:10:05,600
kind of in anger to do real work.

216
00:10:05,600 --> 00:10:08,160
When I'm working purely on Swift code,

217
00:10:08,160 --> 00:10:10,880
I do still do it in Xcode.

218
00:10:10,880 --> 00:10:15,800
I find that experience is still noticeably better

219
00:10:15,800 --> 00:10:20,120
than VS Code, but it's certainly not something

220
00:10:20,120 --> 00:10:24,720
you're hobbling along with, it's a real, it does work.

221
00:10:24,720 --> 00:10:26,360
- It does, and there are people,

222
00:10:26,360 --> 00:10:29,920
especially those who work just exclusively on Linux,

223
00:10:29,920 --> 00:10:32,560
who use it as an everyday tool

224
00:10:32,560 --> 00:10:36,800
and do say that it's working great.

225
00:10:36,800 --> 00:10:41,800
So I think it's a viable approach to use Swift on Linux.

226
00:10:41,800 --> 00:10:45,200
I don't think you're that,

227
00:10:45,200 --> 00:10:48,320
you can have a great experience, I believe.

228
00:10:48,320 --> 00:10:50,080
- Yeah, absolutely, yeah.

229
00:10:50,080 --> 00:10:52,760
And then the final part of the question is Android.

230
00:10:52,760 --> 00:10:57,120
And I am gonna basically say that I'm not very well up

231
00:10:57,120 --> 00:11:01,800
on making Android apps in Swift.

232
00:11:01,800 --> 00:11:04,960
I know there was a project,

233
00:11:04,960 --> 00:11:07,160
and in fact, I'm sure that project has continued.

234
00:11:07,160 --> 00:11:10,400
I know there was a project that got some way towards that,

235
00:11:10,400 --> 00:11:13,320
but I don't know the current status of that.

236
00:11:13,320 --> 00:11:14,160
- Yeah, me neither.

237
00:11:14,160 --> 00:11:16,320
It popped up, but it was quite a while ago

238
00:11:16,320 --> 00:11:21,080
that there was some activity around Android support.

239
00:11:21,080 --> 00:11:22,920
And I don't know where that went.

240
00:11:22,920 --> 00:11:23,960
I don't think it's,

241
00:11:23,960 --> 00:11:28,360
in the hierarchy of next platforms,

242
00:11:28,360 --> 00:11:30,840
I believe Windows is probably the closest

243
00:11:30,840 --> 00:11:33,600
to seeing proper support.

244
00:11:33,600 --> 00:11:37,360
And then Wasm is the other one that comes to mind.

245
00:11:37,360 --> 00:11:40,800
I think that's the order

246
00:11:40,800 --> 00:11:44,440
in which we'll see new platforms appear

247
00:11:44,440 --> 00:11:47,200
in our compatibility matrix for sure.

248
00:11:47,200 --> 00:11:48,320
- Sure, yeah.

249
00:11:48,320 --> 00:11:50,440
The only other thing to mention here is

250
00:11:50,440 --> 00:11:54,440
it's not running Swift on Android,

251
00:11:54,440 --> 00:11:59,440
but actually one option for creating cross-platform,

252
00:11:59,440 --> 00:12:04,320
at least backend logic, is Kotlin Multiplatform.

253
00:12:04,320 --> 00:12:08,920
So Kotlin is the language that you might develop

254
00:12:08,920 --> 00:12:09,880
any Android app in,

255
00:12:09,880 --> 00:12:13,000
which I believe is sitting on top of Java still,

256
00:12:13,000 --> 00:12:16,480
but it's a very different language than Java.

257
00:12:16,480 --> 00:12:19,640
Much more modern, much more like Swift actually.

258
00:12:19,640 --> 00:12:23,520
And Kotlin Multiplatform is a technology

259
00:12:23,520 --> 00:12:26,160
that allows you to share Kotlin code

260
00:12:26,160 --> 00:12:30,600
between Swift and your Android applications.

261
00:12:30,600 --> 00:12:35,600
And that I believe is really quite far along.

262
00:12:35,600 --> 00:12:37,720
You know, that's usable.

263
00:12:37,720 --> 00:12:40,480
- Right, is that sort of like in spirit,

264
00:12:40,480 --> 00:12:42,520
like the C++ support in Swift?

265
00:12:42,520 --> 00:12:45,720
Does it just mix objects and call

266
00:12:45,720 --> 00:12:48,760
from one language to the other, or how does that work?

267
00:12:48,760 --> 00:12:50,640
- Really great question, yeah.

268
00:12:50,640 --> 00:12:52,160
And we'll leave it there.

269
00:12:52,160 --> 00:12:54,400
(laughing)

270
00:12:54,400 --> 00:12:58,800
Really, really just a great question, yeah.

271
00:12:58,800 --> 00:13:03,120
- We might have more of that in the future perhaps.

272
00:13:03,120 --> 00:13:07,440
- I think what we're really acting as here

273
00:13:07,440 --> 00:13:12,000
is the inspiration to Google

274
00:13:12,000 --> 00:13:14,000
and go and search.

275
00:13:14,000 --> 00:13:15,840
- And maybe there's someone listening to this

276
00:13:15,840 --> 00:13:19,120
that's saying, "God damn it, I know this."

277
00:13:19,120 --> 00:13:22,400
- Completely uninformed podcast hosts, yes.

278
00:13:22,400 --> 00:13:25,440
Actually, no, not completely uninformed,

279
00:13:25,440 --> 00:13:27,240
only dangerously uninformed.

280
00:13:27,240 --> 00:13:32,920
- Speaking of questions, Dave,

281
00:13:32,920 --> 00:13:35,840
how do you add a package to the Swift package index?

282
00:13:35,840 --> 00:13:38,680
- How do you add a package to the Swift?

283
00:13:38,680 --> 00:13:40,840
You go to the add a package page.

284
00:13:40,840 --> 00:13:42,840
- That's totally out of the blue, isn't it?

285
00:13:42,840 --> 00:13:43,680
(laughing)

286
00:13:43,680 --> 00:13:44,520
How do you add a--

287
00:13:44,520 --> 00:13:46,400
- I wasn't expecting that question,

288
00:13:46,400 --> 00:13:47,960
but yes, you go to the add a package page.

289
00:13:47,960 --> 00:13:51,040
- Exactly, no one expects the Spanish inquisition.

290
00:13:51,040 --> 00:13:52,640
(laughing)

291
00:13:52,640 --> 00:13:53,840
- Is it a trick question?

292
00:13:53,840 --> 00:13:55,760
- No, it is a very straightforward question,

293
00:13:55,760 --> 00:13:57,520
which you have actually answered recently,

294
00:13:57,520 --> 00:13:59,880
which is why I'm bringing it up.

295
00:13:59,880 --> 00:14:02,840
- Yeah, you go to the add a package page

296
00:14:02,840 --> 00:14:04,080
on the package index site,

297
00:14:04,080 --> 00:14:07,000
and that takes you to a GitHub issue

298
00:14:07,000 --> 00:14:10,120
that starts a workflow that adds the package to the list,

299
00:14:10,120 --> 00:14:12,880
and I'm completely blanking on why I might,

300
00:14:12,880 --> 00:14:14,840
why this might be relevant.

301
00:14:14,840 --> 00:14:17,880
- So you went on a competing podcast the other day,

302
00:14:17,880 --> 00:14:19,040
well, I listened to it.

303
00:14:19,040 --> 00:14:22,840
You were on the "More Than Just Code" podcast

304
00:14:22,840 --> 00:14:23,680
with Tim Mitra.

305
00:14:23,680 --> 00:14:25,240
- I was on the "More Than Just Code,"

306
00:14:25,240 --> 00:14:26,240
yeah, absolutely, yeah.

307
00:14:26,240 --> 00:14:27,640
- You were, you were,

308
00:14:27,640 --> 00:14:29,640
and you've been asked this very question,

309
00:14:29,640 --> 00:14:32,800
and I was the one listening and almost shouting,

310
00:14:32,800 --> 00:14:36,640
"Dave, no, it's easier, it's easier, it's easier."

311
00:14:36,640 --> 00:14:38,080
- What did I say?

312
00:14:38,080 --> 00:14:40,280
- Well, you were kind of apologetic

313
00:14:40,280 --> 00:14:44,160
that it is, that it uses Git and is a bit complicated,

314
00:14:44,160 --> 00:14:46,560
and you said there's a button to click,

315
00:14:46,560 --> 00:14:48,720
and then you add the URL and stuff,

316
00:14:48,720 --> 00:14:49,640
and I thought this whole time,

317
00:14:49,640 --> 00:14:52,280
no, it's actually easier, it's actually easier than that,

318
00:14:52,280 --> 00:14:54,840
and I wanted to just bring that up,

319
00:14:54,840 --> 00:14:56,240
not to shame you or anything,

320
00:14:56,240 --> 00:14:59,640
because it is, that's how we--

321
00:14:59,640 --> 00:15:01,200
- That's just a happy side effect, right?

322
00:15:01,200 --> 00:15:02,880
- (laughs) Exactly.

323
00:15:02,880 --> 00:15:05,520
(both laughing)

324
00:15:05,520 --> 00:15:07,880
No, because I wanted to bring it up

325
00:15:07,880 --> 00:15:10,160
because I don't think many people know it,

326
00:15:10,160 --> 00:15:13,080
and it's sort of hidden, right?

327
00:15:13,080 --> 00:15:15,360
There is no UI for that, really,

328
00:15:15,360 --> 00:15:17,360
but actually, I find the easiest way,

329
00:15:17,360 --> 00:15:20,840
and that's how I add packages to the indexes.

330
00:15:20,840 --> 00:15:23,080
If you are on a GitHub page,

331
00:15:23,080 --> 00:15:25,720
you just replace GitHub in the URL

332
00:15:25,720 --> 00:15:26,960
with Swift package index,

333
00:15:26,960 --> 00:15:30,520
and then you land on a page which has a button,

334
00:15:30,520 --> 00:15:31,960
and then you just click buttons from there.

335
00:15:31,960 --> 00:15:33,800
You have no typing to do whatsoever

336
00:15:33,800 --> 00:15:37,880
because it pre-fills the pull request that we then open

337
00:15:37,880 --> 00:15:40,360
with the URL already put in

338
00:15:40,360 --> 00:15:42,520
because you've just come from the site.

339
00:15:42,520 --> 00:15:45,040
So to explain what's happening there,

340
00:15:45,040 --> 00:15:47,840
if you replace the GitHub in the domain name

341
00:15:47,840 --> 00:15:49,160
with Swift package index,

342
00:15:49,160 --> 00:15:52,600
we go to a package page stub.

343
00:15:52,600 --> 00:15:54,280
We obviously don't have the package yet.

344
00:15:54,280 --> 00:15:56,440
Well, if we have it already, you're already done, right?

345
00:15:56,440 --> 00:15:58,280
You land on the page and you see,

346
00:15:58,280 --> 00:16:00,160
all right, there's nothing for me to do

347
00:16:00,160 --> 00:16:02,400
because the package is already there.

348
00:16:02,400 --> 00:16:04,760
If it isn't, instead of rendering a 404,

349
00:16:04,760 --> 00:16:08,000
what we do is we show a page which has a button

350
00:16:08,000 --> 00:16:10,320
where you can either go back to the GitHub page

351
00:16:10,320 --> 00:16:12,160
if you landed there in error,

352
00:16:12,160 --> 00:16:15,680
or you can click a button there that says add this package,

353
00:16:15,680 --> 00:16:18,120
and then it opens up a pull request

354
00:16:18,120 --> 00:16:19,200
with everything filled in,

355
00:16:19,200 --> 00:16:21,320
and that's why I wanted to bring it up

356
00:16:21,320 --> 00:16:23,760
because I find that's actually the easiest way to do it

357
00:16:23,760 --> 00:16:28,560
because you can both check if it's already there

358
00:16:28,560 --> 00:16:30,440
and then add it in one step.

359
00:16:30,440 --> 00:16:31,840
There's no fiddling around to do,

360
00:16:31,840 --> 00:16:35,360
and that's why I find it really easy.

361
00:16:35,360 --> 00:16:37,760
And if you want, you can even go further,

362
00:16:37,760 --> 00:16:38,600
and that's what I do.

363
00:16:38,600 --> 00:16:41,920
I have a little bookmarklet that does a replacement of the,

364
00:16:41,920 --> 00:16:45,240
and you wrote this, actually, this bookmarklet.

365
00:16:45,240 --> 00:16:47,520
So it does a replacing of the GitHub

366
00:16:47,520 --> 00:16:50,040
in the domain name via JavaScript.

367
00:16:50,040 --> 00:16:51,640
So all I do is click buttons.

368
00:16:51,640 --> 00:16:55,000
I don't ever do replacement typing.

369
00:16:55,000 --> 00:16:57,800
I'm not sure how we could better expose that

370
00:16:57,800 --> 00:17:01,960
or make that bookmarklet easier to install.

371
00:17:01,960 --> 00:17:04,800
I mean, I'm not sure if people add lots of packages

372
00:17:04,800 --> 00:17:08,400
that they might want to keep that bookmarklet around,

373
00:17:08,400 --> 00:17:10,600
but I do because I often add packages this way.

374
00:17:10,600 --> 00:17:14,400
But even so, I think it might be just easier

375
00:17:14,400 --> 00:17:16,640
to just try a TypeSwift package index

376
00:17:16,640 --> 00:17:20,440
over the GitHub in the domain to get it all started.

377
00:17:20,440 --> 00:17:21,280
I don't know.

378
00:17:21,280 --> 00:17:25,120
- So yeah, I'm not sure how we could make

379
00:17:25,120 --> 00:17:27,760
that process more visible.

380
00:17:27,760 --> 00:17:30,120
I deliberately don't mention that process.

381
00:17:30,120 --> 00:17:33,200
It is also the process I use to add packages to the index,

382
00:17:33,200 --> 00:17:36,040
and it is by far the easiest way,

383
00:17:36,040 --> 00:17:39,360
but that manual step of either knowing

384
00:17:39,360 --> 00:17:40,680
that you can do it with a bookmarklet

385
00:17:40,680 --> 00:17:44,400
or manually typing in Swift package index to replace GitHub

386
00:17:44,400 --> 00:17:51,400
is enough for me to not exactly keep it secret,

387
00:17:51,400 --> 00:17:55,880
but not talk about it because it feels like a cheat code

388
00:17:55,880 --> 00:17:58,000
for adding packages to the package index.

389
00:17:58,000 --> 00:18:00,600
(laughing)

390
00:18:00,600 --> 00:18:04,400
I think the point that I was talking,

391
00:18:04,400 --> 00:18:05,880
I don't remember exactly what I said

392
00:18:05,880 --> 00:18:08,400
just 'cause I don't remember many things.

393
00:18:08,400 --> 00:18:09,240
(laughing)

394
00:18:09,240 --> 00:18:10,920
There are many things I don't remember,

395
00:18:10,920 --> 00:18:13,600
but I don't remember exactly what I said with Tim.

396
00:18:13,600 --> 00:18:16,480
But I think the point that probably came up

397
00:18:16,480 --> 00:18:21,480
was that that process of the whole package list JSON file

398
00:18:21,480 --> 00:18:25,160
is like there are some problems with that file

399
00:18:25,160 --> 00:18:27,840
and it adds some friction to,

400
00:18:27,840 --> 00:18:30,160
no matter what this process around

401
00:18:30,160 --> 00:18:31,880
getting something into that file is,

402
00:18:31,880 --> 00:18:33,400
it adds some friction to that process,

403
00:18:33,400 --> 00:18:36,800
but that it's important because that's the only record

404
00:18:36,800 --> 00:18:39,600
of who added what package to the index.

405
00:18:39,600 --> 00:18:43,320
And it's good just to have a little bit of a trail

406
00:18:43,320 --> 00:18:46,000
of like where did each package

407
00:18:46,000 --> 00:18:49,640
eventually kind of originate from.

408
00:18:49,640 --> 00:18:54,640
But when we've been kind of making it easier over the years,

409
00:18:55,120 --> 00:18:58,960
but actually the mechanism that we've used to make it easier

410
00:18:58,960 --> 00:19:01,320
and I should credit James Sherlock here

411
00:19:01,320 --> 00:19:06,000
who did a lot of the work to initially get this working.

412
00:19:06,000 --> 00:19:10,680
What we've actually done is we have made that process easier

413
00:19:10,680 --> 00:19:13,320
but we've added various different ways

414
00:19:13,320 --> 00:19:14,560
to do the same process.

415
00:19:14,560 --> 00:19:16,480
And that in itself kind of makes things

416
00:19:16,480 --> 00:19:17,640
a little bit more complicated.

417
00:19:17,640 --> 00:19:21,080
Like we still get pull requests

418
00:19:21,080 --> 00:19:24,720
that are people cloning the repository, editing the file,

419
00:19:24,720 --> 00:19:26,760
because that was the very original way of doing it.

420
00:19:26,760 --> 00:19:30,440
And there's probably some blog posts and stuff out there

421
00:19:30,440 --> 00:19:33,000
that say, this is how you should add a package to the index.

422
00:19:33,000 --> 00:19:36,000
And so people follow that.

423
00:19:36,000 --> 00:19:40,560
And I do feel like we're kind of,

424
00:19:40,560 --> 00:19:43,680
it's a pain point of the package index

425
00:19:43,680 --> 00:19:47,960
that I don't know how we can easily fix it,

426
00:19:47,960 --> 00:19:51,040
but it has been on my mind a little bit recently.

427
00:19:51,040 --> 00:19:52,960
So there's probably a bit of latent guilt

428
00:19:52,960 --> 00:19:54,760
when Tim asked me a question.

429
00:19:54,760 --> 00:19:59,760
I wanted to confess my sins on the podcast.

430
00:19:59,760 --> 00:20:03,640
- I don't know.

431
00:20:03,640 --> 00:20:05,480
- The sins of adding a package.

432
00:20:05,480 --> 00:20:09,640
- I see the upsides probably more than the downsides here

433
00:20:09,640 --> 00:20:14,200
because even if the list was in a different format

434
00:20:14,200 --> 00:20:16,920
and maybe not hosted in a GitHub repository,

435
00:20:16,920 --> 00:20:20,840
we'd still probably want to have some sort of audit trail

436
00:20:20,840 --> 00:20:22,920
who added it and that.

437
00:20:22,920 --> 00:20:23,760
- Yes.

438
00:20:23,760 --> 00:20:25,560
- Sort of complexity doesn't go away.

439
00:20:25,560 --> 00:20:28,920
In fact, I think using GitHub here is making it easier

440
00:20:28,920 --> 00:20:31,560
because otherwise, would you want to ask people

441
00:20:31,560 --> 00:20:33,440
to create an account to add a package?

442
00:20:33,440 --> 00:20:36,560
I feel like that's worse.

443
00:20:36,560 --> 00:20:41,560
So I can't think of lots of ways to make that

444
00:20:41,560 --> 00:20:45,400
actually smoother than it already is.

445
00:20:45,400 --> 00:20:48,120
- Yeah, so this is entirely why it is still this way.

446
00:20:50,400 --> 00:20:53,440
And I think your point is well-made

447
00:20:53,440 --> 00:20:55,120
that you don't want to get people to add,

448
00:20:55,120 --> 00:20:58,000
create an account simply to add a package.

449
00:20:58,000 --> 00:21:00,560
I think there is gonna come a time

450
00:21:00,560 --> 00:21:04,240
where there are several reasons

451
00:21:04,240 --> 00:21:07,320
you might want an account with package index.

452
00:21:07,320 --> 00:21:10,400
And as that happens, if that happens,

453
00:21:10,400 --> 00:21:13,720
and it's definitely not a foregone conclusion

454
00:21:13,720 --> 00:21:17,720
that it will happen, but that might be the change,

455
00:21:17,720 --> 00:21:20,440
the point that we need to change how we do it.

456
00:21:20,440 --> 00:21:23,840
But you're right that the kind of audit trail

457
00:21:23,840 --> 00:21:26,600
for want of a better word is the reason, that's it.

458
00:21:26,600 --> 00:21:28,440
That's the only reason that it's like this.

459
00:21:28,440 --> 00:21:31,800
- Yeah, and another upside is that the list is available.

460
00:21:31,800 --> 00:21:35,920
If anyone wants to use that list for anything,

461
00:21:35,920 --> 00:21:40,160
like analysis or just have a list of all packages

462
00:21:40,160 --> 00:21:42,680
that are in the index, that's the place to go.

463
00:21:42,680 --> 00:21:45,320
And we don't have to deal with any requests around it.

464
00:21:45,320 --> 00:21:47,520
It's all right there.

465
00:21:47,520 --> 00:21:50,480
So that's certainly a strong reason

466
00:21:50,480 --> 00:21:52,720
to keep it open like this,

467
00:21:52,720 --> 00:21:55,120
which any other system would then have to replicate

468
00:21:55,120 --> 00:21:57,800
or offer in some way.

469
00:21:57,800 --> 00:21:58,640
- That's great.

470
00:21:58,640 --> 00:22:03,200
Okay, shall we do some package recommendations?

471
00:22:03,200 --> 00:22:04,560
- Let's do it.

472
00:22:04,560 --> 00:22:06,680
- Yeah, I can kick us off.

473
00:22:06,680 --> 00:22:11,160
And my first package this week is from Jasmine Eilers

474
00:22:11,160 --> 00:22:14,480
and it's called NSAttributedStringBuilder.

475
00:22:15,640 --> 00:22:18,920
And this is a package that's been around

476
00:22:18,920 --> 00:22:21,920
for only a few weeks.

477
00:22:21,920 --> 00:22:23,080
It's about a month old.

478
00:22:23,080 --> 00:22:27,840
And it is a result builder type package.

479
00:22:27,840 --> 00:22:32,840
So it allows you to create NSAttributedStrings

480
00:22:32,840 --> 00:22:38,480
by defining kind of methods on string objects.

481
00:22:38,480 --> 00:22:44,080
So you could say, for example, hello.font

482
00:22:45,040 --> 00:22:48,800
and then give it a font.italic.foregroundcolor.underline.

483
00:22:48,800 --> 00:22:49,840
It supports images.

484
00:22:49,840 --> 00:22:53,080
So you can say, give it a,

485
00:22:53,080 --> 00:22:56,000
there was an image example here.

486
00:22:56,000 --> 00:22:57,600
I was looking at it earlier.

487
00:22:57,600 --> 00:22:58,440
Oh yeah, here we go.

488
00:22:58,440 --> 00:23:02,800
There's a .image method that you can call on a string,

489
00:23:02,800 --> 00:23:05,960
which says, you know, here's a UI image or whatever it is.

490
00:23:05,960 --> 00:23:08,360
And add that into the attribute to string.

491
00:23:08,360 --> 00:23:10,040
You can put new lines in there.

492
00:23:10,040 --> 00:23:12,360
You can add other attributed strings

493
00:23:12,360 --> 00:23:14,840
if you've already got attributed strings.

494
00:23:14,840 --> 00:23:17,080
And of course, out of the result of this

495
00:23:17,080 --> 00:23:19,880
comes a newly formed attributed string

496
00:23:19,880 --> 00:23:22,760
that you can use all over the place.

497
00:23:22,760 --> 00:23:24,360
And I mean, there are lots of ways

498
00:23:24,360 --> 00:23:26,560
to generate attributed strings these days.

499
00:23:26,560 --> 00:23:30,600
Foundation has markdown parsing these days

500
00:23:30,600 --> 00:23:34,400
and certainly has some level still of HTML parsing.

501
00:23:34,400 --> 00:23:38,080
But if you just want to generate some attributed strings

502
00:23:38,080 --> 00:23:42,440
to pop in your project, that default syntax for it,

503
00:23:43,640 --> 00:23:47,440
I've written many lines of attributed string code

504
00:23:47,440 --> 00:23:48,280
in my time.

505
00:23:48,280 --> 00:23:52,920
And this certainly seems like a significantly easier way

506
00:23:52,920 --> 00:23:56,360
to put together a kind of native attributed string.

507
00:23:56,360 --> 00:23:57,640
- Nice, that sounds really nice.

508
00:23:57,640 --> 00:24:00,800
I haven't actually used an attributed string that much,

509
00:24:00,800 --> 00:24:02,800
but I have seen examples.

510
00:24:02,800 --> 00:24:06,000
So you have to do lots of sort of range stuff, right?

511
00:24:06,000 --> 00:24:09,880
Where you, when you have bold and italic

512
00:24:09,880 --> 00:24:11,000
and that sort of stuff, don't you?

513
00:24:11,000 --> 00:24:12,720
You have to fiddle a bit like.

514
00:24:12,720 --> 00:24:15,680
- Yes, lots of ranges.

515
00:24:15,680 --> 00:24:18,760
I have also just noticed at the bottom of the readme file,

516
00:24:18,760 --> 00:24:21,200
which I didn't see when I was looking at it originally,

517
00:24:21,200 --> 00:24:25,360
it says this project is inspired by Ethan Huang's project,

518
00:24:25,360 --> 00:24:27,600
NSAttributedStringBuilder, which has the same

519
00:24:27,600 --> 00:24:32,600
and svdo/swift-richstring.

520
00:24:32,600 --> 00:24:36,320
So there are a couple of projects here.

521
00:24:36,320 --> 00:24:37,400
And actually we were chatting

522
00:24:37,400 --> 00:24:38,920
just before we recorded the podcast.

523
00:24:38,920 --> 00:24:40,920
And one of the things that I said was,

524
00:24:40,920 --> 00:24:43,400
I have a feeling that we've talked about this before

525
00:24:43,400 --> 00:24:45,880
and we haven't, but it's possible we talked

526
00:24:45,880 --> 00:24:47,000
about one of these other ones before.

527
00:24:47,000 --> 00:24:49,760
- We might have, because I've seen a couple

528
00:24:49,760 --> 00:24:50,760
of packages like this.

529
00:24:50,760 --> 00:24:53,040
And I think it's a great example

530
00:24:53,040 --> 00:24:57,320
where a builder can help construct these things

531
00:24:57,320 --> 00:25:00,240
because they are sort of fiddly to get right.

532
00:25:00,240 --> 00:25:03,040
And I think that's where these kinds of builders

533
00:25:03,040 --> 00:25:06,200
help lay out things in a better way

534
00:25:06,200 --> 00:25:09,760
than by sort of low level fiddling

535
00:25:09,760 --> 00:25:11,040
with properties and stuff.

536
00:25:11,040 --> 00:25:14,880
- And we do have both of those packages in the index.

537
00:25:14,880 --> 00:25:19,480
So that is RichString by Stefan van den Oord

538
00:25:19,480 --> 00:25:22,960
and a package with exactly the same name,

539
00:25:22,960 --> 00:25:26,400
NSAttributedStringBuilder by Ethan Huang.

540
00:25:26,400 --> 00:25:32,640
- My first pick is a pick you have probably seen.

541
00:25:32,640 --> 00:25:34,120
You might even have it in the list,

542
00:25:34,120 --> 00:25:35,920
but I'm going first dibs.

543
00:25:35,920 --> 00:25:40,920
And the package is called PowPOW by Robb Böhnke.

544
00:25:40,920 --> 00:25:44,840
You probably know this package, right?

545
00:25:44,840 --> 00:25:46,120
- I am aware of this package

546
00:25:46,120 --> 00:25:48,000
and I did see the news about this package, yeah.

547
00:25:48,000 --> 00:25:49,000
- So the news this week,

548
00:25:49,000 --> 00:25:52,120
this is actually a now open source version

549
00:25:52,120 --> 00:25:56,480
of the package that was previously a licensed package

550
00:25:56,480 --> 00:25:57,840
that you would buy.

551
00:25:57,840 --> 00:26:00,040
And what it does, the tagline is

552
00:26:00,040 --> 00:26:02,560
delightful SwiftUI effects for your app.

553
00:26:03,680 --> 00:26:08,400
And if you've followed Rob on Mastodon

554
00:26:08,400 --> 00:26:11,880
or perhaps elsewhere, that's where I've seen it.

555
00:26:11,880 --> 00:26:14,960
He's been posting amazing examples

556
00:26:14,960 --> 00:26:16,560
of what this library can do,

557
00:26:16,560 --> 00:26:19,800
like animations, transitions, that sort of stuff.

558
00:26:19,800 --> 00:26:24,000
Really delightful ways of enhancing your UI

559
00:26:24,000 --> 00:26:25,880
and a particular SwiftUI here

560
00:26:25,880 --> 00:26:28,120
with all sorts of modifiers

561
00:26:28,120 --> 00:26:30,880
and things that make it really interesting and fun.

562
00:26:32,600 --> 00:26:34,680
So that's what this package is about,

563
00:26:34,680 --> 00:26:36,720
enhancing your SwiftUI.

564
00:26:36,720 --> 00:26:39,200
There's a great site with examples

565
00:26:39,200 --> 00:26:41,200
of all the effects that are available.

566
00:26:41,200 --> 00:26:43,320
I did try to run it in a playground.

567
00:26:43,320 --> 00:26:45,640
Unfortunately, it doesn't work

568
00:26:45,640 --> 00:26:49,880
with our trying to playground mechanism.

569
00:26:49,880 --> 00:26:51,800
I believe that's, I mean, it runs,

570
00:26:51,800 --> 00:26:53,160
but it doesn't show anything.

571
00:26:53,160 --> 00:26:56,240
I think that's because it uses,

572
00:26:56,240 --> 00:27:00,080
it needs to run on device or at least on a proper simulator,

573
00:27:00,080 --> 00:27:03,400
not just in the playground.

574
00:27:03,400 --> 00:27:05,240
It seems like this is running on a layer

575
00:27:05,240 --> 00:27:07,840
that's not present in Swift playgrounds.

576
00:27:07,840 --> 00:27:09,680
That's my speculation.

577
00:27:09,680 --> 00:27:12,920
But the example page should help give you a preview

578
00:27:12,920 --> 00:27:15,000
of all the things that are available.

579
00:27:15,000 --> 00:27:15,920
And it's extensive.

580
00:27:15,920 --> 00:27:17,160
There's lots of stuff you can do.

581
00:27:17,160 --> 00:27:19,480
And it's just a great package

582
00:27:19,480 --> 00:27:21,240
and people seem to be really excited

583
00:27:21,240 --> 00:27:22,760
that it's now available.

584
00:27:22,760 --> 00:27:23,600
- And by the sound of it,

585
00:27:23,600 --> 00:27:25,520
your cats are also big fans of this package.

586
00:27:25,520 --> 00:27:26,640
- Yeah, absolutely is.

587
00:27:27,760 --> 00:27:30,000
And I say that to save me the pain

588
00:27:30,000 --> 00:27:31,400
of trying to edit those out.

589
00:27:31,400 --> 00:27:36,040
- This is going to be the case for a bit

590
00:27:36,040 --> 00:27:39,120
because apparently I've been,

591
00:27:39,120 --> 00:27:41,120
the server has been lacking around here.

592
00:27:41,120 --> 00:27:45,000
- Yes, I think so.

593
00:27:45,000 --> 00:27:48,480
So I did see that this went to be

594
00:27:48,480 --> 00:27:52,840
a kind of freely available open source project this week.

595
00:27:52,840 --> 00:27:56,280
And I mean, the work that Rob does

596
00:27:56,280 --> 00:28:01,280
in many different aspects of Apple platform development

597
00:28:01,280 --> 00:28:02,680
is remarkable,

598
00:28:02,680 --> 00:28:05,640
but this is another great example of the work that he does.

599
00:28:05,640 --> 00:28:08,600
And I think it's also worth mentioning

600
00:28:08,600 --> 00:28:11,160
that the reason that it went,

601
00:28:11,160 --> 00:28:15,080
that the transition to free and open source this week

602
00:28:15,080 --> 00:28:19,320
was that it's effectively being sponsored by Emerge Tools

603
00:28:19,320 --> 00:28:23,560
who were previous sponsors of the Swift Package Index.

604
00:28:23,560 --> 00:28:28,280
And I took a quick look into the kind of,

605
00:28:28,280 --> 00:28:31,120
not the details of it, of course,

606
00:28:31,120 --> 00:28:33,320
but it looks like Emerge Tools

607
00:28:33,320 --> 00:28:36,360
are actually sponsoring quite a number of Swift packages

608
00:28:36,360 --> 00:28:39,640
in the kind of package ecosystem.

609
00:28:39,640 --> 00:28:42,040
So that is definitely to be encouraged.

610
00:28:42,040 --> 00:28:45,200
And we had a great experience working with them

611
00:28:45,200 --> 00:28:46,640
on the Swift Package Index too.

612
00:28:46,640 --> 00:28:49,280
So it's great to see this happen.

613
00:28:49,280 --> 00:28:54,280
And I'm happy that more people will get to use this package.

614
00:28:54,280 --> 00:28:55,440
- That's fantastic.

615
00:28:55,440 --> 00:28:57,240
I was about to ask if you know any,

616
00:28:57,240 --> 00:28:59,280
because I didn't know of the details why

617
00:28:59,280 --> 00:29:00,280
or how that came about.

618
00:29:00,280 --> 00:29:01,880
I only saw that it ended,

619
00:29:01,880 --> 00:29:05,120
it's hosted in the Emerge Tools GitHub account now,

620
00:29:05,120 --> 00:29:05,960
but that's great.

621
00:29:05,960 --> 00:29:07,040
That's great news.

622
00:29:07,040 --> 00:29:09,200
- Yeah, so I think, you know,

623
00:29:09,200 --> 00:29:11,640
open source needs more funding

624
00:29:11,640 --> 00:29:14,960
and this is a way for that to happen.

625
00:29:14,960 --> 00:29:17,440
And there's obviously a kind of logo

626
00:29:17,440 --> 00:29:20,760
in the header of the readme file there

627
00:29:20,760 --> 00:29:21,800
and various links and stuff.

628
00:29:21,800 --> 00:29:26,800
And if that's what it takes to make open source development,

629
00:29:26,800 --> 00:29:31,240
you know, a more practical and comfortable thing to do,

630
00:29:31,240 --> 00:29:32,400
then that's great.

631
00:29:32,400 --> 00:29:33,560
- Yeah.

632
00:29:33,560 --> 00:29:38,560
- My next package is by Mikhail Vospennikov

633
00:29:38,560 --> 00:29:42,880
and it's called Gestures.

634
00:29:42,880 --> 00:29:45,320
And it's been around for about a year now.

635
00:29:45,320 --> 00:29:50,320
And this is a enhanced gesture API for SwiftUI.

636
00:29:50,320 --> 00:29:54,440
So obviously SwiftUI supports all of the standard

637
00:29:54,440 --> 00:29:57,040
kind of gesture recognizer type gestures

638
00:29:57,040 --> 00:29:59,320
that you would have used in UIKit or,

639
00:29:59,320 --> 00:30:02,040
well, UIKit basically.

640
00:30:02,040 --> 00:30:07,720
But there's still quite a lot of work you need to do

641
00:30:07,720 --> 00:30:09,920
with kind of interpreting the gestures

642
00:30:09,920 --> 00:30:12,520
and seeing, you know, what trigger point,

643
00:30:12,520 --> 00:30:14,760
like if you have a swipe gesture,

644
00:30:14,760 --> 00:30:16,680
you'll obviously get the coordinates

645
00:30:16,680 --> 00:30:17,560
of where you're swiping to

646
00:30:17,560 --> 00:30:19,080
and the distance and stuff like that.

647
00:30:19,080 --> 00:30:21,720
But it's your decision on what to do.

648
00:30:21,720 --> 00:30:23,560
And actually in reality,

649
00:30:23,560 --> 00:30:26,400
there are a bunch of really common things

650
00:30:26,400 --> 00:30:27,240
that you might want to do.

651
00:30:27,240 --> 00:30:32,160
So for example, you might want to add a swipe gesture

652
00:30:32,160 --> 00:30:34,080
that only actually triggers something

653
00:30:34,080 --> 00:30:37,760
when you've moved more than at least 15 points

654
00:30:37,760 --> 00:30:41,800
within the kind of context of that swipe.

655
00:30:41,800 --> 00:30:43,240
And this is what that package does.

656
00:30:43,240 --> 00:30:48,240
So it adds a whole set of extensions

657
00:30:48,240 --> 00:30:54,960
to SwiftUI gesture API that help you locate gestures

658
00:30:54,960 --> 00:31:00,000
and do things like trigger on minimum distance

659
00:31:00,000 --> 00:31:01,200
and that kind of stuff.

660
00:31:01,200 --> 00:31:04,720
So yeah, it gives you coordinate information,

661
00:31:04,720 --> 00:31:07,080
it gives you location information

662
00:31:07,080 --> 00:31:10,160
and very easy to integrate in your project.

663
00:31:10,160 --> 00:31:11,520
And as it says in the readme file,

664
00:31:11,520 --> 00:31:13,360
it's a lightweight package.

665
00:31:13,360 --> 00:31:16,120
So I don't think this is a huge amount of code

666
00:31:16,120 --> 00:31:17,240
that you're adding to your project.

667
00:31:17,240 --> 00:31:18,080
- Nice.

668
00:31:18,080 --> 00:31:23,720
Right, my second pick is called Scintilla Lib

669
00:31:23,720 --> 00:31:25,200
and it's by Danielle.

670
00:31:25,200 --> 00:31:29,000
That's all I have as far as author information goes.

671
00:31:29,000 --> 00:31:32,120
And this is, I'm taking a page

672
00:31:32,120 --> 00:31:35,280
from Dave's book of package picks here,

673
00:31:35,280 --> 00:31:37,280
'cause that's a dependency package

674
00:31:37,280 --> 00:31:40,320
you probably won't need or won't use as a dependency.

675
00:31:40,320 --> 00:31:41,400
(laughs)

676
00:31:41,400 --> 00:31:44,320
But it's a fun project to poke around in

677
00:31:44,320 --> 00:31:46,120
and run the examples of.

678
00:31:46,120 --> 00:31:51,600
What it is, it's a ray tracer ported from Clojure to Swift.

679
00:31:51,600 --> 00:31:56,600
And what it does, it's intended to be used

680
00:31:56,600 --> 00:32:00,000
more like a library rather than like an app or anything,

681
00:32:00,000 --> 00:32:01,480
but you can run it as an app

682
00:32:01,480 --> 00:32:05,120
and it has a little render view and UI

683
00:32:05,120 --> 00:32:07,160
where you can actually just render the thing

684
00:32:07,160 --> 00:32:08,840
and get some output.

685
00:32:08,840 --> 00:32:12,360
And it ships sort of like a Swift UI type DSL

686
00:32:12,360 --> 00:32:14,280
where you can describe the scene,

687
00:32:14,280 --> 00:32:16,280
like your objects, your camera,

688
00:32:16,280 --> 00:32:21,280
and then you can run it and you get a screen

689
00:32:21,280 --> 00:32:23,240
that shows the rendered output.

690
00:32:23,240 --> 00:32:25,640
And I found that really nice.

691
00:32:25,640 --> 00:32:28,280
It gives you something to play with

692
00:32:28,280 --> 00:32:33,280
and give you a little playground to try ray tracing

693
00:32:33,280 --> 00:32:38,080
if you're new to this or if you want to play around with that.

694
00:32:38,960 --> 00:32:41,200
A really fun little project that I ran.

695
00:32:41,200 --> 00:32:43,000
Also something that doesn't run in a playground,

696
00:32:43,000 --> 00:32:46,000
but it is very easy to just stick the examples

697
00:32:46,000 --> 00:32:48,200
in a command line app.

698
00:32:48,200 --> 00:32:51,080
So there's a description in the readme how to set this up.

699
00:32:51,080 --> 00:32:54,640
Effectively just create a blank Xcode project,

700
00:32:54,640 --> 00:32:59,640
command line project, and then paste in the main thing,

701
00:32:59,640 --> 00:33:05,760
the admin decorated result builder thing.

702
00:33:06,040 --> 00:33:09,600
And it is a bit like an app that you create in Swift UI

703
00:33:09,600 --> 00:33:12,440
that you then create in this DSL and you run it

704
00:33:12,440 --> 00:33:15,680
and you get this window and it shows the rendered output.

705
00:33:15,680 --> 00:33:20,680
Really nice little thing to play around with ray tracing.

706
00:33:20,680 --> 00:33:22,920
- I have so many questions.

707
00:33:22,920 --> 00:33:27,920
Does it do its own ray tracing or is it using metal or?

708
00:33:27,920 --> 00:33:29,640
- That's a great question.

709
00:33:29,640 --> 00:33:31,880
(laughing)

710
00:33:35,200 --> 00:33:36,040
- Revenge.

711
00:33:36,040 --> 00:33:40,000
- It opens a window, there's a,

712
00:33:40,000 --> 00:33:43,480
now it draws it line by line.

713
00:33:43,480 --> 00:33:45,040
So there's something happening.

714
00:33:45,040 --> 00:33:48,120
There's not a whole lot of cause firing when that happens.

715
00:33:48,120 --> 00:33:51,240
I don't know under the hood if it's accelerated.

716
00:33:51,240 --> 00:33:53,600
I suspect it isn't.

717
00:33:53,600 --> 00:33:57,040
I think it would be faster if it was.

718
00:33:57,040 --> 00:33:59,440
This seems to be a port from Clojure.

719
00:33:59,440 --> 00:34:03,240
So I don't, I'm too honest.

720
00:34:03,240 --> 00:34:06,080
I don't know how that would work if on either end,

721
00:34:06,080 --> 00:34:08,800
if it was accelerated, but I would imagine if it's,

722
00:34:08,800 --> 00:34:11,240
if it's ported from another language,

723
00:34:11,240 --> 00:34:16,240
it sounds more like it's a pure software ray tracer

724
00:34:16,240 --> 00:34:17,880
that is then ported one to one.

725
00:34:17,880 --> 00:34:21,200
But that's just me speculating without knowing

726
00:34:21,200 --> 00:34:25,240
a whole lot about ray tracing and the mechanics of all that

727
00:34:25,240 --> 00:34:27,920
and metal for that matter.

728
00:34:27,920 --> 00:34:31,640
- Sure, well, certainly I didn't actually spot

729
00:34:31,640 --> 00:34:32,480
that one going through.

730
00:34:32,480 --> 00:34:37,480
So I am gonna go and have a look at that after the show.

731
00:34:37,480 --> 00:34:41,960
My final package this week is kind of along the same lines.

732
00:34:41,960 --> 00:34:46,960
It is called Model 3D View by Freek, F-R-E-E-K.

733
00:34:46,960 --> 00:34:52,920
And what I really liked about,

734
00:34:52,920 --> 00:34:55,520
so the package description is render 3D models

735
00:34:55,520 --> 00:34:57,160
with SwiftUI effortlessly.

736
00:34:57,160 --> 00:35:01,200
And what I kind of liked about this is that

737
00:35:01,200 --> 00:35:05,080
it describes itself as image view for 3D models,

738
00:35:05,080 --> 00:35:08,040
which is an interesting way to think about it

739
00:35:08,040 --> 00:35:12,440
because we use image views all the time just to,

740
00:35:12,440 --> 00:35:14,280
you know, pop an image on the screen.

741
00:35:14,280 --> 00:35:16,600
And we don't really need to think about any of the stuff

742
00:35:16,600 --> 00:35:20,280
that needs to happen to get that image on the screen.

743
00:35:20,280 --> 00:35:26,120
And this Model 3D View package basically does the same

744
00:35:26,120 --> 00:35:27,680
for 3D models.

745
00:35:27,680 --> 00:35:32,680
Now, I know that SwiftUI has native support for USDZ models

746
00:35:32,680 --> 00:35:36,160
through the QuickLook framework, I think.

747
00:35:36,160 --> 00:35:41,880
But this also supports something called GLTF models,

748
00:35:41,880 --> 00:35:45,920
which is Graphics Library Transmission Format,

749
00:35:45,920 --> 00:35:49,840
which I believe is something that came out of WebGL.

750
00:35:49,840 --> 00:35:51,880
And again, I would ask you please,

751
00:35:51,880 --> 00:35:53,760
no detailed questions about this

752
00:35:53,760 --> 00:35:57,320
because my knowledge of this is a Wikipedia article.

753
00:35:57,320 --> 00:35:58,680
(laughs)

754
00:35:58,680 --> 00:36:01,680
We are making the least researched podcast

755
00:36:01,680 --> 00:36:03,960
in the history of podcasting here.

756
00:36:03,960 --> 00:36:09,760
But yes, it supports GLTF files

757
00:36:09,760 --> 00:36:11,800
and you can pop a skybox in there.

758
00:36:11,800 --> 00:36:14,200
So you can have a kind of a 3D background

759
00:36:14,200 --> 00:36:17,560
or a 2D background inside a skybox.

760
00:36:17,560 --> 00:36:18,520
You can change lighting,

761
00:36:18,520 --> 00:36:21,640
you've got some interactive camera controls.

762
00:36:21,640 --> 00:36:25,440
And the best bit about it, as far as I'm concerned,

763
00:36:25,440 --> 00:36:30,440
is you can pop a Model 3D View into your SwiftUI View

764
00:36:30,440 --> 00:36:34,040
and the only parameter you need

765
00:36:34,040 --> 00:36:38,320
is to pass the model file name in.

766
00:36:38,320 --> 00:36:39,680
And there you go.

767
00:36:39,680 --> 00:36:42,520
You can then, if you want to, you can transform it,

768
00:36:42,520 --> 00:36:46,040
you can rotate it, you can scale it, you can transform it.

769
00:36:46,040 --> 00:36:47,880
You can give it a new camera.

770
00:36:47,880 --> 00:36:49,360
You know, there's lots of different things

771
00:36:49,360 --> 00:36:50,640
including interactive cameras.

772
00:36:50,640 --> 00:36:52,480
And as I say, like things like skyboxes

773
00:36:52,480 --> 00:36:53,480
and stuff like that.

774
00:36:54,720 --> 00:36:58,600
But I liked the description of this as like,

775
00:36:58,600 --> 00:37:02,120
well, this is image view for 3D objects.

776
00:37:02,120 --> 00:37:06,000
And that I think is a really nice utility

777
00:37:06,000 --> 00:37:08,680
to have inside apps these days.

778
00:37:08,680 --> 00:37:11,960
In the frequently asked questions,

779
00:37:11,960 --> 00:37:14,160
there's a question here.

780
00:37:14,160 --> 00:37:16,080
Can I use this to make a 3D game?

781
00:37:16,080 --> 00:37:18,920
And the answer is in bold, no.

782
00:37:18,920 --> 00:37:21,160
(laughing)

783
00:37:23,200 --> 00:37:27,520
So yeah, so it's not, this is not a 3D framework.

784
00:37:27,520 --> 00:37:30,120
This is just, as I say, image view for 3D.

785
00:37:30,120 --> 00:37:31,200
- Nice.

786
00:37:31,200 --> 00:37:32,920
Did you mention the,

787
00:37:32,920 --> 00:37:35,520
I think you mentioned a couple of formats like 3D,

788
00:37:35,520 --> 00:37:37,720
but Model 3D wasn't a format.

789
00:37:37,720 --> 00:37:42,720
It's a placeholder for any sort of supported 3D format,

790
00:37:42,720 --> 00:37:43,560
right?

791
00:37:43,560 --> 00:37:44,560
- Yes.

792
00:37:44,560 --> 00:37:46,800
I'm not sure of the full list of formats it supports,

793
00:37:46,800 --> 00:37:49,040
but I know it supports this GLTF

794
00:37:49,040 --> 00:37:50,960
because it calls it out specifically.

795
00:37:51,840 --> 00:37:55,280
So, but yeah, Model 3D view is the name of the view

796
00:37:55,280 --> 00:37:58,120
that you would insert into your SwiftUI view hierarchy.

797
00:37:58,120 --> 00:37:59,520
- Nice.

798
00:37:59,520 --> 00:38:00,840
Yeah, it's interesting with these,

799
00:38:00,840 --> 00:38:03,480
that has largely gone away, right,

800
00:38:03,480 --> 00:38:08,480
with the graphics format, display format.

801
00:38:08,480 --> 00:38:10,040
I remember back in the day,

802
00:38:10,040 --> 00:38:13,600
one of the most used programs on my Mac

803
00:38:13,600 --> 00:38:15,760
was graphics converter.

804
00:38:15,760 --> 00:38:18,040
To convert between all the different formats

805
00:38:18,040 --> 00:38:19,520
that you would find on the internet.

806
00:38:19,520 --> 00:38:22,960
And you couldn't actually display unless you use that tool

807
00:38:22,960 --> 00:38:25,600
or converted it with that tool to a format

808
00:38:25,600 --> 00:38:27,400
that the Mac could display out of the box.

809
00:38:27,400 --> 00:38:30,160
So we've come a long way

810
00:38:30,160 --> 00:38:33,160
where anything is really supported, isn't it,

811
00:38:33,160 --> 00:38:34,920
with 2D graphics at least?

812
00:38:34,920 --> 00:38:36,600
- Without even,

813
00:38:36,600 --> 00:38:38,240
you don't even have to think about it anymore.

814
00:38:38,240 --> 00:38:39,080
You just kind of say,

815
00:38:39,080 --> 00:38:43,520
images are as easy to work with as text.

816
00:38:43,520 --> 00:38:46,120
Whereas I remember in my very early days

817
00:38:46,120 --> 00:38:51,120
writing Object Pascal to decode Windows bitmap files

818
00:38:51,120 --> 00:38:53,200
and having to read byte by byte.

819
00:38:53,200 --> 00:38:57,680
And yeah, it was a very long time ago.

820
00:38:57,680 --> 00:38:59,920
- It's interesting with live text,

821
00:38:59,920 --> 00:39:01,920
it goes even further that they're not,

822
00:39:01,920 --> 00:39:04,760
they're sort of sometimes even equivalent to text, right?

823
00:39:04,760 --> 00:39:08,920
I've had cases where I had something

824
00:39:08,920 --> 00:39:11,720
and I took a picture and then copied the text out

825
00:39:11,720 --> 00:39:15,080
in like a router password that I didn't want to type.

826
00:39:15,080 --> 00:39:20,080
Where it's become almost synonymous in some regards.

827
00:39:20,080 --> 00:39:22,360
There's a little bit of friction still

828
00:39:22,360 --> 00:39:25,800
in taking a picture and using it as text,

829
00:39:25,800 --> 00:39:29,200
but it's surprisingly little friction these days.

830
00:39:29,200 --> 00:39:30,320
It's amazing.

831
00:39:30,320 --> 00:39:32,160
- Yeah, I use that all the time too.

832
00:39:32,160 --> 00:39:36,000
- Right, my third pick is called

833
00:39:36,000 --> 00:39:39,240
SwiftUI Core Image by Dan Wood.

834
00:39:39,240 --> 00:39:43,880
And this is a really interesting package.

835
00:39:43,880 --> 00:39:48,440
So what it does as the name pretty much says already,

836
00:39:48,440 --> 00:39:51,560
it integrates Core Image into SwiftUI

837
00:39:51,560 --> 00:39:56,000
and gives you a sort of modifier based way

838
00:39:56,000 --> 00:40:00,640
of applying or creating image pipelines and preview them.

839
00:40:00,640 --> 00:40:01,920
Like for instance, in a playground.

840
00:40:01,920 --> 00:40:04,320
So this is something that you can actually use

841
00:40:04,320 --> 00:40:06,640
with our Try in a Playground feature.

842
00:40:06,640 --> 00:40:09,440
And it's really nice to take an image

843
00:40:09,440 --> 00:40:11,600
and then create these pipelines,

844
00:40:11,600 --> 00:40:14,560
like apply a sepia filter, a Gaussian blur,

845
00:40:14,560 --> 00:40:15,400
or something like that.

846
00:40:15,400 --> 00:40:19,320
So all the things that you know from Core Image.

847
00:40:19,320 --> 00:40:22,720
And I've not used that a lot,

848
00:40:22,720 --> 00:40:26,000
but Core Image is a different beast, right?

849
00:40:26,000 --> 00:40:28,800
It's a completely different API.

850
00:40:28,800 --> 00:40:31,520
So having that available and being able to use that

851
00:40:31,520 --> 00:40:35,560
on regular SwiftUI images is really nice.

852
00:40:35,560 --> 00:40:38,120
And it has dozens and dozens of modifiers.

853
00:40:38,120 --> 00:40:42,360
So it looks like it's a really extensive coverage

854
00:40:42,360 --> 00:40:44,000
of the Core Image API.

855
00:40:44,000 --> 00:40:46,200
It has some nice examples as well,

856
00:40:46,200 --> 00:40:48,400
and is an all around great package

857
00:40:48,400 --> 00:40:49,800
if you have that sort of a need

858
00:40:49,800 --> 00:40:52,200
to create a Core Image pipeline

859
00:40:52,200 --> 00:40:56,800
and play around with transforming images.

860
00:40:56,800 --> 00:40:58,280
- And there's a whole load of stuff

861
00:40:58,280 --> 00:41:01,440
that Core Image can do that you would probably

862
00:41:01,440 --> 00:41:02,600
be surprised at.

863
00:41:02,600 --> 00:41:05,920
It's an API which has been around for a long time,

864
00:41:05,920 --> 00:41:07,520
but it's a very powerful API.

865
00:41:07,520 --> 00:41:08,720
- Yeah.

866
00:41:08,720 --> 00:41:09,720
So, yep, there you go.

867
00:41:09,720 --> 00:41:12,960
SwiftUI Core Image by Dan Wood.

868
00:41:12,960 --> 00:41:14,040
- And so I think that brings us

869
00:41:14,040 --> 00:41:16,440
to the end of today's episode.

870
00:41:16,440 --> 00:41:18,720
And actually this will be, as I mentioned,

871
00:41:18,720 --> 00:41:21,280
at the end of last week's episode,

872
00:41:21,280 --> 00:41:23,000
or the last episode that we published.

873
00:41:23,000 --> 00:41:28,000
This will be the last podcast that we record in 2023.

874
00:41:28,000 --> 00:41:32,920
So I wanna wish everybody happy holidays

875
00:41:32,920 --> 00:41:35,720
and thank you for listening this year.

876
00:41:35,720 --> 00:41:38,120
It's been something that I've really enjoyed

877
00:41:38,120 --> 00:41:40,600
doing again this year,

878
00:41:40,600 --> 00:41:44,920
and I'm happy to see that it's gaining some traction

879
00:41:44,920 --> 00:41:47,040
and people mention it more and more.

880
00:41:47,040 --> 00:41:50,680
And so really happy to kind of see it

881
00:41:50,680 --> 00:41:52,560
find its feet a little bit.

882
00:41:52,560 --> 00:41:53,680
Because when we started this,

883
00:41:53,680 --> 00:41:56,000
we didn't really know what it would become.

884
00:41:56,000 --> 00:41:58,200
We started this actually as Twitter Spaces,

885
00:41:58,200 --> 00:42:03,200
and it was a very low effort affair at the beginning.

886
00:42:04,280 --> 00:42:09,280
We just jumped on, no attention paid to audio quality

887
00:42:09,280 --> 00:42:14,880
or indeed the quality of the content that we talked about,

888
00:42:14,880 --> 00:42:17,720
which has remained, as you've heard today.

889
00:42:17,720 --> 00:42:20,200
But we didn't really know where it would go.

890
00:42:20,200 --> 00:42:23,160
And as we come to the end of 2023,

891
00:42:23,160 --> 00:42:25,960
I think it's worth just kind of saying

892
00:42:25,960 --> 00:42:27,720
thank you so much for listening.

893
00:42:27,720 --> 00:42:28,840
Please do, if you enjoy it,

894
00:42:28,840 --> 00:42:32,520
please do share the podcast with other people

895
00:42:32,520 --> 00:42:35,320
and we'll be back next year.

896
00:42:35,320 --> 00:42:36,400
- Yeah, thanks for listening.

897
00:42:36,400 --> 00:42:38,400
Do let us know if you have questions, comments,

898
00:42:38,400 --> 00:42:40,480
always love to hear what people think

899
00:42:40,480 --> 00:42:43,400
or if you have questions, ask us and we'll address it.

900
00:42:43,400 --> 00:42:47,640
And yeah, happy holidays and see you next year.

901
00:42:47,640 --> 00:42:48,680
- See you next year.

902
00:42:48,680 --> 00:42:50,800
Bye-bye. - Bye-bye.