This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension UITableViewCell { | |
@objc func toggleDisclosureIndicator(show: Bool) { | |
guard #available(iOS 13, *) else { | |
self.accessoryType = show ? .disclosureIndicator : .none | |
return | |
} | |
guard show else { | |
accessoryView = nil | |
return |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// UIView+Utils.swift | |
// void | |
// | |
// Created by Eugen Ovchynnykov on 1/8/16. | |
// | |
import UIKit | |
extension UIView { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "ReactiveCocoa", | |
"version": "4.2.2", | |
"summary": "A framework for composing and transforming streams of values.", | |
"description": "ReactiveCocoa (RAC) is an Objective-C framework for Functional Reactive Programming.\nIt provides APIs for composing and transforming streams of values.", | |
"homepage": "https://github.com/ReactiveCocoa/ReactiveCocoa", | |
"license": { | |
"type": "MIT", | |
"file": "LICENSE.md" | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Main idea is to choose two privot elements(lesser pviot and greater pivot) and then divide array in 3 parts: | |
// 1 part - elements < lesser pviot | |
// 2 part - elements > lesser pviot && elements < greater pivot | |
// 3 part - elements > greater pivot | |
// and then recursievly sort these parts | |
extension MutableCollectionType where Self.Generator.Element: Comparable, Self.Index: RandomAccessIndexType { | |
mutating func swap(src src: Self.Index, dest: Self.Index) { | |
let tmp = self[dest] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func swap<T>(inout arr: [T], src: Int, dest: Int) { | |
let tmp = arr[dest] | |
arr[dest] = arr[src] | |
arr[src] = tmp | |
} | |
func quicksort<T: Comparable>(inout arr: [T]) { | |
if arr.count < 2 { | |
return | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func foo<T: Comparable>(val: T) { | |
debugPrint(val) // breakpoint here | |
} | |
foo(42) | |
foo(42.0) | |
foo("42") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// foo(42) | |
movq __TMdSi@GOTPCREL(%rip), %rsi // assigning of direct type metadata for Swift.Int to argument register\ | |
leaq -8(%rbp), %rax // assigning stack adress to $rax | |
movq $42, -8(%rbp) // move 42 to stack | |
movq %rax, %rdi // assigning address of 42 to function arg | |
callq __TF4test4testurFq_T_ // test.test <A> (A) -> () function call to test<T>(val: T) with Int | |
//////////////////////////////////////////////////////////////////////// |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func foo<T>(val: T) { | |
debugPrint(val) // breakpoint here | |
} | |
foo(42) | |
foo(42.0) | |
foo("42") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func foo<T>(val: T) { | |
debugPrint(val) // breakpoint here | |
} | |
foo(42) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// test.swift | |
func foo<T>(val: T) { | |
debugPrint("func foo<T>(val: T)") | |
} | |
func foo(val: Int) { | |
debugPrint("func foo(val: Int)") | |
} |
NewerOlder