Skip to content

Instantly share code, notes, and snippets.

import PlaygroundSupport
import SwiftUI
struct LiveView: View {
@State var isPresented = false
var modalPresentation: some View {
NavigationView {
Text("Hello World")
.font(.caption)
import PlaygroundSupport
import SwiftUI
extension View {
public func offset(by offset: CGPoint) -> Self.Modified<_OffsetEffect> {
self.offset(x: offset.x, y: offset.y)
}
}
struct LiveView : View {
import PlaygroundSupport
import SwiftUI
struct MouseState {
var corded = 0
var cordless = 0
var magic = 0
var total: Int {
return corded + cordless + magic
}
import PlaygroundSupport
import SwiftUI
struct MouseState {
var corded = 0
var cordless = 0
var magic = 0
var total: Int {
return corded + cordless + magic
}
@erica
erica / tests.swift
Last active February 14, 2019 20:11
//-----------------------------------------------------------------------------
// MARK: Time Test
//-----------------------------------------------------------------------------
import Foundation
/// Prints the elapsed time to execute a block under whatever optimization
/// conditions are currently in use by the compiler
public func timetest(_ note: String, block: () -> Void) {
print("Starting Test:", note)
/// Unconditionally prints a given message and stops execution.
///
/// - Parameters:
/// - reason: The string to print.
/// - function: The name of the calling function to print with `reason`. The
/// default is the calling scope where `fatalError(because:, function:, file:, line:)`
/// is called.
/// - file: The file name to print with `reason`. The default is the file
extension Never {
/// A developer facing statement explaining how program correctness has failed.
public struct Reason: CustomStringConvertible {
public let description: String
public init(_ rationale: String) {
self.description = rationale
}
}
}
@erica
erica / keypath.md
Last active January 16, 2019 21:38

Keypath Literal Getter Promotion

  • Proposal: SE-nnnn
  • Authors: TBD
  • Review Manager: TBD
  • Status: Awaiting implementation