collapsible markdown?
CLICK ME
yes, even hidden code blocks!
print("hello world!")
// | |
// UIAccessorizedTextField.swift | |
// AccessorizedTextField | |
// | |
// Created by Damien Laughton on 28/03/2018. | |
// 2018 Mobilology Limited. No rights reserved. | |
// | |
import Foundation | |
import UIKit |
print("hello world!")
import UIKit | |
extension UITableView { | |
func dequeueReusableCell<T: UITableViewCell>() -> T { | |
return dequeueReusableCell(withIdentifier: NSStringFromClass(T.self)) as! T | |
} | |
} | |
//using: let cell: ExampleTableViewCell = tableView.dequeueReusableCell() |
// The trick is to link the DeviceSupport folder from the beta to the stable version. | |
// sudo needed if you run the Mac App Store version. Always download the dmg instead... you'll thank me later :) | |
// Support iOS 14 devices (Xcode 12.0) with Xcode 11.5: | |
sudo ln -s /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/14.0 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport | |
// Then restart Xcode and reconnect your devices. You will need to do that for every beta of future iOS versions |
[alias] | |
st = status | |
ci = commit | |
br = branch | |
co = checkout | |
df = diff | |
lg = log -p | |
branches = for-each-ref --sort='-authordate:iso8601' --format=' %(authordate:relative)%09%(refname:short)' refs/heads | |
[push] |
/// Show an OK/Cancel modal box that works in both iOS 7 and iOS 8 | |
func ask(title: String, #message: String, #completion: (answer: Bool) -> Void) { | |
if nil != objc_getClass("UIAlertController".UTF8String) { // use UIAlertController | |
let alertController = UIAlertController(title: title, message: message, preferredStyle: .Alert) | |
let cancelAction = UIAlertAction(title: "Cancel", style: .Cancel, handler: { (action) -> Void in | |
completion(answer: false) | |
}) | |
let okayAction = UIAlertAction(title: "OK", style: .Default, handler: { (action) -> Void in | |
completion(answer: true) | |
}) |
Although the file name for the image is set automatically by iOS to IMG_nnnn, we can use metadata to set the title that will be shown in Photos app.
For more details see http://ootips.org/yonat/how-to-set-the-image-name-when-saving-to-the-camera-roll/
// | |
// Badge.swift | |
// Extensions for Rounded UILabel and UIButton, Badged UIBarButtonItem. | |
// | |
// Usage: | |
// let label = UILabel(badgeText: "Rounded Label"); | |
// let button = UIButton(type: .System); button.rounded = true | |
// let barButton = UIBarButtonItem(badge: "42", title: "How Many Roads", target: self, action: "answer") | |
// | |
// Created by Yonat Sharon on 06.04.2015. |
#!/bin/bash | |
# Xcode: Set version and build number from Git | |
# -------------------------------------------- | |
# | |
# This script sets the version number `CFBundleShortVersionString` to one of | |
# | |
# - `1.2.3` -- for the tagged commit `v1.2.3` or a hyphen-separated prerelease, | |
# e.g. `v1.2.3-alpha`, `v1.2.3-alpha.2`, `v1.2.3-beta`, `v1.2.3-rc`. | |
# - `1.2.3-7-gabc1234` -- at commit `abc1234`, 7 commits after `v1.2.3`, | |
# - `1.2.3-7-gabc1234-dirty` -- when there are uncommitted changes, or |
import Foundation | |
public protocol GSRegularExpressionMatchable { | |
func match(regex: GSRegex) -> Bool | |
func match(regex: NSRegularExpression) -> Bool | |
} | |
public class GSRegex: StringLiteralConvertible { | |
let regex: NSRegularExpression? | |