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
extension UIControl { | |
struct EventPublisher: Publisher { | |
typealias Output = Void | |
typealias Failure = Never | |
fileprivate var control: UIControl | |
fileprivate var event: Event | |
func receive<S: Subscriber>(subscriber: S) where S.Input == Output, S.Failure == Failure { | |
let subscription = EventSubscription<S>() |
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
func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) { | |
print("\(#function): \(message)") | |
} | |
func setupSubViews() { | |
let configurations = WKWebViewConfiguration() | |
let controller = WKUserContentController() | |
let myEventScriptString = | |
""" | |
var elements = document.getElementsByClassName('button'); |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<link rel="stylesheet" type="text/css" href="button.css"> | |
<style> | |
.centered { | |
padding: 15px; | |
text-align: center; | |
} | |
</style> |
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
// Navigation BACK Button - custom | |
- (void)viewDidLoad { | |
[super viewDidLoad]; | |
UIBarButtonItem *backButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Backk" style:(UIBarButtonItemStylePlain) target:self action:@selector(back:)]; | |
self.navigationItem.backBarButtonItem = backButtonItem; | |
self.navigationItem.hidesBackButton = NO; | |
} | |
- (void)back:(id)button { |
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
CALayer *layer = self.downloadContainerView.layer; | |
layer.shadowOffset = CGSizeMake(2, 2); | |
layer.shadowColor = [UIColor blackColor].CGColor; | |
layer.shadowRadius = 4.0f; | |
layer.shadowPath = [[UIBezierPath bezierPathWithRect:layer.bounds] CGPath]; | |
CABasicAnimation *color = [CABasicAnimation animationWithKeyPath:@"borderColor"]; | |
color.fromValue = (id)[UIColor redColor].CGColor; | |
color.toValue = (id)[UIColor lightGrayColor].CGColor; |
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
// $$$ Not self tested yet but accepted answer at http://stackoverflow.com/questions/25306299/how-to-make-autosizeheight-uitableviewcell | |
// For iOS 6 and 7. After iOS 8, it's claimed to be automatic. | |
@property (nonatomic, strong) CustomCell *layoutTableViewCell; | |
UINib *cellNib = [UINib nibWithNibName:CustomCellNibName bundle:nil]; | |
self.layoutTableViewCell = [[cellNib instantiateWithOwner:nil options:nil] objectAtIndex:0]; | |