Skip to content

Instantly share code, notes, and snippets.

View DominikBucher12's full-sized avatar
🚀
#YOLO

Dominik Bucher DominikBucher12

🚀
#YOLO
View GitHub Profile
@kieranb662
kieranb662 / XcodeKitHelpers.md
Last active April 6, 2023 15:44
[Xcode Editor Notes] Xcodekit Extensions to help make Xcode your own custom text editor.

Xcode Editor Notes

Suggestions

After adding the Extension target to a project

  1. Go to the menu bar -> Product -> Scheme -> Edit Scheme.
  2. Under the info tab change the executable dropdown menu to "Xcode.app".
  3. If you have a testing file add it to the "Arguments Passed On Launch" field under the Arguments tab.
/// `ObjectBinding` used as a way to create a `Binding` from a `BindableObject`. In this case the ViewModel
/// complies with `BindableObject` which is then translated into a `Binding` which is what `Toggle` is expecting
/// NOTE: Since it's a `DynamicViewProperty`, after its value is changed, the body will be updated.
class ViewModel: BindableObject {
let didChange = PassthroughSubject<ViewModel, Never>()
var isEnabled = false {
didSet {
didChange.send(self)
@steipete
steipete / TempDir.swift
Created October 25, 2018 09:17
Based on https://nshipster.com/temporary-files/ I ran some experiments with the recommended replacement API for NSTemporaryDirectory(). It's not straightforward.
// tl;dr: FileManager.default.url(for:in:appropriateFor:create:) has unexpected behavior in Simulator and creates temporary folders outside the tmp/ directory.
let tmpDirClassic = NSTemporaryDirectory()
print("tmpDirClassic: \(tmpDirClassic)")
// This is the same code, just syntax sugar for NSTemporaryDirectory()
// https://github.com/apple/swift-corelibs-foundation/blob/master/Foundation/FileManager.swift#L1420-L1422
let tmpDirClassicNewShim = FileManager.default.temporaryDirectory
print("tmpDirClassicNewShim: \(tmpDirClassicNewShim)")
// Simulator: /Users/steipete/Library/Developer/CoreSimulator/Devices/31C05637-B9C9-482C-A6CE-D063A7CECF64/data/Containers/Data/Application/A68D11A4-88BA-4FCF-A8B1-D102945D0740/tmp/
@ManWithBear
ManWithBear / create_simulators
Last active January 17, 2022 15:18
Create my simulators setup
#!/bin/bash
xcrun simctl delete $(xcrun simctl list | grep -o '[0-9A-F]\{8\}-[0-9A-F]\{4\}-[0-9A-F]\{4\}-[0-9A-F]\{4\}-[0-9A-F]\{12\}' | xargs)
xcrun simctl delete unavailable
runtime="com.apple.CoreSimulator.SimRuntime.iOS-12-2"
xcrun simctl create "1. Monday (X)" com.apple.CoreSimulator.SimDeviceType.iPhone-X $runtime
xcrun simctl create "2. Tuesday (Air 2)" com.apple.CoreSimulator.SimDeviceType.iPad-Air-2 $runtime
xcrun simctl create "3. Wednesday (8)" com.apple.CoreSimulator.SimDeviceType.iPhone-8 $runtime
xcrun simctl create "4. Thursday (8 Plus)" com.apple.CoreSimulator.SimDeviceType.iPhone-8-Plus $runtime
xcrun simctl create "5. Friday (SE)" com.apple.CoreSimulator.SimDeviceType.iPhone-SE $runtime
@ManWithBear
ManWithBear / delete_all_simulators.sh
Created September 19, 2018 08:18
Script to delete all your simulators
#!/bin/bash
xcrun simctl delete $(xcrun simctl list | grep -o '[0-9A-F]\{8\}-[0-9A-F]\{4\}-[0-9A-F]\{4\}-[0-9A-F]\{4\}-[0-9A-F]\{12\}' | xargs)
xcrun simctl delete unavailable
@ManWithBear
ManWithBear / multi_devices_test.sh
Created April 20, 2018 15:01 — forked from fedejordan/multi_devices_test.sh
Blog01 - Script for run tests in different devices for an iOS project
#!/bin/bash
# Script configuration
devicesArray=(
"iPhone 8"
"iPhone 8 Plus"
"iPhone 5s"
"iPhone X")
@osnr
osnr / tap.swift
Created December 22, 2017 21:27
//
// ScreenCapture.swift
// Screenotate
//
// Created by Omar Rizwan on 7/6/17.
// Copyright © 2017 Omar Rizwan. All rights reserved.
//
import Foundation
import Cocoa
import UIKit
class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
@IBOutlet weak var tableView: UITableView!
override func viewDidLoad() {
super.viewDidLoad()
NSLayoutConstraint.activate([
tableView.topAnchor.constraint(equalTo: view.topAnchor),
@EricADockery
EricADockery / Fastfile
Created July 25, 2017 16:42
Parallel iOS Testing using Bluepill
lane :bluepill do
scan(scheme: “myApp”, build_for_testing: true)
sh “bash ./bluepill.sh“
end
@ManWithBear
ManWithBear / xcode.md
Last active September 25, 2018 08:35
Move open bracket on new line in default xcode snippets
  1. Find SystemCodeSnippets.codesnippets file. For Xcode8:
    /Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Resources/SystemCodeSnippets.codesnippets
  2. Make save copy of snippets cp SystemCodeSnippets.codesnippets ~/Desktop/
  3. Open in vim: sudo vim SystemCodeSnippets.codesnippets
  4. Move every open bracket on new line :%s/ {/\r{/g
  5. Save and close :wq
  6. Restart Xcode
  7. ????
  8. PROFIT!