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 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 | |
} |
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
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 !") | |
}) |