1 00:00:09,190 --> 00:00:14,770 Now for us to understand exactly the benefits of swift to you why I think it's important for us to look 2 00:00:15,250 --> 00:00:20,110 at the progression of the Apple ecosystem if you will for developers. 3 00:00:20,200 --> 00:00:27,400 So it used to be that in order for you to create any application for the Apple ecosystem you would have 4 00:00:27,400 --> 00:00:28,760 to learn objective c. 5 00:00:28,780 --> 00:00:29,650 That was it. 6 00:00:29,770 --> 00:00:31,140 You had no other option. 7 00:00:31,270 --> 00:00:36,670 You had to learn Objective C in order to create any sort of application for the Apple platform or ecosystem. 8 00:00:36,670 --> 00:00:42,050 Now Objective C wasn't a very easy language to learn and or to read. 9 00:00:42,100 --> 00:00:47,250 In fact it was one of the toughest languages I've ever had to learn in a lot of other people. 10 00:00:47,250 --> 00:00:49,830 Also shared the same sentiment. 11 00:00:49,960 --> 00:00:52,810 So it wasn't just me Objective C was really hard. 12 00:00:53,290 --> 00:01:00,340 So Apple decided later about 20 years or so later that OK it's time to come back to the 21st century 13 00:01:00,370 --> 00:01:04,230 and create something a little bit more easier to handle. 14 00:01:04,300 --> 00:01:07,100 So then they created swift language. 15 00:01:07,210 --> 00:01:14,200 That was a revolutionary feat if you will because Swifty was a better language very simplified and easy 16 00:01:14,200 --> 00:01:14,780 to learn. 17 00:01:14,890 --> 00:01:17,930 So developers could just learn in a whim. 18 00:01:17,950 --> 00:01:19,380 All was good. 19 00:01:19,390 --> 00:01:26,080 Now the thing that you have to realize also in order for us to build anything for the Apple ecosystem 20 00:01:26,170 --> 00:01:33,880 you'd have to of course put together some sort of user interface in traditionally creating user interfaces 21 00:01:34,120 --> 00:01:35,460 is really really hard. 22 00:01:35,470 --> 00:01:37,820 Even though we have swift language. 23 00:01:37,960 --> 00:01:45,130 The reason why is because the way we create user interfaces in the Apple realm is that we use X code 24 00:01:45,180 --> 00:01:45,660 I.D.. 25 00:01:45,670 --> 00:01:53,050 So the X code is the idea integrated development environment used to create applications for Apple ecosystem. 26 00:01:53,050 --> 00:01:57,530 So you would open up X code in order for you to create user interfaces. 27 00:01:57,530 --> 00:02:01,530 You'd have to use storyboard and or UI Kit. 28 00:02:01,550 --> 00:02:08,380 Okay so libraries to create whatever you wanted to create for our user interface. 29 00:02:08,380 --> 00:02:16,750 Now the storyboard is just a clunky cumbersome tool that all developers were stuck for many many years 30 00:02:16,840 --> 00:02:20,680 in order to create anything usable for any IOW application. 31 00:02:20,680 --> 00:02:23,800 And as well for any Mac OS and so forth. 32 00:02:24,310 --> 00:02:29,600 So yes to give you an example this is a very simple application as you can see here. 33 00:02:29,620 --> 00:02:31,240 This is what we call X code. 34 00:02:31,240 --> 00:02:39,100 This is a picture of X code and this simple application here only takes about four items or four controllers 35 00:02:39,280 --> 00:02:39,700 there. 36 00:02:39,940 --> 00:02:40,650 Okay. 37 00:02:40,660 --> 00:02:45,310 So this simple application you can see two left will have view control was seen on that panel there 38 00:02:45,640 --> 00:02:51,850 and inside we have top layout guide and we have views and half a stack view and then we have the middle 39 00:02:51,850 --> 00:02:52,540 label. 40 00:02:52,540 --> 00:02:55,150 I mean it's just crazy. 41 00:02:55,150 --> 00:02:57,660 I mean you can see there's a lot of layers. 42 00:02:57,670 --> 00:03:03,960 All of these things you have to drag and drop and search for them an image view you put on top of that 43 00:03:03,970 --> 00:03:06,010 and then you put a text field. 44 00:03:06,040 --> 00:03:07,410 I mean it's a lot of work. 45 00:03:07,440 --> 00:03:14,380 And on top of that you would also have to then connect to the code in order for the responsiveness to 46 00:03:14,380 --> 00:03:14,800 happen. 47 00:03:14,830 --> 00:03:19,580 So when they click onto the UI image for you for instance if you want the app to do something then you'd 48 00:03:19,600 --> 00:03:24,940 have to make sure you connect the code and the storyboard items you've added into user interface. 49 00:03:25,300 --> 00:03:28,720 So that is of course a pain to say the least. 50 00:03:28,810 --> 00:03:36,190 All of that goes away with Swifty Y because now is Swifty y Apple decided to create this framework that 51 00:03:36,280 --> 00:03:42,940 is exceptionally amazing because now you can create all sorts of applications for the Apple platform 52 00:03:42,940 --> 00:03:44,740 using code only. 53 00:03:44,740 --> 00:03:46,630 But not just any kind of code. 54 00:03:46,630 --> 00:03:54,160 This code is declarative syntax meaning it's easy to read and it's also natural to write. 55 00:03:54,190 --> 00:03:59,830 So it's almost like you are writing in English language because you're declaring things you want to 56 00:03:59,830 --> 00:04:02,160 see in your application. 57 00:04:02,410 --> 00:04:10,840 An example you can see that piece of code to the left there generates what you see to do right now before 58 00:04:10,840 --> 00:04:17,270 Swifty y in order to create table view as they called those lists there you would have to do a lot of 59 00:04:17,270 --> 00:04:24,790 walk between the storyboard and using UI kit views and using UI kit API using all sorts of things you 60 00:04:24,790 --> 00:04:27,110 have to do in order to get this to work. 61 00:04:27,190 --> 00:04:33,970 But in this case here with Swifty you are I can see less than 30 lines of code if that actually. 62 00:04:34,150 --> 00:04:41,660 I would say probably 15 lines of code unless you're able to put together something as simple as that. 63 00:04:41,770 --> 00:04:46,900 And the beauty also you have to notice here is that looking at this code closely inside you can actually 64 00:04:46,900 --> 00:04:52,070 read even if you've never looked at Swift code of swift UI before it's easy to read. 65 00:04:52,090 --> 00:04:53,100 It's intuitive. 66 00:04:53,110 --> 00:04:58,960 You can see for instance there's a variable body there which is just a view which returns a list which 67 00:04:58,960 --> 00:05:01,120 inside of this list we have an image. 68 00:05:01,210 --> 00:05:01,590 Right. 69 00:05:01,600 --> 00:05:08,870 And we have a view stack or vertical stack which contains two texts and then we make the last tax they 70 00:05:08,870 --> 00:05:10,380 are to have a color. 71 00:05:10,520 --> 00:05:12,720 It makes a lot of sense. 72 00:05:12,770 --> 00:05:16,150 So this is why Swifty y shines. 73 00:05:16,190 --> 00:05:20,740 It just takes away all of that cumbersome code as well as storyboard. 74 00:05:20,810 --> 00:05:26,700 The old way of creating user interfaces in makes it more declarative and easy to understand. 75 00:05:26,780 --> 00:05:28,880 Easy to write and to do point.