0
1
00:00:00,660 --> 00:00:06,480
In this lesson, let's take a minute to talk about why CocoaPods is useful and discuss some alternatives
1

2
00:00:06,480 --> 00:00:12,090
to CocoaPods. CocoaPods is something called a Package Dependency Manager.
2

3
00:00:12,150 --> 00:00:15,690
Now, what is a Package Dependency Manager anyways?
3

4
00:00:15,690 --> 00:00:18,760
Well, it's kind of like the manager in a factory.
4

5
00:00:18,870 --> 00:00:25,620
The Package Dependency Manager will monitor for changes to all of the packages that you've added to
5

6
00:00:25,620 --> 00:00:26,650
your project.
6

7
00:00:26,700 --> 00:00:33,930
So that means if you had, say, 10 different packages that you've added to your project, in addition to the
7

8
00:00:33,930 --> 00:00:41,160
CLTypingLabel, when the authors of those packages update their code, you don't have to manually go
8

9
00:00:41,160 --> 00:00:47,340
to GitHub, see what the changes are, and then add those bits of changed code to your project.
9

10
00:00:47,340 --> 00:00:51,140
And you don't have to actively monitor what it is that they're doing.
10

11
00:00:51,360 --> 00:00:56,430
Instead, what you'll be able to do is you'll be able to navigate into your project, say for example, 
11

12
00:00:56,430 --> 00:01:04,500
our FlashChat iOS13, and run a command called pod update. And this will go out there and fetch all the
12

13
00:01:04,500 --> 00:01:12,870
latest versions of all the pods that you were using. Say, if the CLTypingLabel got updated from 0.4.0
13

14
00:01:12,870 --> 00:01:20,850
to 0 5.0, then it will automatically pull the latest versions in and incorporate it into your project.
14

15
00:01:21,060 --> 00:01:27,090
Saving you lots of stress, and so that you keep your hair instead of pulling it out.
15

16
00:01:27,270 --> 00:01:32,430
Now, it's important to remember that CocoaPods is not the only player in this sector.
16

17
00:01:32,760 --> 00:01:37,980
So in addition to CocoaPods, the other ones that you might hear of along the way are something called
17

18
00:01:38,220 --> 00:01:41,820
Carthage, as well as the Swift Package Manager.
18

19
00:01:41,820 --> 00:01:48,420
In terms of Carthage, I find the installation and updating of dependencies super painful.
19

20
00:01:48,570 --> 00:01:52,610
So it's something I really don't like that much and I don't recommend it.
20

21
00:01:52,620 --> 00:01:59,010
The Swift Package Manager is something that only became more useful recently because of a number of
21

22
00:01:59,070 --> 00:02:06,330
updates that Apple has made. And in fact, the idea with the Swift Package Manager is you should be able
22

23
00:02:06,330 --> 00:02:13,080
to go to File, Swift Packages, Add Package Dependency, so let's select our project, and then you should be
23

24
00:02:13,080 --> 00:02:17,380
able to search or enter a package repository URL.
24

25
00:02:17,490 --> 00:02:24,720
So, for example, Alamofire is one of the biggest third party modules out there that lots of people use.
25

26
00:02:24,720 --> 00:02:27,200
You can see just by how many stars it has.
26

27
00:02:27,750 --> 00:02:34,100
And this is something that we can install using either CocoaPods Carthage or Swift Package Manager.
27

28
00:02:34,560 --> 00:02:41,640
And all you would have to do is to select this URL, copy and paste it in here, and then hit Next,
28

29
00:02:41,640 --> 00:02:44,260
and it will go ahead and install it for you.
29

30
00:02:44,370 --> 00:02:53,700
But, but, but a big word of warning here is that at the moment, as it is right now in 2019, end of 2019,
30

31
00:02:53,730 --> 00:02:59,850
sort of going on to November, when I'm recording this, the Swift Package Manager really does not play
31

32
00:02:59,850 --> 00:03:06,410
nicely with CocoaPods which would be fine if we were only going to use this Swift Package Manager, right?
32

33
00:03:06,420 --> 00:03:08,090
It's Apple's tools.
33

34
00:03:08,100 --> 00:03:10,080
It's the native implementation.
34

35
00:03:10,080 --> 00:03:12,540
So what's wrong with that?
35

36
00:03:12,540 --> 00:03:18,810
Well, the problem is that there's very few developers at the moment who are able to support the Swift
36

37
00:03:18,810 --> 00:03:25,020
Package Manager. And the way that you can tell is when you go onto a GitHub repository for one of these
37

38
00:03:25,020 --> 00:03:27,020
third party Swift libraries.
38

39
00:03:27,150 --> 00:03:34,320
If you take a look at this list of files, if you see something called something.podspec, it means
39

40
00:03:34,320 --> 00:03:41,070
it probably supports CocoaPods. And if you see package.swift, then it means it supports the Swift
40

41
00:03:41,130 --> 00:03:49,850
Package Manager or the SPD. But notice how things like the one that we use just now, CLTypingLabel,
41

42
00:03:49,860 --> 00:03:51,260
well, that doesn't have that file,
42

43
00:03:51,270 --> 00:03:51,570
right?
43

44
00:03:51,630 --> 00:03:53,370
So it doesn't support it.
44

45
00:03:53,580 --> 00:03:59,850
And even Firebase which we're gonna be using heavily and it's something that's developed by Google has
45

46
00:03:59,970 --> 00:04:01,870
a lot of manpower behind it.
46

47
00:04:01,890 --> 00:04:06,850
You'll notice, actually, it doesn't support a Swift Package Manager either.
47

48
00:04:06,900 --> 00:04:14,610
This might change in the coming days when SP deals with package manager becomes more popular. But, effectively,
48

49
00:04:14,640 --> 00:04:21,890
when I make a decision to see which particular package manager I use, it all really depends on Developer
49

50
00:04:21,900 --> 00:04:22,920
Love, right?
50

51
00:04:22,950 --> 00:04:31,170
If developers like distributing their third party code using a particular package manager which at the
51

52
00:04:31,170 --> 00:04:36,300
moment, CocoaPods seems to win out, then that's probably the one that I'm going to be using because it
52

53
00:04:36,300 --> 00:04:43,290
means I get access to a much wider array of different third party libraries.
53

54
00:04:43,380 --> 00:04:47,580
So my recommendation at the moment is to stick with CocoaPods.
54

55
00:04:47,760 --> 00:04:53,000
And if this changes, I'll be sure to let you guys know through an educational announcement.
55

56
00:04:53,130 --> 00:04:58,140
So now that we've installed CocoaPods and we've learned all about how to use it, let's go ahead and
56

57
00:04:58,140 --> 00:05:02,830
put it into practice by adding Firebase to our project.
57

58
00:05:02,880 --> 00:05:06,120
So for all of that and more, I'll see you on the next lesson.
