Skip to content

Instantly share code, notes, and snippets.

View perlguy99's full-sized avatar

Brent Michalski perlguy99

View GitHub Profile
@perlguy99
perlguy99 / AddingViewInspector.md
Last active July 24, 2024 15:23
Adding ViewInspector to your project

HowTo add ViewInspector to a Project

Shout Out!

First off, I need to give a shout out to Jon Reid and Quality Coding. His blog at Quality Coding Blog it was through Jon's posts and live coding sessions where all of this code got fleshed out.

1. Add ViewInspector branch 0.10.0 to your project

  • For the Target, choose your Test Target

2. Create a file named TestableView.swift with the following contents:

@perlguy99
perlguy99 / gist:31de4267c31e628cad40f4b69ea49546
Created May 3, 2024 16:07
If Xcode gets stuck at "Preparing iPhone Simulator for Previews"
xcrun simctl --set previews delete all
@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