4 Chapter 5FIGURE 5-1: The Listview displaying a list of itemsFIGURE 5-2: For this example to work, you need to add the various flag images t...FIGURE 5-3: Each row showing the flag of the country and the country's name.FIGURE 5-4: Generating a list of items from 1 to 10 in a Listview using the Fo...FIGURE 5-5: The Listview enclosed within the NavigationView.FIGURE 5-6: Tapping the last item in the Listand displaying the item selected ...FIGURE 5-7: Adding a new row to the Listview.FIGURE 5-8: Deleting a row from the Listview.FIGURE 5-9: The Edit button allows you to delete items directly from the Listv...FIGURE 5-10: When the Listview is in edit mode, each item will display a Delet...FIGURE 5-11: The Delete button appears when you tap the Delete icon.FIGURE 5-12: The drag handle of each item allows you to rearrange the items.FIGURE 5-13: Rearranging an item in the Listview.FIGURE 5-14: The Settings app in iOS uses the Listview.FIGURE 5-15: The Listview displays two sections, each with two items.FIGURE 5-16: Displaying countries grouped by continent.FIGURE 5-17: Showing the Listview in GroupedListStyle.FIGURE 5-18: Sections are displayed without any headers.FIGURE 5-19: The Environment Overrides section on Xcode allows you to switch be...FIGURE 5-20: The Listview displayed in Dark mode.FIGURE 5-21: Viewing the preview in both Light and Dark modes.
5 Chapter 6FIGURE 6-1: The flow of a navigation-style app.FIGURE 6-2: The flow of a tabbed app.FIGURE 6-3: A Textview wrapped within a NavigationView.FIGURE 6-4: Displaying the navigation bar title.FIGURE 6-5: Displaying the navigation bar title in inlinedisplay mode.FIGURE 6-6: Clicking the This Is a Text View link navigates to another screen (...FIGURE 6-7: The back button to return to the previous screenFIGURE 6-8: You can now navigate between the screens using the Next and Back bu...FIGURE 6-9: The structure of the JSON content displayed using www.jsonlint.com.FIGURE 6-10: Displaying the news headlines using the Listview.FIGURE 6-11: Adding a package to your XCode project.FIGURE 6-12: Displaying an image next to each news headline.FIGURE 6-13: Displaying the navigation bar title.FIGURE 6-14: Reducing the font size of the navigation bar title.FIGURE 6-15: Previewing the details page.FIGURE 6-16: Tapping a news item displays the news in more detail.FIGURE 6-17: The details page with an empty space below the navigation bar.FIGURE 6-18: The empty space below the navigation bar is gone.FIGURE 6-19: Displaying a TabViewwith two screens.FIGURE 6-20: Programmatically displaying the TabView2.
6 Chapter 7FIGURE 7-1: The rectangle is displayed in the center of the screen.FIGURE 7-2: Showing the rectangle with a border.FIGURE 7-3: The VStackview now contains two rectangles.FIGURE 7-4: Aligning both rectangles to the right.FIGURE 7-5: The VStackviews now occupy the entire screen.FIGURE 7-6: Aligning the content of the VStackusing the leading and trailing o...FIGURE 7-7: Aligning the content of the VStackusing the topLeadingand bottomT...FIGURE 7-8: Applying padding to the first rectangle.FIGURE 7-9: Applying padding with the various specified options.FIGURE 7-10: The order of applying the modifiers matter.FIGURE 7-11: Applying a Spacerview between the two rectangles.FIGURE 7-12: The Spacerview expanding to fill up the space between the two rec...FIGURE 7-13: The Spacerview automatically adjusts its height based on the scre...FIGURE 7-14: Specifying the maxHeightand minHeightfor the Spacer view.FIGURE 7-15: Using the HStackview to contain the two rectangles.FIGURE 7-16: Using the Spacerview in the HStackview.FIGURE 7-17: Aligning the first rectangle to the bottom of the HStackview.FIGURE 7-18: The three Textviews are centered vertically within the HStackvie...FIGURE 7-19: The various alignment options applied to the views contained withi...FIGURE 7-20: Using the firstTextBaselineoption.FIGURE 7-21: Using the lastTextBaselineoption.FIGURE 7-22: Stacking the Textview over the Imageview in the ZStackview.FIGURE 7-23: Overlaying the Imageview with the Textview.FIGURE 7-24: Using a Spacerview in the ZStackview.FIGURE 7-25: The Horse in Motion by Eadweard Muybridge. FIGURE 7-26: The button in its original state.FIGURE 7-27: The button in its depressed state. (Poor button.)FIGURE 7-28: The views need some serious layout to make this look professional.FIGURE 7-29: The Settings app on the iPhone.FIGURE 7-30: The views laid out using the Formand Sectionviews.FIGURE 7-31: All container views in SwiftUI can contain, at most, ten views.FIGURE 7-32: All the images grouped together (top) and with a divider inserted ...
7 Chapter 8FIGURE 8-1: Displaying an email address in lowercase.FIGURE 8-2: Displaying the Alertview through the use of a state variable.FIGURE 8-3: The Toggleview changes its color when the Alertview is dismissed.FIGURE 8-4: Displaying a sheet in iOS.FIGURE 8-5: Clicking the Dismiss Sheet button does not dismiss the sheet.FIGURE 8-6: How binding works.FIGURE 8-7: Selecting from a list of search engines.FIGURE 8-8: Selecting a search engine will automatically update the ContentViewFIGURE 8-9: How the ObservableObjectprotocol works.FIGURE 8-10: How the ObservedOjbectproperty works.FIGURE 8-11: Selecting a tab page to select the search engine.FIGURE 8-12: Selecting a search engine will automatically update the ContentVie...FIGURE 8-13: The view in Light mode.FIGURE 8-14: The view in Dark mode.FIGURE 8-15: Overriding the custom environment variable values for a particular...FIGURE 8-16: Overriding the custom environment variable values for all views.
8 Chapter 9FIGURE 9-1: Legacy View controller and views.FIGURE 9-2: Three views in SwiftUI embedded within NavigationViewand TabView.FIGURE 9-3: The ContentViewand the TabViewshowing.FIGURE 9-4: Navigating to View1.FIGURE 9-5: Displaying View2 through the tab bar.FIGURE 9-6: The activity indicator spinning continuously.FIGURE 9-7: You can now start or stop the activity indicator.FIGURE 9-8: Loading Apple’s home page using the WebViewstruct.FIGURE 9-9: Testing the Image Picker.FIGURE 9-10: Displaying the image selected using the Image Picker.
9 Chapter 10FIGURE 10-1: Drawing a rectangle.FIGURE 10-2: The rectangle with the filled color and border.FIGURE 10-3: The rectangle with the padding applied before the border is drawn ...FIGURE 10-4: The border is applied first to the rectangle before the padding is...FIGURE 10-5: The rectangle rotated 45 degrees clockwise.FIGURE 10-6: The rectangle reduced in size by 50 percent.FIGURE 10-7: Drawing a rounded rectangle.FIGURE 10-8: Filling a rounded rectangle with a linear gradient.FIGURE 10-9: A rounded rectangle without any fill.FIGURE 10-10: Applying the border modifier to RoundedRectangledoesn't display ...FIGURE 10-11: Correctly applying a border around a rounded rectangle.FIGURE 10-12: Changing the border to a dotted line.FIGURE 10-13: Drawing a circle.FIGURE 10-14: Filling a circle with a radial gradient fill.FIGURE 10-15: Filling a circle with an angular gradient.FIGURE 10-16: Drawing a capsule.FIGURE 10-17: A capsule with equal width and height is a circle.FIGURE 10-18: Drawing an ellipse.FIGURE 10-19: Filling an ellipse with an angular gradient.FIGURE 10-20: Drawing an ellipse with a border.FIGURE 10-21: Displaying an image using the Imageview.FIGURE 10-22: Clipping the image with a circle.FIGURE 10-23: Displaying a shadow around the image clipped with a circle.FIGURE 10-24: Clipping the image with the capsule shape.FIGURE 10-25: Clipping the image with the ellipse shape.FIGURE 10-26: Clipping the image with the square shape.FIGURE 10-27: The constants representing the various points on the rectangle.FIGURE 10-28: Drawing two lines in the rectangle.FIGURE 10-29: The initial custom shape.FIGURE 10-30: Filling the custom shape with yellow.FIGURE 10-31: Filling the custom shape with a linear gradient.FIGURE 10-32: Drawing the outline of the custom shape reveals the missing line.FIGURE 10-33: The custom shape with the line added.FIGURE 10-34: The custom shape after adding the arc.FIGURE 10-35: Understanding how the addArc()modifier works.FIGURE 10-36: SwiftUI automatically draws a line connecting the last drawn poin...FIGURE 10-37: How the custom shape will look after adding the last line.FIGURE 10-38: Filling the custom shape and drawing borders around it at the sam...FIGURE 10-39: Applying the multiplyblend mode to the Imageview.FIGURE 10-40: Applying the different blend modes to the Imageview.FIGURE 10-41: Three circles overlapping each other.FIGURE 10-42: Applying the screenblend mode to all three circles.FIGURE 10-43: Applying the blur effects on the three circles.FIGURE 10-44: Applying the saturation effects to the three circles.
Читать дальше