Third party software/code used by the Facebook Messenger app (iOS):
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
// | |
// ContentView.swift | |
// Airdrop Demo | |
// | |
// Created by Daniel Kuntz on 7/30/23. | |
// | |
import SwiftUI | |
struct ContentView: View { |
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
let subject = PassthroughSubject<Int, Never>() | |
let cancellable = subject | |
.scan((nil, nil)) { previous, current in | |
(previous.1, current) | |
} | |
.drop(while: { | |
// Why does the `drop(while:)` never return true here when Optional(1) == Optional(1)? Is this a bug? | |
if $0.0 == $0.1 { | |
return true |
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
import UIKit | |
import SwiftUI | |
final class LoginViewController: UIHostingController<LoginView> { | |
private let viewModel: LoginViewModel | |
init(viewModel: LoginViewModel) { | |
self.viewModel = viewModel | |
super.init(rootView: LoginView(viewModel: viewModel)) | |
} |
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
import SwiftUI | |
import PlaygroundSupport | |
class Presenter: ObservableObject { | |
@Published var viewModel: ViewModel | |
private var timer: Timer! | |
private var memoryAddress: String! | |
init(prefix: String) { |
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
// OBJC | |
@property (nonatomic, copy) MyBlock myBlock; | |
- (void)makeSomethingWithCompletionBlock:(MyBlock)completionBlock | |
{ | |
self.myBlock = completionBlock; | |
} | |
// SWIFT |
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
// Option without self | |
class Foo1 { | |
private let controller: UIViewController = { | |
return UIStoryboard(name: "Main", bundle: nil).instantiateInitialViewController()! | |
}() | |
private lazy var window: UIWindow = { | |
let window = UIWindow(frame: UIScreen.mainScreen().bounds) | |
window.backgroundColor = UIColor.whiteColor() | |
window.makeKeyAndVisible() |
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
/****************/ | |
/* A Swift Tour */ | |
/****************/ | |
// | |
// This file contains all the solutions (I made) to the "A Swift Tour" exercises | |
// found in "The Swift Programming Language", you can find that guide here: | |
// https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/GuidedTour.html#//apple_ref/doc/uid/TP40014097-CH2-ID1 | |
// | |
// All examples are written using Swift 2.0 and Xcode 7 |
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
// HACK, but not critical if it fails. | |
+ (UIPopoverController *)popoverControllerForObject:(id)object { | |
if (!PSIsIpad()) return nil; | |
UIPopoverController *popoverController = object; | |
#ifndef PSPDFKIT_DONT_USE_OBFUSCATED_PRIVATE_API | |
NSString *printInteractionControllerKeyPath = [NSString stringWithFormat:@"%1$@%2$@.%1$@%3$@%4$@%5$@.%6$@%5$@", @"print", @"State", @"Panel", @"View", @"Controller", @"pover"]; | |
@try { | |
if ([object isKindOfClass:UIPopoverController.class]) { |
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
# Load .profile, containing login, non-bash related initializations. | |
source ~/.profile | |
# Load .bashrc, containing non-login related bash initializations. | |
source ~/.bashrc | |
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function* |
NewerOlder