Skip to content

Instantly share code, notes, and snippets.

@SlappyAUS
SlappyAUS / ShapeStroke.swift
Created January 21, 2021 08:17
Shape Stoke #swiftui #shapes
Capsule()
.fill(Color.green)
.overlay(
Capsule()
.stroke(Color.black, lineWidth: 10)
)
.frame(width: 200, height: 100)
@SlappyAUS
SlappyAUS / SearchableGrid.swift
Created January 28, 2021 04:29
SearchableGrid
import SwiftUI
import CoreData
struct SearchableGrid<T: NSManagedObject, Content: View, EmptyContent: View>: View where T: Identifiable {
@Environment(\.managedObjectContext) var context
@StateObject private var viewModel = SearchableGridGridViewModel<T>()
let dropEntered : (DropInfo, SearchableGridGridViewModel<T>, T) -> ()
let dropUpdated : ((DropInfo, T) -> DropProposal?)?
@SlappyAUS
SlappyAUS / swiftui url update.swift
Created February 8, 2021 08:04
swiftui url update #swiftui #data #url
import Combine
class MyObserableObject: ObservableObject {
@Published var myData: [Int] = []
private var subscription: AnyCancellable?
init() {
subscription = Timer
.TimerPublisher(interval: 1, runLoop: RunLoop.main, mode: .default)
.map { _ -> AnyPublisher<[Int], Never> in
URLSession