Skip to content

Instantly share code, notes, and snippets.

View mitchellporter's full-sized avatar

Mitchell Porter mitchellporter

  • Seattle, WA
View GitHub Profile
@mitchellporter
mitchellporter / UIView+Shimmering.swift
Created January 25, 2024 18:33 — forked from antonio081014/UIView+Shimmering.swift
Shimmering Effect for UIView
import UIKit
extension UIView {
public var isShimmering: Bool {
get {
return layer.mask?.animation(forKey: shimmerAnimationKey) != nil
}
set {
if newValue {
startShimmering()
@mitchellporter
mitchellporter / questions.md
Created January 18, 2024 01:30 — forked from oguzhanvarsak/questions.md
Interview Questions for iOS Developers

Interview Questions for iOS Developers

1. Classes vs structs

In Swift, structs are value types whereas classes are reference types. When you copy a struct, you end up with two unique copies of the data. When you copy a class, you end up with two references to one instance of the data. It’s a crucial difference, and it affects your choice between classes or structs. (+ Class extendable, struct does not.)

2. What’s the difference between var and let? Which one would you choose for properties in a struct and why?

Both let and var are for creating variables in Swift. let helps you create immutable variables (constants) while on the other hand var creates mutable variables.

3. What does the mutating keyword mean?

The mutating keyword lets callers know that the method is going to make the value change.

@mitchellporter
mitchellporter / IAPHelper.txt
Created March 19, 2016 23:25 — forked from speaktoalvin/IAPHelper.txt
In App Purchase in Swift, with Receipt Validation
import UIKit
import StoreKit
//MARK: SKProductsRequestDelegate
extension IAPHelpers : SKProductsRequestDelegate
{
func productsRequest(request: SKProductsRequest, didReceiveResponse response: SKProductsResponse)
{
@mitchellporter
mitchellporter / README.md
Created May 30, 2019 16:44 — forked from acrookston/README.md
Xcode pre-action to build custom Info.plist

Automatic build versions from git in Xcode (and other goodies)

Installation procedure for pre-build actions to automatically populate Xcode Info.plist with dynamic data.

1. Xcode Scheme pre-action

Edit Xcode Scheme and add a pre-action script. Copy the contents of preaction.sh into the pre-action script box.

@mitchellporter
mitchellporter / async-await.js
Created June 6, 2017 20:51
async/await IIFE snippet
(async () => {
const func = () => {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve('some async result');
}, 5000);
});
}
@mitchellporter
mitchellporter / README.md
Created January 30, 2020 16:27 — forked from nikcub/README.md
Facebook PHP Source Code from August 2007
@mitchellporter
mitchellporter / Mento.playground
Created July 31, 2019 21:22 — forked from warpling/Mento.playground
Copying Tinder's "mentos" button animation (based on tweet: https://twitter.com/warpling/status/930567671015358464?s=20)
//: Playground - noun: a place where people can play
import UIKit
class Mento: UIView {
// The thickness ratio of our mento, 1.0 being a perfect sphere.
let mentoThicknessScale: CGFloat = 0.60
let shape: UIView = {
@mitchellporter
mitchellporter / iterm2-solarized.md
Created July 22, 2019 22:12 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k