Skip to content

Instantly share code, notes, and snippets.

@seifeet
seifeet / isnumeric.playground
Created February 9, 2018 17:45
regex vs double for isNumeric
//: Playground - noun: a place where people can play
import UIKit
var timeDiff: Double = 0
public extension String {
public var isNumericRegex: Bool {
return range(of: "(^-?[\\d]+$)|(-?[\\d]+[.,]{1}[\\d]+$)",
options: String.CompareOptions.regularExpression, range: nil, locale: nil) != nil
@seifeet
seifeet / flatten.swift
Last active May 23, 2018 02:43
ReactiveSwift: flatten and some of its strategies
/*:
> # IMPORTANT: To use `ReactiveSwift.playground`, please:
1. Retrieve the project dependencies using one of the following terminal commands from the ReactiveSwift project root directory:
- `git submodule update --init`
**OR**, if you have [Carthage](https://github.com/Carthage/Carthage) installed
- `carthage checkout --no-use-binaries`
1. Open `ReactiveSwift.xcworkspace`
1. Build `Result-Mac` scheme
1. Build `ReactiveSwift-macOS` scheme