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 / printObjectMemoryAddress.swift
Created June 21, 2023 21:21 — forked from IamMarik/printObjectMemoryAddress.swift
print object memory address #swift
print(Unmanaged.passUnretained(self).toOpaque())
@perlguy99
perlguy99 / View+LightDarkPreviews.swift
Created January 8, 2022 19:37
View Extension for Light and Dark Previews
extension View {
var previewedInAllColorSchemes: some View {
ForEach(ColorScheme.allCases, id: \.self, content: preferredColorScheme)
}
}
@perlguy99
perlguy99 / video-howto.md
Created June 26, 2020 14:34
How to record a video of the Xcode Simulator

To take a video

xcrun simctl io booted recordVideo <filename>.<file extension>

For example:

xcrun simctl io booted recordVideo appVideo.mov

Press ctrl + c to stop recording the video.

@perlguy99
perlguy99 / clean_localizable.sh
Created June 5, 2020 14:57
Clean Localizable Strings (Starting Point)
#!/bin/bash
project_name="CleanLocalizableExample"
development_file="./$project_name/en.lproj/Localizable.strings"
es_duplicates=9
es_match=8
es_not_included=7
sort_and_find_duplicates() {
@perlguy99
perlguy99 / TimeLogger+Combine.swift
Created April 22, 2020 15:11
TimeLogger for Combine Debugging
// Note: This snipped comes from Ray Wenderlich's "Combine" book.
// https://store.raywenderlich.com/products/combine-asynchronous-programming-with-swift
class TimeLogger: TextOutputStream {
private var previous = Date()
private let formatter = NumberFormatter()
init() {
formatter.maximumFractionDigits = 5
formatter.minimumFractionDigits = 5
@perlguy99
perlguy99 / SwiftUI_Master.md
Last active April 9, 2020 18:27
SwiftUI Master Page
@perlguy99
perlguy99 / Path.swift
Created March 22, 2020 20:05
Path.swift by Razeware LLC
/// Copyright (c) 2018 Razeware LLC
///
/// Permission is hereby granted, free of charge, to any person obtaining a copy
/// of this software and associated documentation files (the "Software"), to deal
/// in the Software without restriction, including without limitation the rights
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
/// copies of the Software, and to permit persons to whom the Software is
/// furnished to do so, subject to the following conditions:
///
/// The above copyright notice and this permission notice shall be included in
@perlguy99
perlguy99 / SwiftLinks.md
Last active March 6, 2020 18:00
Swift and SwiftUI Links
@perlguy99
perlguy99 / SwiftUI_Extensions.md
Last active March 4, 2020 17:09
SwiftUI_Extensions

SwiftUI Extensions

Using ForEach with raw values

(So we don't have to use id: .self)

Reference

extension ForEach where Data.Element: Hashable, ID == Data.Element, Content: View {
    init(values: Data, content: @escaping (Data.Element) -> Content) {
@perlguy99
perlguy99 / SwiftUI_Buttons.md
Last active February 26, 2020 20:03
SwiftUI Buttons & TextFields