-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…nticationSession is commented out before it breaks testing until I can figure out how to conditionally import it only on the proper OSs
- Loading branch information
Edward Hinkle
committed
Jun 11, 2019
1 parent
ba88760
commit 3c0f424
Showing
3 changed files
with
231 additions
and
37 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// | ||
// File.swift | ||
// | ||
// | ||
// Created by ehinkle-ad on 6/11/19. | ||
// | ||
|
||
import Foundation | ||
extension String { | ||
public static func randomString(length: Int) -> String { | ||
let letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~" | ||
return randomString(length: length, from: letters) | ||
} | ||
|
||
public static func randomAlphaNumericString(length: Int) -> String { | ||
let letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" | ||
return randomString(length: length, from: letters) | ||
} | ||
|
||
public static func randomString(length: Int, from stringOptions: String) -> String { | ||
let letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~" | ||
return String((0..<length).map{ _ in letters.randomElement()! }) | ||
} | ||
} |
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