Skip to content

Commit 5ed3abf

Browse files
committed
3_1198-1610 初校
Minor changes
1 parent 57eef31 commit 5ed3abf

File tree

1 file changed

+43
-43
lines changed

1 file changed

+43
-43
lines changed

subtitles/3. More Swift and the Foundation Framework.srt

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -5604,12 +5604,12 @@ But just so that you know that NSNumber is around. Okay,
56045604
1221
56055605
01:05:35,835 --> 01:05:38,670
56065606
date. Super important class. Anytime you are representing
5607-
Date 是一个非常重要的结构体。任何时候,你想表达一个日期或时间
5607+
Date 是一个非常重要的结构体。任何时候
56085608

56095609
1222
56105610
01:05:38,738 --> 01:05:42,674
56115611
a date or time, you're gonna wanna use this date struct.
5612-
都要用到 Date 这个结构体
5612+
你想表达一个日期或时间,都要用到 Date 这个结构体
56135613

56145614
1223
56155615
01:05:42,743 --> 01:05:46,144
@@ -5649,7 +5649,7 @@ all over the Earth that are different than ours.
56495649
1230
56505650
01:06:02,596 --> 01:06:05,697
56515651
So anytime you're even contemplating putting a date
5652-
因此,当你考虑在界面上摆放一个日期的时候
5652+
因此,当你考虑在界面上展示一个日期的时候
56535653

56545654
1231
56555655
01:06:05,766 --> 01:06:09,568
@@ -5659,7 +5659,7 @@ anywhere in your UI you need to be using this class.
56595659
1232
56605660
01:06:09,636 --> 01:06:12,270
56615661
Because if you wanna have your app work in anything but
5662-
如果你希望你的应用可以正常工作在非英语环境下
5662+
如果你希望你的应用可以在非英语环境下正常工作
56635663

56645664
1233
56655665
01:06:12,339 --> 01:06:14,639
@@ -5669,7 +5669,7 @@ English, you're gonna have to format your date, using
56695669
1234
56705670
01:06:14,708 --> 01:06:19,744
56715671
the DateFormatter, in whatever locale your app is running in.
5672-
将日期转化成应用所处的本地化语言
5672+
把日期用当地的习惯表达
56735673

56745674
1235
56755675
01:06:19,813 --> 01:06:22,514
@@ -5729,12 +5729,12 @@ It gets passed around copy on right. And
57295729
1246
57305730
01:06:54,114 --> 01:06:56,882
57315731
you'll start seeing data in UI maybe week five or
5732-
你们将会在 UI 部分开始接触到它
5732+
你们将会在第五或第六周 UI 部分开始接触到它
57335733

57345734
1247
57355735
01:06:56,950 --> 01:07:00,686
57365736
six of this class. All right, initialization.
5737-
可能是这个课程的第五或第六周。接下来是 Initialization(构造)
5737+
接下来是 Initialization(构造)
57385738

57395739
1248
57405740
01:07:00,754 --> 01:07:04,122
@@ -5833,13 +5833,13 @@ So you can have as many inits as you want.
58335833

58345834
1267
58355835
01:08:00,347 --> 01:08:02,914
5836-
And a lot of classes have multiple inits. Meaning on
5836+
And a lot of classes have multiple inits. Depending on
58375837
也确实有很多类都有不止一个构造器
58385838

58395839
1268
58405840
01:08:02,983 --> 01:08:04,649
58415841
kinda how they are being used, how they are being created.
5842-
意味着它们拥有多种不同的使用方式和创建方式
5842+
创建过程取决于使用方式
58435843

58445844
1269
58455845
01:08:04,718 --> 01:08:06,217
@@ -6019,7 +6019,7 @@ You can set lets. So you're gonna have a let that's
60196019
1304
60206020
01:09:50,657 --> 01:09:54,826
60216021
got lets x equal 5. You can still reset it in your init.
6022-
可以令 x = 5,构造器内是可以这样做的
6022+
let x = 5,构造器内仍然可以重设它
60236023

60246024
1305
60256025
01:09:54,895 --> 01:09:59,330
@@ -6084,7 +6084,7 @@ let's start thinking about class and break this down.
60846084
1317
60856085
01:10:31,264 --> 01:10:34,699
60866086
Let's start with what are you required to do in an init for
6087-
我们从这个问题切入:在类的构造器中我们必须做的事情是什么
6087+
我们从这个问题切入:在类的构造器中必须做的是什么
60886088

60896089
1318
60906090
01:10:34,768 --> 01:10:37,969
@@ -6304,12 +6304,12 @@ This, in this case, you have to do convenience,
63046304
1361
63056305
01:12:43,664 --> 01:12:46,164
63066306
you have to call your other one first.
6307-
你必须先调一个自身的其他构造器
6307+
你必须先调用一个自身的其他构造器
63086308

63096309
1362
63106310
01:12:46,232 --> 01:12:50,969
63116311
And the calling of all other inits, whatever you do, any
6312-
任何其他构造器,无论调哪个都行
6312+
任何其他构造器,无论哪个都行
63136313

63146314
1363
63156315
01:12:51,037 --> 01:12:54,539
@@ -6429,7 +6429,7 @@ Of course, you could inherit them all by implementing
64296429
1386
64306430
01:13:59,406 --> 01:14:04,008
64316431
none of them as well. So, any init that you inherit by these
6432-
也一样能继承父类全部的便利构造器
6432+
也一样能继承父类全部的便利构造器
64336433

64346434
1387
64356435
01:14:04,077 --> 01:14:06,611
@@ -6534,12 +6534,12 @@ a failed init, you can return nil. So, an example here is
65346534
1407
65356535
01:14:58,799 --> 01:15:02,968
65366536
UIImage. UIImaged named looks up that image in
6537-
拿 UIImage 来举例,UIImage(named:) 会在 xcassets 文件中寻找
6537+
拿 UIImage 举例,UIImage(named:) 会在
65386538

65396539
1408
65406540
01:15:03,036 --> 01:15:05,904
65416541
the xcassets. Remember that xcassets thing that I moved
6542-
指定的图片。还记得 xcassets 文件吗?
6542+
xcassets 文件中寻找指定的图片。还记得 xcassets 文件吗?
65436543

65446544
1409
65456545
01:15:05,973 --> 01:15:08,806
@@ -6569,7 +6569,7 @@ that UIImage initializer failed. Alright, Any and
65696569
1414
65706570
01:15:22,822 --> 01:15:27,259
65716571
AnyObject. There is no more init, we're done with init.
6572-
下面是 Any 和 AnyObject
6572+
下面是 Any 和 AnyObject,不讲构造器了
65736573

65746574
1415
65756575
01:15:27,327 --> 01:15:31,262
@@ -6579,12 +6579,12 @@ Any 和 AnyObject 都是类型,特殊的类型
65796579
1416
65806580
01:15:31,331 --> 01:15:35,133
65816581
These types really are almost exclusively used for backwards
6582-
几乎可以这样理解,这些类型仅仅是为了向下兼容 Objective-C 而存在的
6582+
几乎可以这样理解,这些类型的存在仅仅是为了
65836583

65846584
1417
65856585
01:15:35,202 --> 01:15:39,004
65866586
compatibility with Objective C because Objective C had a type
6587-
因为 Objective-C 中有一个类型叫做 id
6587+
向下兼容 Objective-C 中叫做 id 的一个类型
65886588

65896589
1418
65906590
01:15:39,072 --> 01:15:41,740
@@ -6614,7 +6614,7 @@ have a type which is like, it can be anything. Okay, because
66146614
1423
66156615
01:15:55,622 --> 01:15:58,022
66166616
that's what Any and AnyObject are, it's like anything,
6617-
Any 和 AnyObject 具有能代表任何类型的特性
6617+
Any 和 AnyObject 能代表任何类型
66186618

66196619
1424
66206620
01:15:58,091 --> 01:16:02,928
@@ -6654,7 +6654,7 @@ Where are they gonna show up? Well,
66546654
1431
66556655
01:16:15,909 --> 01:16:18,710
66566656
there are some methods in iOS where one of the arguments
6657-
iOS 中有一些方法确实需要能接受任何类型的参数
6657+
iOS 中有一些方法确实能接受任何类型的参数
66586658

66596659
1432
66606660
01:16:18,779 --> 01:16:22,847
@@ -6684,7 +6684,7 @@ Segue 的发起者
66846684
1437
66856685
01:16:33,994 --> 01:16:37,095
66866686
is the argument in this method called prepare for
6687-
就是这个方法 prepare(for:sender:)
6687+
就是方法 prepare(for:sender:)
66886688

66896689
1438
66906690
01:16:37,164 --> 01:16:39,031
@@ -6724,7 +6724,7 @@ So when you're preparing for it, you've gotta be
67246724
1445
67256725
01:16:55,983 --> 01:16:59,918
67266726
able to say which one it was, and that's just Any. So
6727-
你已经可以确定 sender 是什么东西了,这里用 Any 正合适
6727+
你要能接受任何类型的 sender,所以这里用 Any
67286728

67296729
1446
67306730
01:16:59,987 --> 01:17:02,621
@@ -6799,17 +6799,17 @@ Swift 中,如果我们要把 Double 和 String
67996799
1460
68006800
01:17:43,530 --> 01:17:46,265
68016801
strings in the same array, we use an enum.
6802-
放入同一个数组,应该使用 Enum(枚举)
6802+
放入同一个数组,应该使用 enum(枚举)
68036803

68046804
1461
68056805
01:17:46,333 --> 01:17:48,200
68066806
That's what we did with our operations array, and that's
6807-
我们在之前(CalculatorBrain 中)存放操作符的数组就是这样实现的
6807+
就像之前 CalculatorBrain 中存放操作符的数组
68086808

68096809
1462
68106810
01:17:48,268 --> 01:17:51,236
68116811
what we would do in Swift, so we wouldn't use AnyObject.
6812-
这才是我们应该在 Swift 中用的方式,不要用 AnyObject
6812+
这才是我们在 Swift 中实现的方式,不要用 AnyObject
68136813

68146814
1463
68156815
01:17:51,305 --> 01:17:53,171
@@ -6854,7 +6854,7 @@ that. How do we use something of type Any, because we can't
68546854
1471
68556855
01:18:08,055 --> 01:18:10,822
68566856
send any messages to it cuz it's not of any type, so
6857-
我们没法给 Any 类型的变量发送消息,因为它不是任何类型
6857+
我们没法给 Any 类型的变量发送消息。它不是任何类型
68586858

68596859
1472
68606860
01:18:10,891 --> 01:18:14,426
@@ -6869,7 +6869,7 @@ we have convert it, and we convert type Any or, or
68696869
1474
68706870
01:18:18,131 --> 01:18:23,001
68716871
AnyObject into some class that we know about using as.
6872-
转换为我们已知的类型
6872+
用 as 转换为我们已知的类型
68736873

68746874
1475
68756875
01:18:23,070 --> 01:18:26,205
@@ -6939,12 +6939,12 @@ So that's how we use it. We use this "as?", it's called
69396939
1488
69406940
01:19:06,547 --> 01:19:09,614
69416941
casting. This casting, by the way, not just for AnyObject,
6942-
这种操作叫做 Casting(类型检查)不仅是 AnyObject(或 Any
6942+
这种操作叫 Casting(类型检查)不仅是 AnyObjectAny
69436943

69446944
1489
69456945
01:19:09,683 --> 01:19:12,951
69466946
we can cast other things. For example, if I had a variable
6947-
我们也可以检查其他类型。比如有一个变量 vc
6947+
其他类型我们也可以检查。比如有一个变量 vc
69486948

69496949
1490
69506950
01:19:13,020 --> 01:19:15,987
@@ -7019,17 +7019,17 @@ as a CalculatorViewController Now I can send displayValue to
70197019
1504
70207020
01:19:55,195 --> 01:19:59,598
70217021
calcVC. Cuz it's the type that you actually
7022-
因为 vc 的类型是你强加给它的
7022+
因为 vc 明确声明了类型
70237023

70247024
1505
70257025
01:19:59,667 --> 01:20:02,234
70267026
type it as that matters, not what it's pointing to. So you
7027-
并不是它真实指向的类型
7027+
所以 Swift 不考虑实际指向的类型
70287028

70297029
1506
70307030
01:20:02,302 --> 01:20:04,870
70317031
have to use as to get it to be something that you really
7032-
所以使用前必须先转换为你想要的那个类型
7032+
因此使用前必须先转换为你想要的那个类型
70337033

70347034
1507
70357035
01:20:04,939 --> 01:20:08,606
@@ -7054,12 +7054,12 @@ User defaults is a very lightweight,
70547054
1511
70557055
01:20:15,716 --> 01:20:19,618
70567056
limited database. It's a tiny little database that persists
7057-
它是一个可以在应用多次启动之间保存持久化数据的微型数据库
7057+
它是一个可以在应用多次启动之间
70587058

70597059
1512
70607060
01:20:19,687 --> 01:20:21,687
70617061
between launchings of your app. It's great for
7062-
它非常适合用来
7062+
保存持久化数据的微型数据库,非常适合用来
70637063

70647064
1513
70657065
01:20:21,756 --> 01:20:23,255
@@ -7094,7 +7094,7 @@ a number, like int, float, double, whatever.
70947094
1519
70957095
01:20:37,771 --> 01:20:40,038
70967096
That's what a property list is. It's just conceptual.
7097-
这就是概念上的属性列表
7097+
这就是属性列表的概念
70987098

70997099
1520
71007100
01:20:40,107 --> 01:20:42,707
@@ -7134,7 +7134,7 @@ this is what it looks like. It has this core, set, and
71347134
1527
71357135
01:21:01,662 --> 01:21:05,931
71367136
get. Set Any? Now that Any can't really be Any,
7137-
set 接受 Any 类型?注意这里的 Any 并不是任何类型都可以
7137+
set 接受 Any? 类型。注意这里 Any 并不是任何类型都可以
71387138

71397139
1528
71407140
01:21:06,000 --> 01:21:07,933
@@ -7164,7 +7164,7 @@ And then you get it back out by saying, object for key, and
71647164
1533
71657165
01:21:16,710 --> 01:21:19,210
71667166
it returns you an Any. And it's an optional Any because
7167-
它会返回给你一个 Any,一个可选类型的 Any
7167+
它会返回给你一个 Any?,一个可选类型的 Any
71687168

71697169
1534
71707170
01:21:19,279 --> 01:21:20,445
@@ -7239,7 +7239,7 @@ one setting an array of ints. An array of ints is okay
72397239
1548
72407240
01:21:58,085 --> 01:22:01,086
72417241
because array is part of property list. And so is int,
7242-
因为数组可以是属性列表的一部分,Int 也是
7242+
因为数组可以是属性列表的一部分,Int 也行
72437243

72447244
1549
72457245
01:22:01,155 --> 01:22:04,355
@@ -7264,7 +7264,7 @@ And then when I get them out, I use that object for key.
72647264
1553
72657265
01:22:12,565 --> 01:22:14,432
72667266
And actually for some common types,
7267-
我要获取的是确切的类型
7267+
我要获取的是常见的类型
72687268

72697269
1554
72707270
01:22:14,501 --> 01:22:17,202
@@ -7304,7 +7304,7 @@ then I've got it. That would be annoying. So instead,
73047304
1561
73057305
01:22:34,354 --> 01:22:36,789
73067306
it just has a method called double that does that as for
7307-
作为替代,有一个方法叫做 double(forKey:) 它帮你做了 as 的工作
7307+
作为替代,叫做 double(forKey:) 的方法帮你做了 as 的工作
73087308

73097309
1562
73107310
01:22:36,857 --> 01:22:40,825
@@ -7444,7 +7444,7 @@ it crashes your program and prints that message out. So
74447444
1589
74457445
01:24:02,075 --> 01:24:06,778
74467446
you could put, you know, some validation call. This line of
7447-
所以你可以把它用于验证合法性的场合
7447+
所以你可以把它用于验证合法性
74487448

74497449
1590
74507450
01:24:06,847 --> 01:24:10,215
@@ -7504,7 +7504,7 @@ next week I'm going to talk about doing custom drawing
75047504
1601
75057505
01:24:39,079 --> 01:24:42,447
75067506
in your own view. Multi-touch, like pinches and swipes, and
7507-
还有各种手势,比如 Pinch(捏合手势)和 Swipe(轻扫手势)等
7507+
还有各种手势,比如 Pinch(捏合)和 Swipe(轻扫)等
75087508

75097509
1602
75107510
01:24:42,516 --> 01:24:45,450

0 commit comments

Comments
 (0)