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 UIKit | |
class ViewController: UIViewController { | |
@IBOutlet weak var bottomConstraint: NSLayoutConstraint! | |
let desirableBottomPadding: CGFloat = 16.0 | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
NotificationCenter.default.addObserver(self, selector: #selector(onKeyboardWillShow(_:)), name: NSNotification.Name.UIKeyboardWillShow, object: nil) |
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 android.os.Parcel; | |
import android.os.Parcelable; | |
import java.io.Serializable; | |
public class EasyParcelable implements Parcelable, Serializable { | |
protected EasyParcelable() { | |
} |
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 | |
class PreferencesStorage { | |
private static let keyStartBusStopId = "StartBusStopId" | |
var startBusStopId: Int64? | |
private static let keyEndBusStopId = "EndBusStopId" | |
var endBusStopId: Int64? | |
private init() {} |
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
extension String { | |
func index(from: Int) -> Index { | |
return self.index(startIndex, offsetBy: from) | |
} | |
func substring(from: Int) -> String { | |
let fromIndex = index(from: from) | |
return substring(from: fromIndex) | |
} | |
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
extension String { | |
var decodingJavaUnicode: String { | |
let jsonString = NSMutableString(string: self) | |
CFStringTransform(jsonString, nil, "Any-Hex/Java" as NSString, true ) | |
return jsonString as 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
import UIKit | |
@IBDesignable class CustomSwitch: UIButton { | |
var onValueChanged: ((Bool) -> Void)? | |
@IBInspectable var isOn: Bool = false { | |
didSet { | |
isSelected = isOn | |
onValueChanged?(isOn) | |
} |
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 variable: String? = nil | |
func doIt() { | |
variable = "123" | |
let variable = "345" | |
} | |
} |
OlderNewer