Created
June 17, 2021 22:06
-
-
Save CodeSlicing/57647967a77e0d555a65ba5cc493f12a to your computer and use it in GitHub Desktop.
Native source code from CodeSlicing episode: Quick Tips - Code Without Resuming
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// CodeWithoutResumingDemoNative.swift | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to deal | |
// in the Software without restriction, including without limitation the rights | |
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies | |
// of the Software, and to permit persons to whom the Software is furnished to do so, | |
// subject to the following conditions: | |
// | |
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, | |
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A | |
// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | |
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN | |
// AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | |
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
// | |
// Created by Adam Fordyce on 17/06/2021. | |
// Copyright © 2020 Adam Fordyce. All rights reserved. | |
// | |
import SwiftUI | |
import PureSwiftUI | |
private let hotspotGradient = RadialGradient(gradient: Gradient(colors:[.white, .yellow, .orange, .red]), center: UnitPoint(0.7, 0.3), startRadius: 20, endRadius: 320) | |
struct CodeWithoutResumingDemo: View { | |
var body: some View { | |
Circle() | |
.fill(hotspotGradient) | |
.frame(width: 400, height: 400) | |
} | |
} | |
struct CodeWithoutResumingDemo_Previews: PreviewProvider { | |
struct CodeWithoutResumingDemo_Harness: View { | |
var body: some View { | |
CodeWithoutResumingDemo() | |
.frame(maxWidth: .infinity, maxHeight: .infinity) | |
.background(Color(white: 0.1).ignoresSafeArea()) | |
} | |
} | |
static var previews: some View { | |
CodeWithoutResumingDemo_Harness() | |
.previewDevice("iPhone 12 Pro Max") | |
.previewDisplayName("iPhone 12 Pro Max") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment