1
00:00:04,880 --> 00:00:06,100
Everyone will come back.

2
00:00:06,100 --> 00:00:13,210
Johnny be here with soaps that come and in the last lesson we got are pretty much where we wanted for

3
00:00:13,450 --> 00:00:14,680
this section.

4
00:00:14,680 --> 00:00:20,560
We have it giving us the quick action shortcuts for our three controllers.

5
00:00:20,950 --> 00:00:24,310
But we want to do we want to explore a little bit more.

6
00:00:24,550 --> 00:00:26,630
And let's check out our main story board.

7
00:00:26,800 --> 00:00:30,440
Right now we're working with a navigation controller.

8
00:00:30,730 --> 00:00:35,670
What if we instead had these three in a tab our view controller.

9
00:00:35,710 --> 00:00:37,820
So let's go ahead and try that out.

10
00:00:37,840 --> 00:00:41,730
So we're going to go ahead and actually you know what let's go ahead.

11
00:00:41,780 --> 00:00:48,070
I would recommend that you do this so that you can swap back and forth between these types between the

12
00:00:48,070 --> 00:00:50,590
navigation controller and the tab bar View Controller.

13
00:00:50,590 --> 00:00:52,410
I'm going to create a new branch.

14
00:00:52,420 --> 00:00:52,850
OK.

15
00:00:52,960 --> 00:01:01,660
So you can open up terminal and I'm going to CD into our project CD CD desktop and then what do we call

16
00:01:01,660 --> 00:01:03,030
this shortcut.

17
00:01:03,310 --> 00:01:04,190
There we go.

18
00:01:04,240 --> 00:01:07,890
I'm going to say get Brash's to see what Branch I'm on.

19
00:01:07,940 --> 00:01:14,420
I'm on a branch called Tab which was actually the one that I created to start working on this.

20
00:01:14,440 --> 00:01:19,730
So I already created the branch but just to show you how to do that again when you say get checked out.

21
00:01:19,730 --> 00:01:23,310
That should be handling it called this tab.

22
00:01:24,070 --> 00:01:24,960
OK.

23
00:01:25,060 --> 00:01:25,310
All right.

24
00:01:25,330 --> 00:01:30,460
So if you've already gone through our other courses and you know how to follow along with this then

25
00:01:30,490 --> 00:01:34,910
I would recommend creating a new branch if you haven't done this.

26
00:01:34,990 --> 00:01:37,370
I'm not going to go deep into get right now.

27
00:01:37,690 --> 00:01:43,750
So if you want to have a separate copy go ahead and just create a copy of your project folder and have

28
00:01:43,750 --> 00:01:47,810
one be for the navigation controller and one for the tab bar.

29
00:01:47,900 --> 00:01:48,960
You can do all right.

30
00:01:49,270 --> 00:01:54,730
So right now though I have a separate branch for this one called tapetum.

31
00:01:55,030 --> 00:02:00,050
All right and what I'm going to do is I'm going to delete the navigation View Controller.

32
00:02:00,210 --> 00:02:06,460
I'm going to delete the segues between each of the use and then I'm going to just organize this a little

33
00:02:06,460 --> 00:02:10,920
bit differently so that we have it like this.

34
00:02:11,320 --> 00:02:14,560
And then what we can do is pretty cool.

35
00:02:14,560 --> 00:02:20,950
We're just going to select the controllers so the mountain zushi and holding Shift to select the space

36
00:02:20,950 --> 00:02:25,520
AVC and shift still to select the ocean visi.

37
00:02:25,750 --> 00:02:33,010
And then we're going to go to editor and embed in a tab bar controller and there we go.

38
00:02:33,010 --> 00:02:38,050
Now we've got these all selected and inside of the tab bar.

39
00:02:38,070 --> 00:02:38,590
There you go.

40
00:02:38,590 --> 00:02:39,770
Very nice.

41
00:02:39,800 --> 00:02:42,520
We might need to adjust the order a little bit.

42
00:02:42,520 --> 00:02:49,750
Let's go ahead and run this and see what order they came out in and nothing's happening because we forgot

43
00:02:49,750 --> 00:02:51,610
to set the initial controller.

44
00:02:51,880 --> 00:02:58,990
So with the Tabar controller selected We're going to go here to our attributes inspector and set the

45
00:02:59,000 --> 00:03:03,240
initial controller to yes and let's try that again.

46
00:03:05,200 --> 00:03:06,240
All right here we go.

47
00:03:06,240 --> 00:03:11,100
So the first one is mountain's second one in space and the last one is ocean.

48
00:03:11,280 --> 00:03:16,710
Just like we wanted if yours didn't happen to come out in the correct order then you can just click

49
00:03:16,800 --> 00:03:20,440
and drag right here and kind of reorder those.

50
00:03:20,520 --> 00:03:21,330
OK.

51
00:03:21,330 --> 00:03:26,860
So just to reorder them and get it to the order that we had before which is mountain space ocean and

52
00:03:26,880 --> 00:03:33,180
going to run this again make sure that I didn't mess up my order mountains space ocean.

53
00:03:33,180 --> 00:03:33,910
Very good.

54
00:03:34,290 --> 00:03:37,190
All right so let's go ahead and do a little bit of work here.

55
00:03:37,310 --> 00:03:42,720
We're if you can change how these appear here are going to zoom in a little bit.

56
00:03:42,720 --> 00:03:44,510
So here you just see item item item.

57
00:03:44,520 --> 00:03:47,250
So it's going put some info here.

58
00:03:47,250 --> 00:03:53,510
So you do that by clicking on the tab bar info for the individual visi.

59
00:03:53,520 --> 00:04:02,500
So here and let's go ahead and give it a selected image which is Mt. short.

60
00:04:02,700 --> 00:04:10,500
And the title is mountains and then the image here is also mountains short.

61
00:04:10,580 --> 00:04:16,020
So Knodell say mountains and mountains here and have the image as well as over here.

62
00:04:16,020 --> 00:04:16,510
There you go.

63
00:04:16,530 --> 00:04:19,240
Let's go to the next one for space.

64
00:04:19,690 --> 00:04:28,880
Select the item here and we're going to select these set these selected image to space short and set

65
00:04:28,900 --> 00:04:34,290
the title to space and the image to space short.

66
00:04:34,290 --> 00:04:35,270
There we go.

67
00:04:35,540 --> 00:04:36,440
OK good.

68
00:04:36,720 --> 00:04:47,380
And lastly for the ocean select the item and set the selected image to ocean short the title to the

69
00:04:47,410 --> 00:04:52,530
ocean and the image to ocean shore as well.

70
00:04:52,530 --> 00:04:54,970
All right let's run that one more time.

71
00:04:54,990 --> 00:04:55,580
All right there we go.

72
00:04:55,580 --> 00:04:57,880
Mountains space and ocean.

73
00:04:58,030 --> 00:04:58,540
Oh yes.

74
00:04:58,560 --> 00:05:00,030
Very nice.

75
00:05:00,180 --> 00:05:03,530
I think I'd definitely prefer our tab bar.

76
00:05:03,690 --> 00:05:09,340
Wii U controller better than the navigation control I think this just looks nicer.

77
00:05:09,340 --> 00:05:10,260
I like it.

78
00:05:10,260 --> 00:05:11,490
All right cool.

79
00:05:11,490 --> 00:05:15,070
So now let's go into our app delegate and work on our quick actions.

80
00:05:15,300 --> 00:05:18,170
All right so let's see here.

81
00:05:18,450 --> 00:05:23,520
This time our route to view controller is not a navigation controller so let's change this right off

82
00:05:23,520 --> 00:05:24,290
the bat.

83
00:05:24,330 --> 00:05:28,040
It is a UI tab bar controller.

84
00:05:28,230 --> 00:05:36,360
And you know what we don't actually need to have this array of VCs because it just kind of different

85
00:05:36,390 --> 00:05:37,340
how it works.

86
00:05:37,350 --> 00:05:44,100
We are going to set the selected index on our tab bar controller and then it instantiates it on its

87
00:05:44,130 --> 00:05:44,800
own.

88
00:05:44,850 --> 00:05:45,960
So we don't need these.

89
00:05:46,020 --> 00:05:53,430
So we can delete this entire section and they did finish launching with options and we can delete our

90
00:05:53,430 --> 00:05:58,680
VCs array variable and we can get rid of this Nav..

91
00:05:58,920 --> 00:06:06,400
Vc the the section where it says set view controls and in ways we still need the variable navvy's VC.

92
00:06:06,610 --> 00:06:10,410
All right and then right here we can get rid of this pop to view controller.

93
00:06:10,710 --> 00:06:12,610
And so this is for space.

94
00:06:12,900 --> 00:06:20,370
And so the tab bars it goes in the same kind of 0 counting so 0 1 and 2 for each tab.

95
00:06:20,610 --> 00:06:30,400
So for space we want to navigate to we want to say now VCDs set or selected the selected index is equal

96
00:06:30,400 --> 00:06:31,960
to one.

97
00:06:31,990 --> 00:06:35,590
So that's the second controller.

98
00:06:35,980 --> 00:06:47,080
And then for here we want to say Nav. we see that selected index is equal to two.

99
00:06:47,210 --> 00:06:55,130
And then for the default which is Mountains which is zero for the tab we say have the seed that selected

100
00:06:55,140 --> 00:06:59,330
indexes to zero Ambiga.

101
00:06:59,350 --> 00:07:02,500
So let's go ahead and try that out.

102
00:07:02,950 --> 00:07:09,040
All right we're going to go home 3D touch ocean.

103
00:07:09,240 --> 00:07:10,230
Oh yeah.

104
00:07:11,140 --> 00:07:20,760
Three touch Space Madness and lastly three touch mountains there you go.

105
00:07:20,780 --> 00:07:21,090
All right.

106
00:07:21,100 --> 00:07:24,440
And that is working perfectly.

107
00:07:24,440 --> 00:07:26,480
Very good.

108
00:07:26,490 --> 00:07:26,940
All right.

109
00:07:27,030 --> 00:07:28,900
And that's it.

110
00:07:28,980 --> 00:07:37,620
So our Tabar controller works very nice with our quick actions as well as on the version with the nav

111
00:07:38,220 --> 00:07:39,650
navigation controller.

112
00:07:39,790 --> 00:07:44,580
And the last thing that I want to show you guys before we sign off and finish up with this target topic

113
00:07:44,970 --> 00:07:52,250
is early on I mentioned how there's a difference between static and dynamic shortcut items.

114
00:07:52,320 --> 00:07:58,210
And so here in our list we have defined three static shortcut items.

115
00:07:58,290 --> 00:08:04,920
They are static because they are built on build time dynamic Schork items.

116
00:08:05,220 --> 00:08:11,600
Those are done at runtime when we actually run the code where they are declared.

117
00:08:11,610 --> 00:08:15,570
So we're in do is just to give you a little bit more knowledge about this.

118
00:08:15,570 --> 00:08:23,520
We're going to create a dynamic shortcut item and we're going to replace our third item our ocean shortcut

119
00:08:23,820 --> 00:08:24,840
with a dynamic one.

120
00:08:24,870 --> 00:08:25,350
OK.

121
00:08:25,520 --> 00:08:29,730
And we're going to do that over here in our delegate as well.

122
00:08:29,730 --> 00:08:37,010
So here we are going to declare it we are going to say let ocean short cut.

123
00:08:37,050 --> 00:08:44,100
This is going to be a dynamic short cuts that are going to say you I mutable application shortcut item

124
00:08:44,330 --> 00:08:49,510
and says an item that specifies a configurable user initiated action for your app.

125
00:08:49,750 --> 00:08:50,300
OK.

126
00:08:50,640 --> 00:08:51,180
There we go.

127
00:08:51,300 --> 00:08:58,780
And we need to initialize it and we want this right here with all of the information and the type where

128
00:08:58,860 --> 00:09:04,320
we're going to do is we are going to this is remember our string identifier and our other ones we use

129
00:09:04,320 --> 00:09:08,650
the bundle doesn't mean the identifier to get it so let's do the same thing here.

130
00:09:08,670 --> 00:09:15,150
So I'm going to make a string and we're going to do some string interpolation and we are going to access

131
00:09:15,150 --> 00:09:23,650
our bundle identifier by saying bundle that mean that bundle identifier can.

132
00:09:24,000 --> 00:09:29,340
And then we are going to say Dot ocean just like we had before.

133
00:09:29,770 --> 00:09:36,270
The local ice title is also a string and say Ocean local I subtitled what I'm going to use.

134
00:09:36,270 --> 00:09:39,480
So we're going to Pessin nail the icon.

135
00:09:39,480 --> 00:09:41,240
So this is a little bit trickier.

136
00:09:41,250 --> 00:09:49,120
We're going to say UI application and then if you just type in icon should come up and we want the UI

137
00:09:49,560 --> 00:09:52,080
application shortcut icon not the type.

138
00:09:52,560 --> 00:10:01,610
And we're going to say that in that template image name which is a string and then we can just Pessin

139
00:10:01,610 --> 00:10:12,300
to it the name of our I call it that we want which is ocean short and then our user info dictionary

140
00:10:12,300 --> 00:10:15,810
we're not using search just past and there as well.

141
00:10:15,810 --> 00:10:22,020
All right so now we have created our dynamic ocean shortcut and we have a warning here to tell me about

142
00:10:22,020 --> 00:10:26,040
my string describing that's fine.

143
00:10:26,040 --> 00:10:30,800
All right so let's just say string describing and fix it.

144
00:10:30,950 --> 00:10:31,260
All right.

145
00:10:31,260 --> 00:10:32,140
There we go.

146
00:10:32,640 --> 00:10:37,370
And then this warning is just because we haven't used it yet which is fine.

147
00:10:37,630 --> 00:10:40,530
So now we're going to add it to our application shortcuts.

148
00:10:40,530 --> 00:10:46,690
We just say application that shortcut iTunes is equal to.

149
00:10:47,010 --> 00:10:51,540
And then we add the shortcut ocean shortcut.

150
00:10:51,540 --> 00:10:59,130
Remember I said that you can have at most for displaying shortcut quick actions and they all.

151
00:10:59,160 --> 00:11:01,780
And it gives priority to the static ones.

152
00:11:01,800 --> 00:11:02,360
OK.

153
00:11:02,520 --> 00:11:11,070
So if you had say three static shortcuts and then two dynamic shortcuts you're only going to see the

154
00:11:11,070 --> 00:11:14,410
first three static Plus one of the dynamic ones right.

155
00:11:14,430 --> 00:11:15,930
So keep that in mind.

156
00:11:16,440 --> 00:11:21,390
So if I ran this we would see four we would see the three static ones and then and then we have we would

157
00:11:21,390 --> 00:11:23,880
have an extra duplicate ocean shortcut.

158
00:11:24,340 --> 00:11:31,290
So go and do that just to just to see it and go in and go home and force click and there you see that

159
00:11:31,290 --> 00:11:32,980
we have two ocean ones.

160
00:11:33,030 --> 00:11:33,800
All right very nice.

161
00:11:33,810 --> 00:11:34,920
This is the static one.

162
00:11:34,920 --> 00:11:37,500
And then this is the other.

163
00:11:37,500 --> 00:11:39,690
This is the dynamic one that we created.

164
00:11:39,750 --> 00:11:47,400
We don't need to them so let's go ahead and remove our third static shortcut item and run that again

165
00:11:48,360 --> 00:11:49,130
and then go home.

166
00:11:49,130 --> 00:11:53,250
And let's just make sure everything is still working as expected.

167
00:11:53,250 --> 00:12:03,140
Click on ocean we go to ocean click on space and we go to space and could go on iTunes and we go to

168
00:12:03,140 --> 00:12:05,810
the mountains and very nice.

169
00:12:05,810 --> 00:12:13,620
All righty then ladies and gentlemen that finishes up our target topic on quick actions and 3D touch.

170
00:12:13,730 --> 00:12:15,940
And so we went through quite a bit.

171
00:12:15,950 --> 00:12:22,650
We talked about how to create static UI applications for items inside our up.

172
00:12:22,670 --> 00:12:27,230
We went over each of the keys and which ones are required which ones are optional.

173
00:12:27,530 --> 00:12:30,420
How to Create your custom icons if you want.

174
00:12:30,570 --> 00:12:36,470
Using sketch or Photoshop or something remember the you need your 35 by 35 points and exported at 1

175
00:12:36,470 --> 00:12:38,170
2 and 3 hex.

176
00:12:38,210 --> 00:12:45,530
Or you can use the system icons at your disposal and once you have those showing up on your app icon

177
00:12:45,860 --> 00:12:53,300
then you need to call the delegate function perform action for a shortcut item and then you can do a

178
00:12:53,300 --> 00:13:00,820
switch statement or you can do a bunch of if else is if you want and then just handle the shortcut item.

179
00:13:00,950 --> 00:13:08,480
Usually that involves navigating to one of your navigating to the specific view controller.

180
00:13:08,480 --> 00:13:14,170
And we worked on a couple of different scenarios there using one with a navigation controller.

181
00:13:14,450 --> 00:13:19,880
And then the one that we just did with the tab bar controller and I must say that I really like the

182
00:13:19,880 --> 00:13:21,570
tempo controller quite a bit.

183
00:13:21,620 --> 00:13:23,780
I think it looks good.

184
00:13:23,810 --> 00:13:32,480
All right so my challenge for you all is to on both the Tabar controller and the navigation controller

185
00:13:32,480 --> 00:13:41,000
versions add a fourth view controller and give it some sort of image or just a label to denote that

186
00:13:41,000 --> 00:13:42,320
it's the fourth one.

187
00:13:42,470 --> 00:13:44,600
Add a fourth.

188
00:13:44,630 --> 00:13:50,450
Quick action shortcut and navigate and make it so that you can navigate to it as well.

189
00:13:50,440 --> 00:13:58,400
All right so you should be pretty straightforward but this will help you go out on your own and reinforce

190
00:13:58,400 --> 00:14:00,050
the things that we that we just learned.

191
00:14:00,050 --> 00:14:00,660
All right.

192
00:14:00,890 --> 00:14:06,880
So go ahead and do that and show off your work in the dischord chat channel.

193
00:14:06,890 --> 00:14:12,140
I hope you enjoyed this target topic on short cuts and quick actions and I'll see you guys around.
