Skip to content

Instantly share code, notes, and snippets.

View byaruhaf's full-sized avatar
🏄
Surfing Xcode

Franklin Byaruhanga byaruhaf

🏄
Surfing Xcode
View GitHub Profile
@byaruhaf
byaruhaf / CopyConfigurationResources.sh
Created December 13, 2020 01:21 — forked from Ashton-W/CopyConfigurationResources.sh
CopyConfigurationResources Xcode Build Phase Script
#!/usr/bin/env bash
# Build Phase Script for use in Xcode
# Copy Resources based on Configuration
#
# https://gist.github.com/Ashton-W/a47ec8b128ecbe470632
set -o nounset
# From Build Environment
#!/bin/sh
# make sure you have imagemagick installed: brew install imagemagick
# your app_icons.sh file should have the correct permissions: run `chmod 775 app_icons.sh` in your terminal from where you put this file
# put your `my_icon.png` next to this file and run ./app_icons.sh to export your app icons
x=my_icon.png
y=${x%.*}
# delete the export directory so we start clean
@byaruhaf
byaruhaf / swiftc_help.txt
Created November 29, 2020 17:56 — forked from enomoto/swiftc_help.txt
$ swiftc -help
OVERVIEW: Swift compiler
USAGE: swiftc [options] <inputs>
MODES:
-dump-ast Parse and type-check input file(s) and dump AST(s)
-dump-parse Parse input file(s) and dump AST(s)
-dump-scope-maps <expanded-or-list-of-line:column>
Parse and type-check input file(s) and dump the scope map(s)
-dump-type-refinement-contexts
//
// AnimatableVector2D.swift
//
// this is derivation of generic AnimatableVector presented at: https://nerdyak.tech/development/2020/01/12/animating-complex-shapes-in-swiftui.html
//
// Created by Pavel Zak on 18/05/2020.
//
import SwiftUI
@byaruhaf
byaruhaf / updateBuildNumber.sh
Created September 26, 2020 07:02 — forked from hishma/updateBuildNumber.sh
Shell script to update the build number (CFBundleVersion) of the info.plist in the build folder.
# Shamelessly ripped of from https://blog.curtisherbert.com/automated-xcode-build-numbers-early-2019-edition/
#
git=`sh /etc/profile; which git`
bundleVersion=`"$git" rev-list --all | wc -l | tr -d '[:space:]'`
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $bundleVersion" "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}"
echo "☛ BUILD NUMBER: ${bundleVersion}"
@byaruhaf
byaruhaf / dispatch7.swift
Created August 26, 2020 14:00 — forked from yostane/dispatch7.swift
DispatchWorkItem notify example
let dwi3 = DispatchWorkItem {
print("start DispatchWorkItem")
sleep(2)
print("end DispatchWorkItem")
}
//this block will be executed on a the siqpatch queue 'dq' when dwi3 completes
let myDq = DispatchQueue(label: "A custom dispatch queue")
dwi3.notify(queue: myDq) {
print("notify")
}
@byaruhaf
byaruhaf / starredRepositories.graphql
Created July 31, 2020 09:24 — forked from flesch/starredRepositories.graphql
starredRepositories.graphql
query starredRepositories($repositories: Int = 10, $after: String, $releases: Int = 1) {
viewer {
starredRepositories(first: $repositories, after: $after, ownedByViewer: false, orderBy: {field: STARRED_AT, direction: DESC}) {
pageInfo {
hasNextPage
endCursor
}
edges {
cursor
starredAt
import Foundation
import Combine
// MARK: - ClueElement
struct ClueElement: Codable {
  let id: Int
  let answer, question: String
  let value: Int
  let categoryID: Int
  let category: Category
@byaruhaf
byaruhaf / invocation.sh
Created July 19, 2020 12:02 — forked from ole/!swiftui-reflection-dump.md
A dump of the SwiftUI.framework binary for the iOS simulator (as of Xcode 12.0 beta 2) using the swift-reflection-dump tool.
# Call this inside the bin directory of a build of the Swift compiler,
# e.g. build/Xcode-ReleaseAssert/swift-macosx-x86_64/Release/bin.
#
# Adjust the path to match your Xode installation or pick a different binary to dump.
#
# Tested with Xcode 12.0 beta 2.
#
# Note: I used a Swift 5.3 compiler build from a few weeks ago that I had laying around.
# Because of ABI stability, I don't think the swift-reflection-dump version has to match
# the compiler version that was used to build the binary, but I'm not 100% sure.
@byaruhaf
byaruhaf / SubscriptedTextView
Created July 18, 2020 07:01
A SwiftUI View used to display strings with subscripted text
import SwiftUI
struct SubscriptedTextView: View {
// MARK: Properties
let abbreviation: String
var body: some View {
subscriptedText()