Skip to content

Instantly share code, notes, and snippets.

@CodeSlicing
Created June 17, 2021 22:07
Show Gist options
  • Save CodeSlicing/4723d5613e76b6ea115237c744ecb29c to your computer and use it in GitHub Desktop.
Save CodeSlicing/4723d5613e76b6ea115237c744ecb29c to your computer and use it in GitHub Desktop.
Source code from CodeSlicing episode: Quick Tips - Code Without Resuming
//
// CodeWithoutResumingDemo.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([.white, .yellow, .orange, .red], center: UnitPoint(0.7, 0.3), from: 20, to: 320)
struct CodeWithoutResumingDemo: View {
var body: some View {
Circle()
.fill(hotspotGradient)
.frame(400)
}
}
struct CodeWithoutResumingDemo_Previews: PreviewProvider {
struct CodeWithoutResumingDemo_Harness: View {
var body: some View {
CodeWithoutResumingDemo()
.greedyFrame()
.background(Color(white: 0.1).ignoresSafeArea())
}
}
static var previews: some View {
CodeWithoutResumingDemo_Harness()
.previewDevice(.iPhone_12_Pro_Max)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment