RandMyMod alternatives and similar libraries
Based on the "Data Structures / Algorithms" category.
Alternatively, view RandMyMod alternatives based on common mentions on social networks and blogs.
-
Dollar
A functional tool-belt for Swift Language similar to Lo-Dash or Underscore.js in Javascript -
SwiftStructures
Examples of commonly used data structures and algorithms in Swift. -
Result
Swift type modelling the success/failure of arbitrary operations. -
DeepDiff
🦀Amazingly incredible extraordinary lightning fast diffing in Swift -
Algorithm
Algorithm is a library of tools that is used to create intelligent applications. -
Differ
Swift library to generate differences and patches between collections. -
KeyPathKit
KeyPathKit is a library that provides the standard functions to manipulate data along with a call-syntax that relies on typed keypaths to make the call sites as short and clean as possible. -
SwiftPriorityQueue
A Generic Priority Queue in Pure Swift -
Buffer
Swift μ-framework for efficient array diffs and datasource adapters. -
BinaryKit
💾🔍🧮 BinaryKit helps you to break down binary data into bits and bytes, easily access specific parts and write data to binary. -
Differific
:fuelpump: Differific - a fast and convenient diffing framework. -
Brick
:droplet: A generic view model for both basic and complex scenarios -
AnyObjectConvertible
Convert your own struct/enum to AnyObject easily. -
HAMT (for Swift)
An implementation of HAMT data-structure in Swift -
OneWaySynchronizer
The simplest abstraction to synchronize local data with remote source. For iOS, wirtten in swift.
InfluxDB - Power Real-Time Data Analytics at Scale
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of RandMyMod or a related project?
README
RandMyMod is an IOS Native Framework helps you generate one or a set of variable base on your own model.
No matter your model is Class / Struct.
Installation
- Cocoapods
pod 'RandMyMod'
Basic Usage
- ### Model must conform Codable
import RandMyMod
Create a Random Model
let instance = MyStruct() RandMyMod<MyStruct>().randMe(baseOn: instance) { (newInstance) in guard let newinstance = newInstance else { print("error"); return } }
Create a set of Random Model
let instance = MyStruct() RandMyMod<MyStruct>().randUs(baseOn: instance) { (newInstanceArr) in for newInstance in newInstanceArr { guard let newinstance = newInstance else { print("error"); return } } }
RandMyModDelegate
public protocol RandMyModDelegate { func countForArray(for key: String) -> Int func shouldIgnore(for key: String, in Container: String) -> Bool func catchError(with errorStr: String) func specificRandType(for key: String, in Container: String, with seed: RandType) -> (()->Any)? }
Swift fake data generator
vadymmarkov/Fakery : https://github.com/vadymmarkov/Fakery
Notice
if the variable in class / stuct is Declared with 『 let 』 , rand mod will not change this variable's value.
struct MyStruct { let nochange: Int = 0 } let mystruct = MyStruct() RandMyMod<MyStruct>().randMe(baseOn: mystruct) { (newstruct) in newstruct.nochange // 0 }
if the variable in class / stuct is Declared with 『 Optional 』 and have no initial Value , rand mod will ignore this variable's value and keep it nil. (Mirror may resolve this issue, may fix in the future)
struct MyStruct { var opt: Int? = 0 var opt2: Int? } let mystruct = MyStruct() RandMyMod<MyStruct>().randMe(baseOn: mystruct) { (newstruct) in mystruct.opt // 4242 mystruct.opt2 // nil }
Example
1. Stuct / Class with native variable type and no special specific:
class Man: Codable {
var name: String = ""
var address: String = ""
var website: [String] = []
}
let man = Man()
RandMyMod<Man>().randMe(baseOn: man) { (newMan) in
guard let new = newMan else { return }
print(new.address) //mnxvpkalug
print(new.name) //iivjohpggb
print(new.website) //["pbmsualvei", "vlqhlwpajf", "npgtxdmfyt"]
}
2. Stuct / Class with native variable type and specific Rand Type:
struct Man: Codable {
var name: String = ""
var age: Int = 40
var website: [String] = []
}
extension Man: RandMyModDelegate {
func countForArray(for key: String) -> Int {
switch key {
case "website":
return 3
default:
return 0
}
}
func specificRandType(for key: String, in Container: String, with seed: RandType) -> (() -> Any)? {
switch key {
case "name":
return { return seed.name.name() }
case "age":
return { return seed.number.randomInt(min: 1, max: 60)}
case "website":
return { return seed.internet.url() }
default:
return nil
}
}
}
let man = Man()
RandMyMod<Man>().randMe(baseOn: man) { (newMan) in
guard let new = newMan else { print("no"); return }
print(new.age) //32
print(new.name) //Lavada Krajcik
print(new.website) //["https://littleohara.name/johathangleason6379", "https://kautzerwunsch.biz/karleejones8880", "https://purdy.net/olivercorkery"]
}
3. Stuct / Class with own defined variable type and specific Rand Type:
struct Man: Codable {
var name: String = ""
var age: Int = 40
var website: [String] = []
var child: Child = Child()
}
struct Child: Codable {
var name: String = "Baby" //Baby has no name yet.
var age: Int = 2
var toy: Toys = Toys()
}
class Toys: Codable {
var weight: Double = 0.0
}
extension Man: RandMyModDelegate {
func shouldIgnore(for key: String, in Container: String) -> Bool {
switch (key, Container) {
case ("name","child"):
return true
default:
return false
}
}
func specificRandType(for key: String, in Container: String, with seed: RandType) -> (() -> Any)? {
switch (key, Container) {
case ("age","child"):
return { return seed.number.randomInt(min: 1, max: 6)}
case ("weight",_):
return { return seed.number.randomFloat() }
default:
return nil
}
}
}
let man = Man()
RandMyMod<Man>().randMe(baseOn: man) { (newMan) in
guard let child = newMan?.child else { print("no"); return }
print(child.name) //Baby
print(child.age) //3
print(child.toy.weight) //392.807067871094
}
Distribution
Feel free to fork / pull request / open an issue.