@@ -5604,12 +5604,12 @@ But just so that you know that NSNumber is around. Okay,
5604
5604
1221
5605
5605
01:05:35,835 --> 01:05:38,670
5606
5606
date. Super important class. Anytime you are representing
5607
- Date 是一个非常重要的结构体。任何时候,你想表达一个日期或时间
5607
+ Date 是一个非常重要的结构体。任何时候
5608
5608
5609
5609
1222
5610
5610
01:05:38,738 --> 01:05:42,674
5611
5611
a date or time, you're gonna wanna use this date struct.
5612
- 都要用到 Date 这个结构体
5612
+ 你想表达一个日期或时间, 都要用到 Date 这个结构体
5613
5613
5614
5614
1223
5615
5615
01:05:42,743 --> 01:05:46,144
@@ -5649,7 +5649,7 @@ all over the Earth that are different than ours.
5649
5649
1230
5650
5650
01:06:02,596 --> 01:06:05,697
5651
5651
So anytime you're even contemplating putting a date
5652
- 因此,当你考虑在界面上摆放一个日期的时候
5652
+ 因此,当你考虑在界面上展示一个日期的时候
5653
5653
5654
5654
1231
5655
5655
01:06:05,766 --> 01:06:09,568
@@ -5659,7 +5659,7 @@ anywhere in your UI you need to be using this class.
5659
5659
1232
5660
5660
01:06:09,636 --> 01:06:12,270
5661
5661
Because if you wanna have your app work in anything but
5662
- 如果你希望你的应用可以正常工作在非英语环境下
5662
+ 如果你希望你的应用可以在非英语环境下正常工作
5663
5663
5664
5664
1233
5665
5665
01:06:12,339 --> 01:06:14,639
@@ -5669,7 +5669,7 @@ English, you're gonna have to format your date, using
5669
5669
1234
5670
5670
01:06:14,708 --> 01:06:19,744
5671
5671
the DateFormatter, in whatever locale your app is running in.
5672
- 将日期转化成应用所处的本地化语言
5672
+ 把日期用当地的习惯表达
5673
5673
5674
5674
1235
5675
5675
01:06:19,813 --> 01:06:22,514
@@ -5729,12 +5729,12 @@ It gets passed around copy on right. And
5729
5729
1246
5730
5730
01:06:54,114 --> 01:06:56,882
5731
5731
you'll start seeing data in UI maybe week five or
5732
- 你们将会在 UI 部分开始接触到它
5732
+ 你们将会在第五或第六周 UI 部分开始接触到它
5733
5733
5734
5734
1247
5735
5735
01:06:56,950 --> 01:07:00,686
5736
5736
six of this class. All right, initialization.
5737
- 可能是这个课程的第五或第六周。 接下来是 Initialization(构造)
5737
+ 接下来是 Initialization(构造)
5738
5738
5739
5739
1248
5740
5740
01:07:00,754 --> 01:07:04,122
@@ -5833,13 +5833,13 @@ So you can have as many inits as you want.
5833
5833
5834
5834
1267
5835
5835
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
5837
5837
也确实有很多类都有不止一个构造器
5838
5838
5839
5839
1268
5840
5840
01:08:02,983 --> 01:08:04,649
5841
5841
kinda how they are being used, how they are being created.
5842
- 意味着它们拥有多种不同的使用方式和创建方式
5842
+ 创建过程取决于使用方式
5843
5843
5844
5844
1269
5845
5845
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
6019
6019
1304
6020
6020
01:09:50,657 --> 01:09:54,826
6021
6021
got lets x equal 5. You can still reset it in your init.
6022
- 可以令 x = 5,构造器内是可以这样做的
6022
+ let x = 5,构造器内仍然可以重设它
6023
6023
6024
6024
1305
6025
6025
01:09:54,895 --> 01:09:59,330
@@ -6084,7 +6084,7 @@ let's start thinking about class and break this down.
6084
6084
1317
6085
6085
01:10:31,264 --> 01:10:34,699
6086
6086
Let's start with what are you required to do in an init for
6087
- 我们从这个问题切入:在类的构造器中我们必须做的事情是什么 ?
6087
+ 我们从这个问题切入:在类的构造器中必须做的是什么 ?
6088
6088
6089
6089
1318
6090
6090
01:10:34,768 --> 01:10:37,969
@@ -6304,12 +6304,12 @@ This, in this case, you have to do convenience,
6304
6304
1361
6305
6305
01:12:43,664 --> 01:12:46,164
6306
6306
you have to call your other one first.
6307
- 你必须先调一个自身的其他构造器
6307
+ 你必须先调用一个自身的其他构造器
6308
6308
6309
6309
1362
6310
6310
01:12:46,232 --> 01:12:50,969
6311
6311
And the calling of all other inits, whatever you do, any
6312
- 任何其他构造器,无论调哪个都行
6312
+ 任何其他构造器,无论哪个都行
6313
6313
6314
6314
1363
6315
6315
01:12:51,037 --> 01:12:54,539
@@ -6429,7 +6429,7 @@ Of course, you could inherit them all by implementing
6429
6429
1386
6430
6430
01:13:59,406 --> 01:14:04,008
6431
6431
none of them as well. So, any init that you inherit by these
6432
- 也一样能继承父类全部的便利构造器。
6432
+ 也一样能继承父类全部的便利构造器
6433
6433
6434
6434
1387
6435
6435
01:14:04,077 --> 01:14:06,611
@@ -6534,12 +6534,12 @@ a failed init, you can return nil. So, an example here is
6534
6534
1407
6535
6535
01:14:58,799 --> 01:15:02,968
6536
6536
UIImage. UIImaged named looks up that image in
6537
- 拿 UIImage 来举例 ,UIImage( named:) 会在 xcassets 文件中寻找
6537
+ 拿 UIImage 举例 ,UIImage( named:) 会在
6538
6538
6539
6539
1408
6540
6540
01:15:03,036 --> 01:15:05,904
6541
6541
the xcassets. Remember that xcassets thing that I moved
6542
- 指定的图片 。还记得 xcassets 文件吗?
6542
+ xcassets 文件中寻找指定的图片 。还记得 xcassets 文件吗?
6543
6543
6544
6544
1409
6545
6545
01:15:05,973 --> 01:15:08,806
@@ -6569,7 +6569,7 @@ that UIImage initializer failed. Alright, Any and
6569
6569
1414
6570
6570
01:15:22,822 --> 01:15:27,259
6571
6571
AnyObject. There is no more init, we're done with init.
6572
- 下面是 Any 和 AnyObject
6572
+ 下面是 Any 和 AnyObject,不讲构造器了
6573
6573
6574
6574
1415
6575
6575
01:15:27,327 --> 01:15:31,262
@@ -6579,12 +6579,12 @@ Any 和 AnyObject 都是类型,特殊的类型
6579
6579
1416
6580
6580
01:15:31,331 --> 01:15:35,133
6581
6581
These types really are almost exclusively used for backwards
6582
- 几乎可以这样理解,这些类型仅仅是为了向下兼容 Objective-C 而存在的
6582
+ 几乎可以这样理解,这些类型的存在仅仅是为了
6583
6583
6584
6584
1417
6585
6585
01:15:35,202 --> 01:15:39,004
6586
6586
compatibility with Objective C because Objective C had a type
6587
- 因为 Objective-C 中有一个类型叫做 id
6587
+ 向下兼容 Objective-C 中叫做 id 的一个类型
6588
6588
6589
6589
1418
6590
6590
01:15:39,072 --> 01:15:41,740
@@ -6614,7 +6614,7 @@ have a type which is like, it can be anything. Okay, because
6614
6614
1423
6615
6615
01:15:55,622 --> 01:15:58,022
6616
6616
that's what Any and AnyObject are, it's like anything,
6617
- Any 和 AnyObject 具有能代表任何类型的特性
6617
+ Any 和 AnyObject 能代表任何类型
6618
6618
6619
6619
1424
6620
6620
01:15:58,091 --> 01:16:02,928
@@ -6654,7 +6654,7 @@ Where are they gonna show up? Well,
6654
6654
1431
6655
6655
01:16:15,909 --> 01:16:18,710
6656
6656
there are some methods in iOS where one of the arguments
6657
- iOS 中有一些方法确实需要能接受任何类型的参数
6657
+ iOS 中有一些方法确实能接受任何类型的参数
6658
6658
6659
6659
1432
6660
6660
01:16:18,779 --> 01:16:22,847
@@ -6684,7 +6684,7 @@ Segue 的发起者
6684
6684
1437
6685
6685
01:16:33,994 --> 01:16:37,095
6686
6686
is the argument in this method called prepare for
6687
- 就是这个方法 prepare( for:sender:) 中
6687
+ 就是方法 prepare( for:sender:) 中
6688
6688
6689
6689
1438
6690
6690
01:16:37,164 --> 01:16:39,031
@@ -6724,7 +6724,7 @@ So when you're preparing for it, you've gotta be
6724
6724
1445
6725
6725
01:16:55,983 --> 01:16:59,918
6726
6726
able to say which one it was, and that's just Any. So
6727
- 你已经可以确定 sender 是什么东西了,这里用 Any 正合适
6727
+ 你要能接受任何类型的 sender,所以这里用 Any
6728
6728
6729
6729
1446
6730
6730
01:16:59,987 --> 01:17:02,621
@@ -6799,17 +6799,17 @@ Swift 中,如果我们要把 Double 和 String
6799
6799
1460
6800
6800
01:17:43,530 --> 01:17:46,265
6801
6801
strings in the same array, we use an enum.
6802
- 放入同一个数组,应该使用 Enum (枚举)
6802
+ 放入同一个数组,应该使用 enum (枚举)
6803
6803
6804
6804
1461
6805
6805
01:17:46,333 --> 01:17:48,200
6806
6806
That's what we did with our operations array, and that's
6807
- 我们在之前( CalculatorBrain 中)存放操作符的数组就是这样实现的
6807
+ 就像之前 CalculatorBrain 中存放操作符的数组
6808
6808
6809
6809
1462
6810
6810
01:17:48,268 --> 01:17:51,236
6811
6811
what we would do in Swift, so we wouldn't use AnyObject.
6812
- 这才是我们应该在 Swift 中用的方式 ,不要用 AnyObject
6812
+ 这才是我们在 Swift 中实现的方式 ,不要用 AnyObject
6813
6813
6814
6814
1463
6815
6815
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
6854
6854
1471
6855
6855
01:18:08,055 --> 01:18:10,822
6856
6856
send any messages to it cuz it's not of any type, so
6857
- 我们没法给 Any 类型的变量发送消息,因为它不是任何类型
6857
+ 我们没法给 Any 类型的变量发送消息。它不是任何类型
6858
6858
6859
6859
1472
6860
6860
01:18:10,891 --> 01:18:14,426
@@ -6869,7 +6869,7 @@ we have convert it, and we convert type Any or, or
6869
6869
1474
6870
6870
01:18:18,131 --> 01:18:23,001
6871
6871
AnyObject into some class that we know about using as.
6872
- 转换为我们已知的类型
6872
+ 用 as 转换为我们已知的类型
6873
6873
6874
6874
1475
6875
6875
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
6939
6939
1488
6940
6940
01:19:06,547 --> 01:19:09,614
6941
6941
casting. This casting, by the way, not just for AnyObject,
6942
- 这种操作叫做 Casting(类型检查), 不仅是 AnyObject(或 Any)
6942
+ 这种操作叫 Casting(类型检查)。 不仅是 AnyObject 和 Any
6943
6943
6944
6944
1489
6945
6945
01:19:09,683 --> 01:19:12,951
6946
6946
we can cast other things. For example, if I had a variable
6947
- 我们也可以检查其他类型 。比如有一个变量 vc
6947
+ 其他类型我们也可以检查 。比如有一个变量 vc
6948
6948
6949
6949
1490
6950
6950
01:19:13,020 --> 01:19:15,987
@@ -7019,17 +7019,17 @@ as a CalculatorViewController Now I can send displayValue to
7019
7019
1504
7020
7020
01:19:55,195 --> 01:19:59,598
7021
7021
calcVC. Cuz it's the type that you actually
7022
- 因为 vc 的类型是你强加给它的
7022
+ 因为 vc 明确声明了类型
7023
7023
7024
7024
1505
7025
7025
01:19:59,667 --> 01:20:02,234
7026
7026
type it as that matters, not what it's pointing to. So you
7027
- 并不是它真实指向的类型
7027
+ 所以 Swift 不考虑实际指向的类型
7028
7028
7029
7029
1506
7030
7030
01:20:02,302 --> 01:20:04,870
7031
7031
have to use as to get it to be something that you really
7032
- 所以使用前必须先转换为你想要的那个类型
7032
+ 因此使用前必须先转换为你想要的那个类型
7033
7033
7034
7034
1507
7035
7035
01:20:04,939 --> 01:20:08,606
@@ -7054,12 +7054,12 @@ User defaults is a very lightweight,
7054
7054
1511
7055
7055
01:20:15,716 --> 01:20:19,618
7056
7056
limited database. It's a tiny little database that persists
7057
- 它是一个可以在应用多次启动之间保存持久化数据的微型数据库
7057
+ 它是一个可以在应用多次启动之间
7058
7058
7059
7059
1512
7060
7060
01:20:19,687 --> 01:20:21,687
7061
7061
between launchings of your app. It's great for
7062
- 它非常适合用来
7062
+ 保存持久化数据的微型数据库,非常适合用来
7063
7063
7064
7064
1513
7065
7065
01:20:21,756 --> 01:20:23,255
@@ -7094,7 +7094,7 @@ a number, like int, float, double, whatever.
7094
7094
1519
7095
7095
01:20:37,771 --> 01:20:40,038
7096
7096
That's what a property list is. It's just conceptual.
7097
- 这就是概念上的属性列表
7097
+ 这就是属性列表的概念
7098
7098
7099
7099
1520
7100
7100
01:20:40,107 --> 01:20:42,707
@@ -7134,7 +7134,7 @@ this is what it looks like. It has this core, set, and
7134
7134
1527
7135
7135
01:21:01,662 --> 01:21:05,931
7136
7136
get. Set Any? Now that Any can't really be Any,
7137
- set 接受 Any 类型?注意这里的 Any 并不是任何类型都可以
7137
+ set 接受 Any? 类型。注意这里 Any 并不是任何类型都可以
7138
7138
7139
7139
1528
7140
7140
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
7164
7164
1533
7165
7165
01:21:16,710 --> 01:21:19,210
7166
7166
it returns you an Any. And it's an optional Any because
7167
- 它会返回给你一个 Any,一个可选类型的 Any
7167
+ 它会返回给你一个 Any? ,一个可选类型的 Any
7168
7168
7169
7169
1534
7170
7170
01:21:19,279 --> 01:21:20,445
@@ -7239,7 +7239,7 @@ one setting an array of ints. An array of ints is okay
7239
7239
1548
7240
7240
01:21:58,085 --> 01:22:01,086
7241
7241
because array is part of property list. And so is int,
7242
- 因为数组可以是属性列表的一部分,Int 也是
7242
+ 因为数组可以是属性列表的一部分,Int 也行
7243
7243
7244
7244
1549
7245
7245
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.
7264
7264
1553
7265
7265
01:22:12,565 --> 01:22:14,432
7266
7266
And actually for some common types,
7267
- 我要获取的是确切的类型
7267
+ 我要获取的是常见的类型
7268
7268
7269
7269
1554
7270
7270
01:22:14,501 --> 01:22:17,202
@@ -7304,7 +7304,7 @@ then I've got it. That would be annoying. So instead,
7304
7304
1561
7305
7305
01:22:34,354 --> 01:22:36,789
7306
7306
it just has a method called double that does that as for
7307
- 作为替代,有一个方法叫做 double( forKey:) 它帮你做了 as 的工作
7307
+ 作为替代,叫做 double( forKey:) 的方法帮你做了 as 的工作
7308
7308
7309
7309
1562
7310
7310
01:22:36,857 --> 01:22:40,825
@@ -7444,7 +7444,7 @@ it crashes your program and prints that message out. So
7444
7444
1589
7445
7445
01:24:02,075 --> 01:24:06,778
7446
7446
you could put, you know, some validation call. This line of
7447
- 所以你可以把它用于验证合法性的场合
7447
+ 所以你可以把它用于验证合法性
7448
7448
7449
7449
1590
7450
7450
01:24:06,847 --> 01:24:10,215
@@ -7504,7 +7504,7 @@ next week I'm going to talk about doing custom drawing
7504
7504
1601
7505
7505
01:24:39,079 --> 01:24:42,447
7506
7506
in your own view. Multi-touch, like pinches and swipes, and
7507
- 还有各种手势,比如 Pinch(捏合手势 )和 Swipe(轻扫手势 )等
7507
+ 还有各种手势,比如 Pinch(捏合 )和 Swipe(轻扫 )等
7508
7508
7509
7509
1602
7510
7510
01:24:42,516 --> 01:24:45,450
0 commit comments