Skip to content

Instantly share code, notes, and snippets.

View iosdevzone's full-sized avatar

idz iosdevzone

View GitHub Profile
@iosdevzone
iosdevzone / gist:985340046154d290e7e9c22390efb6d7
Created November 8, 2023 04:49 — forked from salabaha/UIViewBuilder.swift
UIViewBuilder syntactic sugar
import UIKit
///
///Declaration
///
protocol UIViewBuilder: AnyObject {}
extension UIViewBuilder where Self: UIView {
init(_ build: ((Self) -> Void)) {
@iosdevzone
iosdevzone / ContentView.swift
Created November 10, 2023 00:09
Update to ContentView.swift to synchronize Core Data context with Swift Data
// Modified version of ContentView.swift from Pol Piella's blog
// post "Using Core Data and Swift Data side by side".
//
// See: https://www.polpiella.dev/core-data-and-swift-data
//
// Crux is in the `onAppear`.
// ```
// .onAppear() {
// NotificationCenter.default.addObserver(forName: Notification.Name.NSManagedObjectContextDidSave,
// object: nil,