- Proposal: SE-NNNN
- Authors: Anthony Latsis, Cal Stephens
- Review Manager: TBD
- Status: Awaiting Review
- Implementation: apple/swift#23156
This file contains 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
GitHub search for “weak self”: https://github.com/search?l=Swift&p=1&q=%22weak+self%22&type=Code | |
Page 1 | |
Result 1 guard else return | |
Result 2 guard else return | |
Result 3 invalid search result | |
Result 4 if let | |
Result 5 if let | |
Result 6 self?. | |
Result 7 self?. | |
Result 8 guard else return |
This file contains 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
import Foundation | |
struct EvolutionProposal: Codable { | |
var id: String | |
var title: String | |
var reviewStartDate: Date | |
var reviewEndDate: Date | |
enum CodingKeys: String, CodingKey { |
This file contains 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
// | |
// DateFormatterHelpers.swift | |
// WindowKit | |
// | |
// Created by Cal Stephens on 1/20/19. | |
// Copyright © 2019 Cal Stephens. All rights reserved. | |
// | |
import Foundation |
This file contains 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
// MARK: Collection + Sort Imprvements | |
extension Collection { | |
// an equivalent set of mutating `sort(by:)` methods would also be made available. | |
func sorted<T: Comparable>(by value: (Element) throws -> T) rethrows -> [Element] { | |
return try self.sorted(by: { lhs, rhs in | |
return (try value(lhs)) < (try value(rhs)) |
This file contains 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
import QuartzCore | |
// MARK: Extensions | |
extension Sequence { | |
func sorted<T: Comparable>(by value: (Element) -> T) -> [Self.Element] { | |
return self.sorted(by: { lhs, rhs in |
This file contains 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
public struct SortDescriptor<Element> { | |
private let keyPath: PartialKeyPath<Element> | |
private let comparator: (Any, Any) -> ComparisonResult | |
// For abitrary `Value` types, the consumer has to provide the entire Comparator | |
public init<Value>( | |
_ keyPath: KeyPath<Element, Value>, | |
using comparator: @escaping (Value, Value) -> ComparisonResult) | |
{ |
This file contains 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
import Foundation | |
// MARK: SortDescriptor | |
/// Type-erased Sort Descriptor (can store multiple in the same array | |
/// regardless of the underlying KeyPath | |
public struct SortDescriptor<Element> { | |
private let comparator: (Any, Any) -> Bool |
This file contains 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
\begin{tikzpicture}[auto, node distance=2cm, every loop/.style={}, | |
thick,main node/.style={circle,draw,font=\sffamily\large\bfseries},graph node/.style={}] | |
\node[main node] (1) {$v_1$}; | |
\node[main node] (2) [below left of=1] {$v_2$}; | |
\node[main node] (3) [below right of=1] {$v_3$}; | |
\node[main node] (4) [below left of=3] {$v_4$}; | |
\node[main node] (5) [below left of=4] {$v_5$}; | |
\node[main node] (6) [below right of=4] {$v_6$}; | |
\node[main node] (7) [below right of=5] {$v_7$}; |
This file contains 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
@IBDesignable | |
class CornerRadiusView : UIView { | |
@IBInspectable var cornerRadius: CGFloat = -1 | |
override func draw(_ rect: CGRect) { | |
self.layer.cornerRadius = cornerRadius | |
} | |
} |
NewerOlder