Details

SwiftUI For Dummies


SwiftUI For Dummies


1. Aufl.

von: Wei-Meng Lee

22,99 €

Verlag: Wiley
Format: EPUB
Veröffentl.: 12.08.2020
ISBN/EAN: 9781119652700
Sprache: englisch
Anzahl Seiten: 416

DRM-geschütztes eBook, Sie benötigen z.B. Adobe Digital Editions und eine Adobe ID zum Lesen.

Beschreibungen

<p><b>The simplest way to create world-class apps</b></p> <p>Have a unique app idea but worried you don't quite have the coding skills to build it? Good news: You can stop fretting about someone beating you to market with the same idea and start work right now using SwiftUI. SwiftUI is a gateway app development framework that has become one of the best ways for fledgling developers to get iOS apps off the ground without having to become a coding expert overnight.</p> <p><i>SwiftUI For Dummies</i> makes that process even faster, providing a friendly introduction to the SwiftUI and Swift programming language and helping you feel right at home creating and building with playgrounds. The book also covers the frameworks and APIs that make it so easy to create smooth, intuitive interfaces—just dive right in and have fun!</p> <ul> <li>Combine projects into workspaces</li> <li>Employ Xcode editing tools</li> <li>Use constants and variables</li> <li>Test your code on iOS Simulator</li> </ul> <p>Time is of the essence, and with <i>SwiftUI For Dummies,</i> it's also on your side. Get going with this friendly guide today, and you'll be celebrating the successful launch of your app way before you thought possible!</p>
<p><b>Introduction</b><b> 1</b></p> <p>About This Book 1</p> <p>Foolish Assumptions 2</p> <p>Icons Used in This Book 2</p> <p>Beyond the Book 3</p> <p>Where to Go from Here 3</p> <p><b>Part 1: Getting Started with Swift and SwiftUI</b><b> 5</b></p> <p><b>Chapter 1: Introducing SwiftUI </b><b>7</b></p> <p>Understanding What SwiftUI Is 7</p> <p>Getting the Tools 11</p> <p>Hello, SwiftUI 12</p> <p>Automatically previewing your user interface using the canvas 14</p> <p>Working with Live Preview 18</p> <p>Generating different previews 19</p> <p>The Gory Details 21</p> <p>Info plist 22</p> <p>AppDelegate swift 22</p> <p>SceneDelegate swift 23</p> <p><b>Chapter 2: Basics of the Swift Programming Language</b><b> 25</b></p> <p>Basic Swift Syntax 26</p> <p>Constants 26</p> <p>Variables 27</p> <p>Strings 27</p> <p>Comments 27</p> <p>Basic Data Types 28</p> <p>Integers 28</p> <p>Floating-point numbers 29</p> <p>Booleans 29</p> <p>Tuples 30</p> <p>Arrays 30</p> <p>Retrieving elements from an array 31</p> <p>Inserting elements into an array 31</p> <p>Modifying elements in an array 31</p> <p>Appending elements to an array 31</p> <p>Removing elements from an array 32</p> <p>Dictionaries 32</p> <p>Retrieving elements from a dictionary 32</p> <p>Modifying an item in a dictionary 33</p> <p>Removing an item from a dictionary 33</p> <p>Optional Types 33</p> <p>Working with implicitly unwrapped optionals 35</p> <p>Using optional binding 36</p> <p>Unwrapping optionals using “?” 36</p> <p>Using the nil coalescing operator 37</p> <p>Functions 38</p> <p>Understanding input parameters 38</p> <p>Returning a value 39</p> <p>Flow Control 39</p> <p>If-Else statement 40</p> <p>Ternary conditional operator 40</p> <p>Switch statement 40</p> <p>Looping 41</p> <p>For-In loop 42</p> <p>While loop 42</p> <p>Repeat-While loop 42</p> <p>Control transfer statements 42</p> <p>Range operators 43</p> <p>Structures 43</p> <p>Memberwise initializers 44</p> <p>Structures as value types 45</p> <p>Classes 47</p> <p>Defining a class 47</p> <p>Understanding properties 47</p> <p>Using methods in classes 49</p> <p>Trying out the self property 50</p> <p>Closures 51</p> <p>Understanding closures 51</p> <p>Using functions as closures 52</p> <p>Assigning closures to variables 52</p> <p>Writing closures inline 53</p> <p>Understanding type inference 53</p> <p>Using shorthand argument names 54</p> <p>Working with the operator function 54</p> <p>Using trailing closures 55</p> <p>Protocols 55</p> <p>Defining and using a protocol 56</p> <p>Conforming to a protocol 56</p> <p>Using the Codable protocol 57</p> <p>Using the some keyword 59</p> <p><b>Part 2: Understanding the Basics of SwiftUI</b><b> 61</b></p> <p><b>Chapter 3: Getting Started with the Basics of SwiftUI</b><b> 63</b></p> <p>Taking a Look at SwiftUI Views 63</p> <p>Conforming to the View protocol 64</p> <p>Using modifiers 66</p> <p>Stacking modifiers 66</p> <p>Using the Inspector 67</p> <p>Displaying an Image 70</p> <p>Using modifiers on the Image view 72</p> <p>Resizing images 73</p> <p>Displaying a Button 75</p> <p>Customizing the button 76</p> <p>Adding actions 77</p> <p>Stacking the Views 78</p> <p>VStack 79</p> <p>HStack 80</p> <p>Putting on the Finishing Touches 85</p> <p><b>Chapter 4: Handling User Inputs and Custom Views </b><b>87</b></p> <p>Looking at Input Views 87</p> <p>TextField 88</p> <p>SecureField 92</p> <p>Toggle 93</p> <p>Slider 94</p> <p>Stepper 98</p> <p>Picker 100</p> <p>Composing Custom Views 103</p> <p>Composing the custom view 104</p> <p>Using the custom view 111</p> <p><b>Chapter 5: Displaying Lists of Items </b><b>113</b></p> <p>Using the List View to Display Items 113</p> <p>Customizing the rows 114</p> <p>Adding rows programmatically 116</p> <p>Alternative way to generate rows in a List view 119</p> <p>Displaying the List within a NavigationView 120</p> <p>Making the items tappable 121</p> <p>Adding rows 123</p> <p>Using the Identifiable protocol 125</p> <p>Deleting rows 126</p> <p>Editing rows 128</p> <p>Moving rows 130</p> <p>Displaying Sections 133</p> <p>Displaying sections from a dictionary 134</p> <p>Changing the style of the List view 136</p> <p>Previewing in Light and Dark Modes 138</p> <p>During runtime 138</p> <p>During design time 139</p> <p><b>Chapter 6: Creating Navigation and Tabbed Applications</b><b> 143</b></p> <p>Creating Navigation Apps 144</p> <p>Working with the two key views in navigation-style apps 145</p> <p>Navigating to a page 148</p> <p>Navigating programmatically 149</p> <p>Creating a news reader application 151</p> <p>Creating Tabbed Applications 167</p> <p>Using the TabView 168</p> <p>Selecting TabViews programmatically 169</p> <p><b>Chapter 7: Formatting Your User Interface</b><b> 173</b></p> <p>Laying Out Views Using Stacks 173</p> <p>VStack 174</p> <p>HStack 186</p> <p>ZStack 190</p> <p>Using Container Views 195</p> <p>Form and Section 198</p> <p>Group 200</p> <p>Divider 203</p> <p><b>Part 3: Exploring with SwiftUI in More Detail</b><b> 205</b></p> <p><b>Chapter 8: Understanding State Management in SwiftUI</b><b> 207</b></p> <p>Using a Property Wrapper 207</p> <p>Maintaining State Using State Variables 209</p> <p>Binding State Variables 213</p> <p>Managing State from External Objects 218</p> <p>Using the ObservableObject protocol and @Published 219</p> <p>Using the @ObservedObject 221</p> <p>Sharing Objects 223</p> <p>Accessing Built-in Environment Variables 228</p> <p>Defining your own environment keys 230</p> <p>Using your own environment keys 231</p> <p><b>Chapter 9: Using Legacy UIKit Views and View Controllers in SwiftUI</b><b> 235</b></p> <p>Using UIKit in SwiftUI 236</p> <p>Understanding the UIKit View Controller life cycle 237</p> <p>Understanding the SwiftUI view life cycle 239</p> <p>Using the UIViewRepresentable Protocol for UIKit Views 247</p> <p>ActivityIndicator 248</p> <p>WebView 251</p> <p>Using the UIViewControllerRepresentable Protocol for UIKit View Controllers 253</p> <p>Creating the ImagePickerViewController 254</p> <p>Handling events using coordinators 256</p> <p>Defining the methods in the Coordinator class 258</p> <p>Using the updated ImagePickerViewController 260</p> <p><b>Part 4: Performing Animations and Drawings</b><b> 263</b></p> <p><b>Chapter 10: Drawings and Special Effects</b><b> 265</b></p> <p>Drawing Using the Five Built-in Shapes 266</p> <p>Rectangles 266</p> <p>Rounded rectangles 270</p> <p>Circles 273</p> <p>Capsules 274</p> <p>Ellipses 275</p> <p>Clipping with the Basic Shapes 277</p> <p>Drawing Custom Shapes 281</p> <p>Drawing lines 283</p> <p>Filling the shape 284</p> <p>Drawing a border 286</p> <p>Drawing an arc 287</p> <p>Combining fill and stroke 289</p> <p>Using Special Effects in SwiftUI 292</p> <p>Blend modes 292</p> <p>Blurs 297</p> <p>Saturation 298</p> <p><b>Chapter 11: Performing Animations in SwiftUI</b><b> 299</b></p> <p>Understanding How to Animate 299</p> <p>Specifying the type of animation 303</p> <p>Repeating the animation 303</p> <p>Stopping the animation 304</p> <p>Performing Your Own Animation 307</p> <p>Rotating in 2D 307</p> <p>Rotating in 3D 309</p> <p>Creating a Custom Progress Indicator 314</p> <p>Indeterminate progress indicator 314</p> <p>Determinate progress indicator 318</p> <p><b>Chapter 12: Creating a Complete Project</b><b> 323</b></p> <p>Understanding What the App Does 323</p> <p>Building the Project 325</p> <p>Creating the layouts 325</p> <p>Defining the news sources and observable objects 328</p> <p>Fetching the data 330</p> <p>Displaying the news headlines 331</p> <p>Displaying the images 334</p> <p>Displaying the news 336</p> <p>Creating the share sheet 338</p> <p>Creating the preferences view 339</p> <p>Persisting the user’s preferences 344</p> <p>Deploying the App 346</p> <p><b>Part 5: The Part of Tens</b><b> 351</b></p> <p><b>Chapter 13: Ten SwiftUI Tips and Tricks</b><b> 353</b></p> <p>Resuming Live Preview 353</p> <p>Implementing Localization 354</p> <p>Combining Text Views 358</p> <p>Creating Custom Modifiers 360</p> <p>Displaying Multiple Alerts 362</p> <p>Enabling Debug Preview 363</p> <p>Previewing Using Different Devices 364</p> <p>Dark Mode Only Works On NavigationView 368</p> <p>Extracting Subviews 370</p> <p>Displaying a Context Menu 373</p> <p><b>Chapter 14: Ten Great SwiftUI Resources</b><b> 375</b></p> <p>Apple 375</p> <p>SwiftUI by Example 376</p> <p>100 Days of SwiftUI 376</p> <p>Gosh Darn SwiftUI 376</p> <p>SwiftUI Hub 376</p> <p>Awesome SwiftUI 377</p> <p>raywenderlich com 377</p> <p>Swift Talk 377</p> <p>About SwiftUI 377</p> <p>Stack Overflow 378</p> <p>Appendix: Code Snippets for Common Swiftui Views 379</p> <p>Index 387</p>
<p><b>Wei-Meng Lee</b> (Singapore) is founder of Developer Learning Solutions, a firm specializing in hands-on training for software developers. He teaches courses in mobile development, blockchain, machine learning, and AI. He is author of a number of books, including <i>Beginning Swift Programming</i> (Wiley).</p>

Diese Produkte könnten Sie auch interessieren:

Professional Java Native Interfaces with SWT / JFace
Professional Java Native Interfaces with SWT / JFace
von: Jackwind Li Guojie
Preis: 30,99 €
Domain Architectures
Domain Architectures
von: Daniel J. Duffy
Preis: 31,99 €
Pattern-Oriented Software Architecture, Patterns for Resource Management
Pattern-Oriented Software Architecture, Patterns for Resource Management
von: Michael Kircher, Prashant Jain
Preis: 33,99 €