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 protocol BPFNotification: AnyObject { | |
static var notificationName: String { get } | |
static var payloadKey: String { get } | |
} | |
public extension BPFNotification { | |
public static var notificationName: String { | |
return NSStringFromClass(Self) | |
} |
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
struct Result: CustomStringConvertible { | |
let size: CGSize | |
let detail: String | |
var description: String { | |
return "\(size) \(detail)" | |
} | |
} | |
let texts: [String] = [ | |
"Lorem ipsum dolor sit amet 😇, https://github.com/badoo/Chatto consectetur adipiscing elit , sed do eiusmod tempor incididunt 07400000000 📞 ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute ir incoming:incoming, #: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
protocol MyProtocol { | |
func doSomething() | |
} | |
extension MyProtocol { | |
func doSomething() { | |
print("default impl") | |
} | |
} |
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
// Covariance works properly with classes: | |
class MyType {} | |
class MySubtype: MyType {} | |
class MyClass { | |
func createMyType() -> MyType { | |
return MyType() | |
} | |
} |
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 UIKit | |
public class BaseCellT<BubbleViewType where BubbleViewType:UIView>: UICollectionViewCell { | |
override init(frame: CGRect) { | |
super.init(frame: frame) | |
self.bubbleView = self.createBubbleView() | |
} |
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 | |
protocol UniqueIdentificableProtocol { | |
var uid: String { get } | |
} | |
protocol UniqueIdentificableSubtypeProtocol: UniqueIdentificableProtocol { | |
var c: String { get } | |
} |
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
protocol AProtocol { | |
var someString: String { get } | |
} | |
class A: AProtocol { | |
var someString: String | |
init() { | |
someString = "A" | |
} | |
} |
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 | |
public protocol Observable : class { | |
typealias ObserverType | |
func addObserver(observer : ObserverType) | |
func removeObserver(observer : ObserverType) | |
} | |
let observersAssociatedKey = "observersKey" |
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
- (void)stringSizeBug { | |
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init]; | |
paragraphStyle.lineSpacing = 2; | |
paragraphStyle.alignment = NSTextAlignmentCenter; | |
NSDictionary *attributes = @{ | |
NSForegroundColorAttributeName : [UIColor whiteColor], | |
NSParagraphStyleAttributeName : paragraphStyle, | |
NSFontAttributeName : [UIFont systemFontOfSize:12] | |
}; |