What’s this some in SwiftUI?
<p>At this year’s <a href="https://developer.apple.com/wwdc19/" rel="noopener ugc nofollow" target="_blank">WWDC</a>, Apple introduced <a href="https://developer.apple.com/xcode/swiftui/" rel="noopener ugc nofollow" target="_blank"><em>SwiftUI </em></a>— 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 <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’s probably for either one (or both) of the following reasons:</p>
<ol>
<li>You need the beta of the new <strong>macOS 10.15</strong> (<em>Catalina</em>) for all <em>SwiftUI</em> features to work properly. (In particular, the <em>canvas</em> won’t work without it.) The latest Xcode 11 beta is not enough. </li>
<li>Don’t despair when you can’t figure out how to “<em>create a new Xcode project using the SwiftUI app template</em>”. <strong>It’s not in the template selection.</strong> It’s a check box you have to tick in the <em>next</em> step. Turns out you can actually <em>scroll</em> the tutorial page and you get all the necessary step-by-step instructions below. </li>
</ol>
<h1>What’s <code><em>"some"</em></code> thing?</h1>
<p>The next thing you’ll notice is that new keyword <em>some</em> which was <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 <em>some </em>thing does <em>some</em>thing and that something is related to a concept called <a href="https://docs.swift.org/swift-book/LanguageGuide/OpaqueTypes.html" rel="noopener ugc nofollow" target="_blank">opaque types</a>. Adding the keyword <em>some</em> in front of a return type indicates that the return type is <em>opaque</em>.</p>
<p><a href="https://medium.com/@PhiJay/whats-this-some-in-swiftui-34e2c126d4c4">Website</a></p>
<p> </p>