Skip to content

Instantly share code, notes, and snippets.

import SwiftUI
@main
struct TestProjectApp: App {
var appState = AppState()
@Environment(\.scenePhase) var scenePhase
var body: some Scene {
WindowGroup {
@lightandshadow68
lightandshadow68 / PostEdit.swift
Last active July 17, 2023 17:48
Vanilla SwiftUI Core Data edit
import SwiftUI
import CoreData
struct PostEditView: View {
@ObservedObject var post: Post
@Environment(\.managedObjectContext) var moc
@State var hasChanges: Bool = false
var body: some View {
import Foundation
import SwiftUI
class ViewModel: ObservableObject {
var downloadURL = URL(string: "https://i.redd.it/dwlyzl73nv071.jpg")!
@Published var downsampledImage: Image?
func downloadResourceToURL(optimize: Bool, width: CGFloat) {
// UITableView+Appearance.h
// - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface UITableView (Appearance)<UIAppearance>
@property (nonatomic, assign) CGFloat footerViewHeight UI_APPEARANCE_SELECTOR;
@end
NS_ASSUME_NONNULL_END
// UITableView+Appearance.h
// - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface UITableView (Appearance)<UIAppearance>
@property (nonatomic, assign) CGFloat footerViewHeight UI_APPEARANCE_SELECTOR;
@end
NS_ASSUME_NONNULL_END
// UITableView+Appearance.h
// - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface UITableView (Appearance)<UIAppearance>
@property (nonatomic, assign) CGFloat footerViewHeight UI_APPEARANCE_SELECTOR;
@end
NS_ASSUME_NONNULL_END
// UITableView+Appearance.h
// - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface UITableView (Appearance)<UIAppearance>
@property (nonatomic, assign) CGFloat footerViewHeight UI_APPEARANCE_SELECTOR;
@end
NS_ASSUME_NONNULL_END
// UITableView+Appearance.h
// - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface UITableView (Appearance)<UIAppearance>
@property (nonatomic, assign) CGFloat footerViewHeight UI_APPEARANCE_SELECTOR;
@end
NS_ASSUME_NONNULL_END
<CBL_FMDatabase: 0x7fd8b2c26880> executeQuery: SELECT sequence, revid, deleted FROM revs WHERE doc_id=? AND current ORDER BY sequence DESC
obj: 5887
>>>>>>>>>>>>>>>>>>>>>>>>> 7 total Conflicts for: f8ee7974-9558-4ba4-ba94-6a7ce98c58b4
<CBL_FMDatabase: 0x7fd8b2c26880> executeUpdate: SAVEPOINT cbl_1
14:15:00.826| CBLDatabase: Begin transaction (level 1)...
14:15:00.826| CBLDatabase: PUT rev={f8ee7974-9558-4ba4-ba94-6a7ce98c58b4 #(null) DEL}, prevRevID=114-b119801ccce39c63560dd7a3576a38ea, allowConflict=0
<CBL_FMDatabase: 0x7fd8b2c26880> executeUpdate: SAVEPOINT cbl_2
14:15:00.827| CBLDatabase: Begin transaction (level 2)...
<CBL_FMDatabase: 0x7fd8b2c26880> executeQuery: SELECT revid, deleted FROM revs WHERE doc_id=? and current=1 ORDER BY deleted asc, revid desc LIMIT 2
obj: 5887
CheckoutsController.class_eval do
# customized verison of the standard r_c update method (since we need to handle gateway errors, etc)
def update
load_object
# call the edit hooks for the current step in case we experience validation failure and need to edit again
edit_hooks
@checkout.enable_validation_group(@checkout.state.to_sym)
@prev_state = @checkout.state