Skip to content

Instantly share code, notes, and snippets.

Working from home

momo arn00s

Working from home
Block or report user

Report or block arn00s

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
arn00s / rangesOfSubstrings.swift
Last active Dec 19, 2017
Swift String : rangesOf substrings
View rangesOfSubstrings.swift
extension String {
func ranges(of subString: String) -> [NSRange] {
var result: [NSRange] = []
var start = startIndex
while let range = range(of: subString, options: .literal, range: start..<endIndex) {
let startPos = self.distance(from: self.startIndex, to: range.lowerBound)
let endPos = self.distance(from: self.startIndex, to: range.upperBound)
result.append(NSMakeRange(startPos, (endPos - startPos)))
start = range.upperBound
View AHKActionSheet swift sample code
let actionSheet:AHKActionSheet = AHKActionSheet(title:"My title")
actionSheet.buttonHeight = 60
actionSheet.cancelButtonHeight = 80.0
actionSheet.addButtonWithTitle("the title", image: UIImage(named: "icon.png"), type: AHKActionSheetButtonType.Default, handler: { (AHKActionSheet) -> Void in
println("tapped on this button !")
You can’t perform that action at this time.