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 Combine | |
import SwiftUI | |
extension View { | |
public func focused<T>(file: StaticString = #file, _ state: FocusState<T>, equals value: T) -> some View { | |
modifier(FocusedModifier(state: state, id: value, file: file)) | |
} | |
} | |
@propertyWrapper |
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 SwiftUI | |
extension View { | |
public func discover<T: UIView>( | |
tag: Int = .random(in: (.min)...(.max)), | |
where predicate: @escaping (T) -> Bool = { _ in true }, | |
_ closure: @escaping (T) -> Void | |
) -> some View { | |
self.overlay( | |
DiscoveryView(tag: tag) |
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
// 1. First of all, you need to make sure “Device Orientation” only on ‘Portrait’ mode. | |
//2. Add these two functions to AppDelegate, which helps you deal with embed in nav bar/tab bar situation mentioned above: | |
protocol Rotatable: AnyObject { | |
func resetToPortrait() | |
} | |
extension Rotatable where Self: UIViewController { | |
func resetToPortrait() { |
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
// | |
// ObservableResultTransforms.swift | |
// | |
// Created by Daniel Tartaglia on 5/10/2019. | |
// Copyright © 2019 Daniel Tartaglia. MIT License. | |
// | |
import RxSwift | |
/** |
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
/*--- #3. Hack the Tab Labels ---*/ | |
/* Hide Ugly Tab Labels */ | |
.aAy.aIf-aLe .aKx .aKz, | |
.aAy.aJi-aLe .aKx .aKz, | |
.aAy.aH2-aLe .aKx .aKz, | |
.aAy.aHE-aLe .aKx .aKz{ | |
display: none; | |
} |
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
#!/usr/bin/swift sh | |
import Foundation | |
import PromiseKit // @mxcl ~> 6.5 | |
import Swifter // @mattdonnelly == b27a89 | |
let swifter = Swifter( | |
consumerKey: "FILL", | |
consumerSecret: "ME", | |
oauthToken: "IN", | |
oauthTokenSecret: "https://developer.twitter.com/en/docs/basics/apps/overview.html" |
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
// | |
// ObservableEventTransforms.swift | |
// | |
// Created by Daniel Tartaglia on 9/22/18. | |
// Copyright © 2019 Daniel Tartaglia. MIT License. | |
// | |
import RxSwift | |
/** |
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 | |
// Inspired by https://gist.github.com/mbuchetics/c9bc6c22033014aa0c550d3b4324411a | |
struct JSONCodingKeys: CodingKey { | |
var stringValue: String | |
init?(stringValue: String) { | |
self.stringValue = stringValue | |
} |
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/Foundation.h> | |
@interface CDZTableViewSplitDelegate : NSObject <UIScrollViewDelegate, UITableViewDelegate> | |
@property (nonatomic, weak) id<UITableViewDelegate> tvDelegate; | |
@property (nonatomic, weak) id<UIScrollViewDelegate> svDelegate; | |
- (id)initWithScrollViewDelegate:(id<UIScrollViewDelegate>)scrollViewDelegate tableViewDelegate:(id<UITableViewDelegate>)tableViewDelegate; | |
@end |