Skip to content

Instantly share code, notes, and snippets.

public class RootViewController<Content: View>: UIHostingController<Content> {
public init(view: Content, rootViewManager: RootViewManager) {
super.init(rootView: view)
rootViewManager.rootViewController = self
}
@objc required dynamic init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
import SwiftUI
struct ContentView: View {
@ObservedObject var toastManager = ToastManager()
@State var offset: CGFloat = 60
init() {
// This actually throws an error: Escaping closure captures mutating 'self' parameter
toastManager.onShow = { self.onShow() }
Try to simplify the problem. It's hard to think through seven different decisions.
What would happen if there were fewer pirates?
If pirate 1 gets less than 50 gold, then your answer is too low. Think bigger.
Hint #1: You only need three other yes votes to pass the proposal. You don't need everyone to vote yes.
(lldb) po tableView._delegateActual()
error: <EXPR>:3:1: error: value of type 'UITableView' has no member '_delegateActual'
@plivesey
plivesey / ProtocolExtensionQuiz.swift
Last active August 8, 2016 21:55
See how many you can get right before running it... :D
//: Playground - noun: a place where people can play
import UIKit
// PROTOCOL
protocol Foo {
func foo() -> String
func baz() -> String
}
@plivesey
plivesey / DataSpect.swift
Last active January 13, 2016 16:14
Swift LayoutTest Data Spec
class func dataSpecForTest() -> [NSObject: AnyObject] {
return [
"text": LYTStringValues(),
"buttonText": LYTStringValues(),
"buttonEnabled": LYTBoolValues(),
"imageType": LYTDataValues(values: ["linkedin", "customValue", NSNull()])
]
}
- (id)copyWithZone:(NSZone *)zone {
LIProfilePersonModel *copy = [LIProfilePersonModel new];
copy.headline = self.headline;
copy.defaultLocale = self.defaultLocale;
copy.locationValue = self.locationValue;
copy.originalPicture = self.originalPicture;
copy.location = self.location;
...
@implementation NotificationDataModel
@end
@implementation NotificationToastModel
@end