Skip to content

Instantly share code, notes, and snippets.

View aetsyss's full-sized avatar

Alex aetsyss

  • EPAM
  • SPb, Russia
View GitHub Profile
@mattt
mattt / uiappearance-selector.md
Last active June 4, 2024 13:28
A list of methods and properties conforming to `UIAppearance` as of iOS 12 Beta 3

Generate the list yourself:

$ cd /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS*.sdk/System/Library/Frameworks/UIKit.framework/Headers
$ grep UI_APPEARANCE_SELECTOR ./*     | \
  sed 's/NS_AVAILABLE_IOS(.*)//g'     | \
  sed 's/NS_DEPRECATED_IOS(.*)//g'    | \
  sed 's/API_AVAILABLE(.*)//g'        | \
  sed 's/API_UNAVAILABLE(.*)//g'      | \
 sed 's/UI_APPEARANCE_SELECTOR//g' | \
@onevcat
onevcat / nstimer_break_retain.swift
Created September 28, 2015 03:34
NSTimer extension which breaks the retain cycle in Swift.
private class Block<T> {
let f : T
init (_ f: T) { self.f = f }
}
extension NSTimer {
static func xxx_scheduledTimerWithTimeInterval(ti: NSTimeInterval, block: ()->(), repeats: Bool) -> NSTimer {
return self.scheduledTimerWithTimeInterval(ti, target:
self, selector: "xxx_blcokInvoke:", userInfo: Block(block), repeats: repeats)
}
@alanzeino
alanzeino / LinkedList.swift
Created October 7, 2016 18:42
A simple LinkedList in Swift 3 using Sequence and IteratorProtocol
//: Playground - noun: a place where people can play
import Foundation
class Node {
let value: Any
var next: Node?
init(value: Any, next: Node?) {
@Athosone
Athosone / UICollectionView+DynamicCellSize.swift
Created April 4, 2017 10:28
Calculate size of uicollectionview
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
guard let dummyCell: OABSubCategoryMenuCell = Bundle.main.loadNibNamed("OABSubCategoryMenuCell", owner: self, options: nil)?.first as? OABSubCategoryMenuCell else {
return CGSize.zero
}
dummyCell.setContent(subCat: self.subCategories[indexPath.row], isSelected: false)
dummyCell.setNeedsLayout()
dummyCell.layoutIfNeeded()
let size: CGSize = dummyCell.contentView.systemLayoutSizeFitting(UILayoutFittingCompressedSize)
return size
}
@DejanEnspyra
DejanEnspyra / Obfuscator.swift
Created May 31, 2017 17:51
Obfuscation of hard-coded security-sensitive strings.
//
// Obfuscator.swift
//
// Created by Dejan Atanasov on 2017-05-31.
//
import Foundation
class Obfuscator: AnyObject {