Skip to content

Commit 744f7a0

Browse files
authored
Merge pull request #32 from shan-weiqiang/master
翻译第 1 集 555 - 605 条字幕
2 parents 3971de1 + 2a8765b commit 744f7a0

File tree

1 file changed

+53
-68
lines changed

1 file changed

+53
-68
lines changed

subtitles/zh-Hans/Lecture 1. Course Logistics and Introduction to SwiftUI.srt

Lines changed: 53 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -2270,224 +2270,209 @@ Swift 里的结构体和其他语言类似
22702270

22712271
555
22722272
00:23:28,440 --> 00:23:29,860
2273-
This is not object-oriented programming.
2273+
这不是面向对象编程
22742274

22752275
556
22762276
00:23:29,860 --> 00:23:31,450
2277-
This is functional programming.
2277+
这是函数式编程
22782278

22792279
557
22802280
00:23:31,450 --> 00:23:33,410
2281-
And that's why we may be more likely
2281+
这也是为什么我们更倾向于
22822282

22832283
558
22842284
00:23:33,410 --> 00:23:36,680
2285-
to say something like a
2286-
ContentView functions like a View
2285+
说 ContentView 像 View 一样运作
22872286

22882287
559
22892288
00:23:36,680 --> 00:23:39,290
2290-
or it behaves like a View.
2289+
或者它的行为像 View
22912290

22922291
560
22932292
00:23:39,290 --> 00:23:41,330
2294-
And this is super important.
2293+
这是非常重要的
22952294

22962295
561
22972296
00:23:41,330 --> 00:23:44,680
2298-
This behavior, View, is crucial
2297+
你会发现 View 这个行为
22992298

23002299
562
23012300
00:23:44,680 --> 00:23:47,810
2302-
to how all of SwiftUI
2303-
works as you will see.
2301+
是 SwiftUI 实现中非常关键的
23042302

23052303
563
23062304
00:23:47,810 --> 00:23:49,950
2307-
We are going to be using so many Views
2305+
我们将会使用非常多的 View
23082306

23092307
564
23102308
00:23:49,950 --> 00:23:53,320
2311-
in the next couple of lectures,
2312-
you can't even imagine it.
2309+
在接下来的几节课中
2310+
你甚至都想象不到有多少
23132311

23142312
565
23152313
00:23:53,320 --> 00:23:55,730
2316-
And we're gonna talk
2317-
all about the concepts
2314+
通过第二节课开始的幻灯片
23182315

23192316
566
23202317
00:23:55,730 --> 00:23:59,110
2321-
behind this behavior specification
2318+
我们也会讨论声明这个行为
23222319

23232320
567
23242321
00:23:59,110 --> 00:24:01,650
2325-
using slides at the
2326-
beginning of lecture two.
2322+
背后所有的概念
23272323

23282324
568
23292325
00:24:01,650 --> 00:24:03,870
2330-
In the meantime, we're
2331-
just going to understand
2326+
同时,现在我们只要理解
23322327

23332328
569
23342329
00:24:03,870 --> 00:24:07,133
2335-
that this means that
2336-
ContentView behaves like a View.
2330+
这个意思是 ContentView
2331+
View 一样的行为
23372332

23382333
570
23392334
00:24:07,980 --> 00:24:11,390
2340-
A View is just a
2341-
rectangular area on screen.
2335+
一个 View 只是屏幕上的一个长方形区域
23422336

23432337
571
23442338
00:24:11,390 --> 00:24:14,280
2345-
So here I've put my mouse on this Text
2339+
这里我把鼠标放在这个 Text
23462340

23472341
572
23482342
00:24:14,280 --> 00:24:15,853
2349-
and it's selected it
2350-
over here in the preview.
2343+
它就在这边预览里被选中了
23512344

23522345
573
23532346
00:24:15,853 --> 00:24:19,970
2354-
And you can see it's put this
2355-
blue border around that Text.
2347+
你可以看到这里 Text 的周围有蓝色边框
23562348

23572349
574
23582350
00:24:19,970 --> 00:24:22,310
2359-
That blue border is bordering this View.
2351+
那个蓝色边框就是这个 View 的边界
23602352

23612353
575
23622354
00:24:22,310 --> 00:24:25,210
2363-
So a Text, it also behaves like a View.
2355+
所以 Text 也有 View 一样的行为
23642356

23652357
576
23662358
00:24:25,210 --> 00:24:26,520
2367-
It "is a" View.
2359+
它也“是”个 View
23682360

23692361
577
23702362
00:24:26,520 --> 00:24:28,120
2371-
And so you're seeing it right here.
2363+
所以你能在这里看到它
23722364

23732365
578
23742366
00:24:28,120 --> 00:24:29,440
2375-
So that's all Views are.
2367+
这就是 View
23762368

23772369
579
23782370
00:24:29,440 --> 00:24:31,610
2379-
They're rectangular areas on screen,
2371+
它们是屏幕上的长方形区域
23802372

23812373
580
23822374
00:24:31,610 --> 00:24:34,560
2383-
both for drawing and also for multi-touch.
2375+
既用于显示,也支持多点触控
23842376

23852377
581
23862378
00:24:34,560 --> 00:24:37,870
2387-
For swipes and taps, pinches,
2379+
滑动、点击、缩放
23882380

23892381
582
23902382
00:24:37,870 --> 00:24:41,120
2391-
those kinds of things
2392-
happen in these rectangles.
2383+
这类操作都在这个长方形里面发生
23932384

23942385
583
23952386
00:24:41,120 --> 00:24:42,640
2396-
So that's what a View is.
2387+
所以这就是 View
23972388

23982389
584
23992390
00:24:42,640 --> 00:24:44,670
2400-
So when something behaves like a View,
2391+
当一个东西有 View 一样的行为
24012392

24022393
585
24032394
00:24:44,670 --> 00:24:46,330
2404-
it's a rectangular area on screen.
2395+
它就是屏幕上一个长方形的区域
24052396

24062397
586
24072398
00:24:46,330 --> 00:24:49,250
2408-
So our ContentView which
2409-
behaves like a View
2399+
我们的 ContentView 有 View 一样的行为
24102400

24112401
587
24122402
00:24:49,250 --> 00:24:51,900
2413-
is this entire rectangle.
2403+
它就是这里的一整个长方形
24142404

24152405
588
24162406
00:24:51,900 --> 00:24:54,640
2417-
The whole rectangle that fills the screen
2407+
充满屏幕的整个长方形
24182408

24192409
589
24202410
00:24:54,640 --> 00:24:56,173
2421-
is our ContentView.
2411+
就是我们的 ContentView
24222412

24232413
590
24242414
00:24:57,296 --> 00:24:59,890
2425-
All right, if you are somebody,
2415+
如果你是
24262416

24272417
591
24282418
00:24:59,890 --> 00:25:02,260
2429-
some struct like this ContentView,
2419+
比如像这个 ContentView 一样的结构体
24302420

24312421
592
24322422
00:25:02,260 --> 00:25:05,320
2433-
and you want to say that
2434-
you behave like a View,
2423+
且你想有 View 一样的行为
24352424

24362425
593
24372426
00:25:05,320 --> 00:25:10,320
2438-
you must in your struct
2439-
have this var right here,
2427+
在你的结构体中必须有这个变量
24402428

24412429
594
24422430
00:25:10,360 --> 00:25:12,850
2443-
this var called body.
2431+
这个叫做 body 的变量
24442432

24452433
595
24462434
00:25:12,850 --> 00:25:14,330
2447-
I'll select it for you here.
2435+
就是我这里选中的这个
24482436

24492437
596
24502438
00:25:14,330 --> 00:25:17,190
2451-
So here's the declaration of var body.
2439+
这里就是变量 body 的声明
24522440

24532441
597
24542442
00:25:17,190 --> 00:25:20,890
2455-
So Swift variables, they
2456-
have the keyword var,
2443+
Swift 的变量使用关键词 var
24572444

24582445
598
24592446
00:25:20,890 --> 00:25:22,210
2460-
short for variable.
2447+
单词 variable 的缩写
24612448

24622449
599
24632450
00:25:22,210 --> 00:25:24,910
2464-
Although we don't tend to call variables
2451+
尽管在一个结构体中
24652452

24662453
600
24672454
00:25:24,910 --> 00:25:27,700
2468-
inside a struct like this vars.
2455+
我们一般不称它为变量
24692456

24702457
601
24712458
00:25:27,700 --> 00:25:29,770
2472-
We call them properties.
2459+
我们把它们称为属性
24732460

24742461
602
24752462
00:25:29,770 --> 00:25:32,870
2476-
So you're gonna hear me use
2477-
the word property all the time.
2463+
你们将会一直听我使用属性这个词
24782464

24792465
603
24802466
00:25:32,870 --> 00:25:36,010
2481-
It means a var inside a struct or a class.
2467+
它的意思是类或者结构体中的变量
24822468

24832469
604
24842470
00:25:36,010 --> 00:25:38,120
2485-
Also, if we're doing
2486-
object-oriented programming,
2471+
如果我们做面向对象编程
24872472

24882473
605
24892474
00:25:38,120 --> 00:25:40,210
2490-
we call them properties.
2475+
我们把它们称为属性
24912476

24922477
606
24932478
00:25:40,210 --> 00:25:44,680

0 commit comments

Comments
 (0)