What’s this some in SwiftUI?

<p>At this year&rsquo;s&nbsp;<a href="https://developer.apple.com/wwdc19/" rel="noopener ugc nofollow" target="_blank">WWDC</a>, Apple introduced&nbsp;<a href="https://developer.apple.com/xcode/swiftui/" rel="noopener ugc nofollow" target="_blank"><em>SwiftUI&nbsp;</em></a>&mdash; a completely new approach to create user interfaces in Xcode in a declarative way. To help you get started with the new framework, they published some beautifully designed&nbsp;<a href="https://developer.apple.com/tutorials/swiftui" rel="noopener ugc nofollow" target="_blank">tutorials</a>.</p> <h2>Some advice upfront:</h2> <p>If you get stuck in the first tutorial in section 1, it&rsquo;s probably for either one (or both) of the following reasons:</p> <ol> <li>You need the beta of the new&nbsp;<strong>macOS 10.15</strong>&nbsp;(<em>Catalina</em>) for all&nbsp;<em>SwiftUI</em>&nbsp;features to work properly. (In particular, the&nbsp;<em>canvas</em>&nbsp;won&rsquo;t work without it.) The latest Xcode 11 beta is not enough.&nbsp;</li> <li>Don&rsquo;t despair when you can&rsquo;t figure out how to &ldquo;<em>create a new Xcode project using the SwiftUI app template</em>&rdquo;.&nbsp;<strong>It&rsquo;s not in the template selection.</strong>&nbsp;It&rsquo;s a check box you have to tick in the&nbsp;<em>next</em>&nbsp;step. Turns out you can actually&nbsp;<em>scroll</em>&nbsp;the tutorial page and you get all the necessary step-by-step instructions below.&nbsp;</li> </ol> <h1>What&rsquo;s&nbsp;<code><em>&quot;some&quot;</em></code>&nbsp;thing?</h1> <p>The next thing you&rsquo;ll notice is that new keyword&nbsp;<em>some</em>&nbsp;which was&nbsp;<a href="https://github.com/apple/swift-evolution/blob/master/proposals/0244-opaque-result-types.md" rel="noopener ugc nofollow" target="_blank">introduced in Swift 5.1</a>. That might be confusing in the beginning. After all, a computed property always returns some value of a certain type, right?!</p> <p><img alt="" src="https://miro.medium.com/v2/resize:fit:571/1*H5HD0fxe-XClEvJGTVj2bw.png" style="height:246px; width:634px" /></p> <p>Apparently, that&nbsp;<em>some&nbsp;</em>thing does&nbsp;<em>some</em>thing and that something is related to a concept called&nbsp;<a href="https://docs.swift.org/swift-book/LanguageGuide/OpaqueTypes.html" rel="noopener ugc nofollow" target="_blank">opaque types</a>. Adding the keyword&nbsp;<em>some</em>&nbsp;in front of a return type indicates that the return type is&nbsp;<em>opaque</em>.</p> <p><a href="https://medium.com/@PhiJay/whats-this-some-in-swiftui-34e2c126d4c4">Website</a></p> <p>&nbsp;</p>
Tags: SwiftUI opaque