Skip to content

Instantly share code, notes, and snippets.

@simme
simme / UITabBarController+ToggleTabBar.swift
Created January 25, 2018 15:36
Extension on UITabBarController for hiding/showing the tab bar.
extension UITabBarController {
/**
Show or hide the tab bar.
- Parameter hidden: `true` if the bar should be hidden.
- Parameter animated: `true` if the action should be animated.
- Parameter transitionCoordinator: An optional `UIViewControllerTransitionCoordinator` to perform the animation
along side with. For example during a push on a `UINavigationController`.
*/
//
// UITestCase.swift
//
// Created by Gleb Tarasov on 23/04/2018.
//
import Foundation
import XCTest
import UIKit
@Busta117
Busta117 / ObjectMapperRealmHelper.swift
Last active March 1, 2020 16:56
map Realm arrays into ObjectMapper
//
// ObjectMapperRealmHelper.swift
//
// Created by Santiago Bustamante on 07/27/18.
//
//
import ObjectMapper
import RealmSwift
@drumnkyle
drumnkyle / ButtonScrollPerformanceTest.m
Last active February 12, 2019 14:54
Full Scroll Performance Framework
/*
The MIT License
Copyright (c) 2010-2018 Google, Inc. http://angularjs.org
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
@leonid-s-usov
leonid-s-usov / RecordAudio.swift
Last active February 16, 2025 18:55 — forked from hotpaw2/RecordAudio.swift
Swift Audio Recording class. Reads buffers of input samples from the microphone using the iOS RemoteIO Audio Unit API
//
// RecordAudio.swift
//
// This is a Swift class (updated for Swift 5)
// that uses the iOS RemoteIO Audio Unit
// to record audio input samples,
// (should be instantiated as a singleton object.)
//
// Created by Ronald Nicholson on 10/21/16.
// Copyright © 2017,2019 HotPaw Productions. All rights reserved.
@Treeki
Treeki / TurnipPrices.cpp
Last active April 21, 2025 04:42
AC:NH turnip price calculator
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
// munged from https://github.com/simontime/Resead
namespace sead
{
class Random
{
//
// TurnipCalculator
//
// Translated from https://gist.github.com/Treeki/85be14d297c80c8b3c0a76375743325b#file-turnipprices-cpp
//
// TODO: Calculation is slightly off from C++ impl still
import Foundation
@yasirmturk
yasirmturk / UIStackView+RemoveAll.swift
Created April 15, 2020 07:49
Remove all arranged subviews from UIStackView properly
import UIKit
extension UIStackView {
@discardableResult
func removeAllArrangedSubviews() -> [UIView] {
return arrangedSubviews.reduce([UIView]()) { $0 + [removeArrangedSubViewProperly($1)] }
}
func removeArrangedSubViewProperly(_ view: UIView) -> UIView {
removeArrangedSubview(view)
@SBourgon
SBourgon / UIView+TinyConstraints.swift
Last active March 23, 2021 10:55
TinyConstraint extension for superview layout margins
//
// UIView+TinyConstraints.swift
// CommonSwift
//
// Created by Sebastien on 2020-08-21.
// Copyright © 2020 Powerband Exchange. All rights reserved.
//
import Foundation
import TinyConstraints
@V8tr
V8tr / AutoLayoutDSL.swift
Last active March 23, 2025 19:10
Auto Layout DSL
import UIKit
/// Represents a single `NSLayoutConstraint`
enum LayoutAnchor {
case constant(attribute: NSLayoutConstraint.Attribute,
relation: NSLayoutConstraint.Relation,
constant: CGFloat)
case relative(attribute: NSLayoutConstraint.Attribute,
relation: NSLayoutConstraint.Relation,