Skip to content

Instantly share code, notes, and snippets.

View cojoj's full-sized avatar

Mateusz Zając cojoj

View GitHub Profile
@zwaldowski
zwaldowski / CardPresenting.swift
Last active December 7, 2022 09:14
iOS presentation controller for bottom-focused cards using Auto Layout - https://www.icloud.com/iclouddrive/0wJzCDOwwXTRF53bM4xWLbYag#card-magic-ii
import UIKit
private class CardPresenter: UIPresentationController {
private let dimmingView = UIView()
private let roundingView = UIView()
// MARK: -
override init(presentedViewController: UIViewController, presenting presentingViewController: UIViewController?) {
@nicklockwood
nicklockwood / Withable.swift
Created January 28, 2019 12:06
Withable.swift
/// Withable is a simple protocol to make constructing
/// and modifying objects with multiple properties
/// more pleasant (functional, chainable, point-free)
public protocol Withable {
init()
}
public extension Withable {
/// Construct a new instance, setting an arbitrary subset of properties
init(with config: (inout Self) -> Void) {
@IanKeen
IanKeen / KeypathUpdatable.swift
Created February 15, 2018 20:03
A simpler swifty lens pattern
public protocol KeypathUpdatable {
func update<T>(_ keyPath: WritableKeyPath<Self, T>, to value: T) -> Self
}
public extension KeypathUpdatable {
public func update<T>(_ keyPath: WritableKeyPath<Self, T>, to value: T) -> Self {
var copy = self
copy[keyPath: keyPath] = value
return copy
}
@Siemian
Siemian / UIView+Constraints.swift
Last active August 11, 2022 20:52
UIView extension for creating NSLayoutConstraints
//
// UIView+Constraints.swift
// CiLabs
//
// Copyright © 2019 Netguru.co. All rights reserved.
//
import UIKit
typealias Constraint = (_ layoutView: UIView) -> NSLayoutConstraint

Deckset Theme Customization Beta

Download Beta Build (builds expire after 28 days)

Here is an example snippet of the theme configuration commands (place these at the top of your Markdown file):

theme: Work
text: Gill Sans, #F5E5C0, text-scale(0.75), line-height(1.4)
header: Gill Sans UltraBold, text-scale(1.2), line-height(0.9)
@danielmartin
danielmartin / xcode-unofficial-theme-support.md
Last active February 6, 2022 14:00
Xcode unofficial theme support

Xcode unofficial (and undocumented) theme support

Most people is familiar with Xcode theme support for the text editor. You simply open Preferences, Fonts & Colors and duplicate an existing theme (or create a new one from scratch). Xcode editor themes have the .dvtcolortheme extension.

However, there's some support for themeing Xcode itself (fonts, gradients, colors). Xcode loads the default theme from /Applications/Xcode.app/Contents/SharedFrameworks/DVTKit.framework/Versions/A/Resources/Default.dvttheme.

.dvttheme files are simply XML files that conform to an undocumented schema. If you want to modify any of the settings in Default.dvttheme, instead of modifying the bundle resource file you can instruct Xcode to load your custom .dvttheme from wherever you want:

@andreaantonioni
andreaantonioni / ios-cell-registration-swift.md
Last active July 15, 2021 13:41 — forked from gonzalezreal/ios-cell-registration-swift.md
iOS Cell Registration & Reusing with Swift Protocol Extensions and Generics

iOS Cell Registration & Reusing with Swift Protocol Extensions and Generics

A common task when developing iOS apps is to register custom cell subclasses for both UITableView and UICollectionView. Well, that is if you don’t use Storyboards, of course.

Both UITableView and UICollectionView offer a similar API to register custom cell classes:

public func register(_ cellClass: AnyClass?, forCellReuseIdentifier identifier: String)
public func register(_ nib: UINib?, forCellReuseIdentifier identifier: String)
@cojoj
cojoj / list.md
Last active November 19, 2020 08:04
Number of people working on iOS apps

Purpose of this list is to gather a source of information on how many people are working on iOS application.
I often wonder how many people are behind Facebook's app or Twitter's. If you're as curious as me, please share and please add apps 😉.

* - it's a rumoured value only. Needs confirmation from someone inside the company.

  1. Fishbrain - 3
  2. Artsy - 5
  3. Truecaller - 5
  4. Lifesum - 4 or 5
  5. Spotify - 50*
@JohnSundell
JohnSundell / TestingMemoryManagement.swift
Created January 25, 2017 11:15
Sample on how you can easily test your memory management in Swift
class Cache<T> {
private lazy var objects = [String : T]()
func object(forKey key: String) -> T? {
return objects[key]
}
func addObject(_ object: T, forKey key: String) {
objects[key] = object
}
@orta
orta / cloudSettings
Last active November 6, 2020 19:19
Visual Studio code settings
{"lastUpload":"2020-11-06T19:19:35.357Z","extensionVersion":"v3.4.3"}