A tool that looks to convert structs to class entities in swift
Project description
Creache
A poorly named tool
Purpose
The goal of this tool is to convert Swift
struct
types into class
types that can be used with Realm Swift
.
Convert files formatted like this:
struct User {
var name: String!
var age: Int
var isHappy: Bool
enum CodingKeys: String, CodingKey {
case name, age
case isHappy = "is_happy"
}
init(from decoder: Decoder) throws {
let container = try container.decode(keyedBy: CodingKeys.self)
name = try container.decode(String.self, forKey: .name)
age = try container.decode(Int.self, forKey: .age)
isHappy = try container.decode(Bool.self, forKey: .isHappy)
}
}
to this
class User_Entity {
@dynamic var name: String! = ''
@dynamic var age: Int! = 0
@dynamic var isHappy: Bool! = false
}
Features
- Automatically rename
struct
toclass
and append `Entity to the new type - Automatically generate a new entity file in the directy in which this script is called
- Automatically strip everything away thaat isn't a variable declaration
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Close
Hashes for creache-1.4000000000000003.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 660c97e52bfcbb6c629c06f3764470b9a025257d3765b36f516747142ec72b12 |
|
MD5 | 24eea942d57a9caad31d3595841d239e |
|
BLAKE2b-256 | 36f831ca6c1f9f13cb3e35e08a65997de1a0327718684529cbd264a70d93c661 |