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
enum MyEnum { | |
case StateA | |
case StateB | |
} | |
let enumValueA = MyEnum.StateA | |
let enumValueB = MyEnum.StateB | |
if enumValueA == enumValueB { |
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
class MyClass { | |
var myNumber: Int { | |
willSet { | |
println("Will set to \(newValue) in the super class") | |
} | |
} | |
var myString: String | |
init(myNumber: Int, myString: String) { |
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
// | |
// Result.swift | |
// DocumentOrganiser | |
// | |
// Created by Jonathan Wight on 6/8/14. | |
// Copyright (c) 2014 schwa. All rights reserved. | |
// | |
import Foundation |
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
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text { | |
// Horrible HACK for bug in UITextView where it won't scroll to the new line after pressing enter in the text view. | |
// I feel dirty for having to write this. Buggy at least within iOS 7.0 - 7.1b1. | |
if (PSPDFIsUIKitFlatMode() && [text isEqualToString:@"\n"] && range.location == textView.text.length) { | |
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)); | |
dispatch_after(popTime, dispatch_get_main_queue(), ^{ | |
CGPoint contentOffset = textView.contentOffset; | |
CGFloat fontSize = textView.font.pointSize; | |
if (textView.contentSize.height - fontSize > textView.bounds.size.height) { | |
contentOffset.y += fontSize + 2.f; // add spacing |