Skip to content

Instantly share code, notes, and snippets.

View perlguy99's full-sized avatar

Brent Michalski perlguy99

  • Senior iOS Engineer
  • St. Louis, MO
View GitHub Profile
@perlguy99
perlguy99 / .xcodesamplecode.plist
Created December 7, 2019 02:47
Maybe help Xcode render markdown
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array/>
</plist>
@perlguy99
perlguy99 / SwiftUI_Previews.md
Created December 2, 2019 19:37
Fix SwiftUI Previews
@perlguy99
perlguy99 / ImageSaver.swift
Created November 30, 2019 16:04
Image Saver
// ImageSaver.swift
//
// Created by Brent Michalski on 11/30/19.
// Copyright © 2019 Brent Michalski. All rights reserved.
//
import UIKit
class ImageSaver: NSObject {
var successHandler: (() -> Void)?
@perlguy99
perlguy99 / KeyboardAvoiding+ViewModifier.swift
Created November 27, 2019 16:27
KeyboardAvoiding View Modifier
//
// KeyboardAvoiding+ViewModifier.swift
//
// Created by Michalski (US), James B on 11/27/19.
// Copyright © 2019 Brent Michalski. All rights reserved.
//
import SwiftUI
import Combine
@perlguy99
perlguy99 / DismissingKeyboard+ViewModifier.swift
Created November 27, 2019 16:25
Dismissing Keyboard View Modifier
//
// DismissingKeyboard+ViewModifier.swift
//
// Created by Michalski (US), James B on 11/27/19.
// Copyright © 2019 Brent Michalski. All rights reserved.
//
import SwiftUI
struct DismissingKeyboard: ViewModifier {
@perlguy99
perlguy99 / ImagePicker.swift
Last active November 30, 2019 16:04
SwiftUI ImagePicker
//
// ImagePicker.swift
//
// Created by Brent Michalski on 11/25/19.
// Copyright © 2019 Perlguy, Inc. All rights reserved.
//
import SwiftUI
struct ImagePicker: UIViewControllerRepresentable {
@perlguy99
perlguy99 / SwiftUI_Coordinators.md
Created November 26, 2019 14:02
SwiftUI Coordinators
@perlguy99
perlguy99 / Swift_git_ignore.md
Created November 26, 2019 13:40
Swift gitignore
@perlguy99
perlguy99 / SwiftUI_Anyview.md
Last active December 22, 2020 21:36
SwiftUI AnyView vs Group: type erasure in practice

SwiftUI

AnyView vs Group: type erasure in practice

SwiftUI in 100 Days

Key Points

  • Type erasure is the process of hiding the underlying type of some data.
    • This is used often in Swift: we have type erasing wrappers such as AnyHashable and AnySequence, and all they do is act as shells that forward on their operations to whatever they contain, without revealing what the contents are to anything externally.
@perlguy99
perlguy99 / CoreDataRelationshipsAndSwiftUI.md
Created November 20, 2019 18:40
CoreData Relationships and SwiftUI

Core Data Relationships and SwiftUI

For Core Data entities to track candy bars and their contries of origin...

Relationships come in four forms:

  • A one to one relationship means that one object in an entity links to exactly one object in another entity. In our example, this would mean that each type of candy has one country of origin, and each country could make only one type of candy.
  • A one to many relationship means that one object in an entity links to many objects in another entity. In our example, this would mean that one type of candy could have been introduced simultaneously in many countries, but that each country still could only make one type of candy.
  • A many to one relationship means that many objects in an entity link to one object in another entity. In our example, this would mean that each type of candy has one country of origin, and