Skip to content

Commit 9f8fe8a

Browse files
Merge pull request #932 from apollographql/add/tutorial-3
New Tutorial Pt. 3
2 parents dabfb13 + 83a07ec commit 9f8fe8a

40 files changed

Lines changed: 806 additions & 91 deletions

docs/gatsby-config.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ module.exports = {
3131
'tutorial/tutorial-execute-query',
3232
'tutorial/tutorial-query-ui',
3333
'tutorial/tutorial-pagination',
34-
'tutorial/tutorial-detail-view'
34+
'tutorial/tutorial-detail-view',
35+
'tutorial/tutorial-authentication',
36+
'tutorial/tutorial-mutations'
3537
],
3638
Usage:[
3739
'downloading-schema',

docs/source/tutorial/components/detail_ui_setup_panel.mdx

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ import {
1313

1414
Show the **Library** of UI elements by clicking on the library button in the top right of Xcode:
1515

16-
![library button](../images/library_button.png)
16+
<img alt="library button" class="screenshot" src="../images/library_button.png"/>
1717

1818
Search for a `UIStackView`. When it comes up, drag it into the Detail View Controller in the storyboard. Select the stack view, go to the **Add New Constraints** button, and use the panel that pops up when you click it to pin the stack view 20pt from the superview's two sides and 40pt from the top:
1919

20-
![constraints builder with those constraints](../images/outer_stack_constraints.png)
20+
<img alt="constraints builder with those constraints" class="screenshot" src="../images/outer_stack_constraints.png"/>
2121

2222
In the right sidebar, update the settings of the Stack View in the Attributes Inspector to these:
2323

24-
![horizontal axis center alignment fill distribution spacing 20 uncheck baseline relative](../images/outer_stack_view_setup.png)
24+
<img alt="horizontal axis center alignment fill distribution spacing 20 uncheck baseline relative" class="screenshot" src="../images/outer_stack_view_setup.png"/>
2525

2626
</ExpansionPanelListItem>
2727
<ExpansionPanelListItem number="2">
@@ -32,33 +32,33 @@ Next, show the library again, and search for a **UIImageView**. Drag it into the
3232

3333
In Interface Builder's left sidebar, command-click on both the Image View and the view controller's main view to select both:
3434

35-
![selecting both views at once](../images/select_view_and_imageview.png)
35+
<img alt="selecting both views at once" class="screenshot" src="../images/select_view_and_imageview.png"/>
3636

3737
Next, tap the Add New Constraints button again, and select **Equal Widths**:
3838

39-
![adding the equal widths constraint](../images/equal_widths_constraint.png)
39+
<img alt="adding the equal widths constraint" class="screenshot" src="../images/equal_widths_constraint.png"/>
4040

4141
Select the constraint you just added using Interface Builder's left sidebar:
4242

43-
![select the widths constraint](../images/select_widths_constraint.png)
43+
<img alt="select the widths constraint" class="screenshot" src="../images/select_widths_constraint.png"/>
4444

4545
And update it to match the following:
4646

47-
![constant 0, priorty 1000, multiplier 0.4](../images/equal_widths_multiplier.png)
47+
<img alt="constant 0, priorty 1000, multiplier 0.4" class="screenshot" src="../images/equal_widths_multiplier.png"/>
4848

4949
This constraint means that the width of the image will always be 40% of the screen, no matter the size of the screen.
5050

5151
To add a constraint that keeps the height always equal to the width, select the Image View in Interface Builder's left sidebar, and click on the Add New Constraints button one last time. Select the **Aspect Ratio** constraint:
5252

53-
![adding the aspect ratio constraint](../images/aspect_ratio_constraint.png)
53+
<img alt="adding the aspect ratio constraint" class="screenshot" src="../images/aspect_ratio_constraint.png"/>
5454

5555
Select the constraint you just added using Interface Builder's left sidebar (note: The ratio may not be 1:1 yet, just look for the constraint that says "Aspect"):
5656

57-
![select the aspect ratio constraint](../images/select_aspect_constraint.png)
57+
<img alt="select the aspect ratio constraint" class="screenshot" src="../images/select_aspect_constraint.png"/>
5858

5959
And update it to match the following:
6060

61-
![constant 0, priority 1000, multiplier 1:1](../images/aspect_ratio_multiplier.png)
61+
<img alt="constant 0, priority 1000, multiplier 1:1" class="screenshot" src="../images/aspect_ratio_multiplier.png"/>
6262

6363
> **Note**: You might still see some sizing errors at this point, but those will go away in the next step.
6464
@@ -71,7 +71,7 @@ Finally, hook this image up to the `missionPatchImageView` outlet.
7171

7272
Next, add a second stack view to your horizontal stack view. Update the settings in the attributes inspector to these:
7373

74-
![vertical axis fill alignment equal spacing distribution spacing 8 uncheck baseline relative](../images/label_stack_view_setup.png)
74+
<img alt="vertical axis fill alignment equal spacing distribution spacing 8 uncheck baseline relative" class="screenshot" src="../images/label_stack_view_setup.png"/>
7575

7676
</ExpansionPanelListItem>
7777
<ExpansionPanelListItem number="4">
@@ -80,19 +80,19 @@ Next, add a second stack view to your horizontal stack view. Update the settings
8080

8181
Add a `UILabel` to the inner stack view. Select the label, go to the Attributes Inspector panel, and update the text, font size, and lines:
8282

83-
!["Mission Name" text, system bold 24.0 font, 0 lines](../images/mission_name_label.png)
83+
<img alt="Mission Name text, system bold 24.0 font, 0 lines" class="screenshot" src="../images/mission_name_label.png"/>
8484

8585
Hook this label up to the `missionNameLabel` outlet.
8686

8787
Next, add a second `UILabel` to the inner stack view. Again, select label, go to the Attributes Inspector panel, and update the text, font size, and lines:
8888

89-
!["Rocket Name" text, system 20.0 font, 0 lines](../images/rocket_name_label.png)
89+
<img alt="Rocket Name text, system 20.0 font, 0 lines" class="screenshot" src="../images/rocket_name_label.png"/>
9090

9191
Hook this label up to the `rocketNameLabel` outlet.
9292

9393
Next, add a third label to the inner stack view, and update its details to match the following:
9494

95-
!["Launch Site" text, system 14.0 font, 0 lines](../images/launch_site_label.png)
95+
<img alt="Launch Site text, system 14.0 font, 0 lines" class="screenshot" src="../images/launch_site_label.png"/>
9696

9797
Hook this last label up to the `launchSiteLabel` outlet.
9898

@@ -103,7 +103,7 @@ Hook this last label up to the `launchSiteLabel` outlet.
103103

104104
Drag in a `UIBarButtonItem` to the top right of the navigation bar. Rename it `Book Now!`:
105105

106-
!["Book Now" title](../images/bar_item_title.png)
106+
<img alt="Book Now title" class="screenshot" src="../images/bar_item_title.png"/>
107107

108108
Hook the item up to the `bookCancelButton` outlet.
109109

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
import {
2+
ExpansionPanel,
3+
ExpansionPanelList,
4+
ExpansionPanelListItem
5+
} from 'gatsby-theme-apollo-docs';
6+
7+
<ExpansionPanel title="Setting up the Login UI">
8+
9+
<ExpansionPanelList>
10+
<ExpansionPanelListItem number="1">
11+
12+
<h4>Set up the outer Stack View</h4>
13+
14+
Show the **Library** of UI elements by clicking on the library button in the top right of Xcode:
15+
16+
<img alt="library button" class="screenshot" src="../images/library_button.png"/>
17+
18+
Search for a `UIStackView`, and when it comes up, drag it into the Detail View Controller in the storyboard. Select the stack view, go to the **Add New Constraints** button, and use the panel that pops up when you click it to pin the stack view 20pt from the superview's two sides and 40pt from the top:
19+
20+
<img alt="constraints builder with those constraints" class="screenshot" src="../images/login_stackview_constraints.png"/>
21+
22+
In the right sidebar, update the settings of the Stack View in the Attributes Inspector to these:
23+
24+
<img alt="vertical axis fill alignment fill distribution spacing 8 uncheck baseline relative" class="screenshot" src="../images/login_stackview_details.png"/>
25+
26+
</ExpansionPanelListItem>
27+
<ExpansionPanelListItem number="2">
28+
29+
<h4>Add elements to the Stack View</h4>
30+
31+
Add a `UILabel` to the stack view. Select the label, go to the Attributes Inspector panel, and update the text and font:
32+
33+
<img alt="text Log In font Large Title" class="screenshot" src="../images/login_title_label_details.png"/>
34+
35+
Add a `UITextField` to the stack view. Select it, go to the Attributes Inspector panel, and update the placeholder text:
36+
37+
<img alt="placeholder email address" class="screenshot" src="../images/login_textfield_details.png"/>
38+
39+
Hook this text field up to the `emailTextField` outlet.
40+
41+
Add another `UILabel` to the stack view. Select it, go to the Attributes Inspector panel, and update the color, font, number of lines, and text:
42+
43+
<img alt="Text Errors color System Red font Body lines 0" class="screenshot" src="../images/login_error_label_details.png"/>
44+
45+
Hook this label up to the `errorLabel` outlet.
46+
47+
Add a `UIButton` to the stack view. Select it, go to the Attributes Inspector panel, and update the title text:
48+
49+
<img alt="Title text Submit" class="screenshot" src="../images/login_button_details.png"/>
50+
51+
Hook this button up to the `submitButton` outlet and the `touchUpInside` method for the `submitTapped` action.
52+
53+
</ExpansionPanelListItem>
54+
<ExpansionPanelListItem number="2">
55+
56+
<h4>Add a cancel button</h4>
57+
58+
Search in the library for a `UIBarButtonItem`:
59+
60+
<img alt="The output of the search" class="screenshot" src="../images/interface_builder_bar_button_item.png"/>
61+
62+
Drag it in to the top left hand side of the navigation bar. Then, select it and go to the Attributes Inspector panel, and make it a system cancel item:
63+
64+
<img alt="system item Cancel" class="screenshot" src="../images/login_cancel_button_details.png"/>
65+
66+
Hook this button up to the `cancelTapped` action.
67+
68+
</ExpansionPanelListItem>
69+
<ExpansionPanelListItem number="check">
70+
You're done!
71+
</ExpansionPanelListItem>
72+
</ExpansionPanelList>
73+
</ExpansionPanel>
83.1 KB
Loading
-3.45 KB
Loading
-26.8 KB
Loading
-16.3 KB
Loading
183 KB
Loading
185 KB
Loading
196 KB
Loading

0 commit comments

Comments
 (0)