You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+16-16
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,8 @@
1
1
# ImmutableSwift
2
2
3
-
ImmutableSwift is a tool that generates swift model with supports for immutability, coding(Coding and NSCoding), value comparions, hashing and copying. Directly inspired by [facebook/remodel](https://github.com/facebook/remodel).
3
+
ImmutableSwift is a tool that generates swift models with support for immutability, coding(Coding and NSCoding), value comparions, hashing, and copying. Directly inspired by [facebook/remodel](https://github.com/facebook/remodel).
4
4
5
-
TLDR: generate this
5
+
TLDR: generate this...
6
6
```
7
7
import Foundation
8
8
@@ -30,7 +30,7 @@ class Friend : Hashable, Codable, NSCopying{
30
30
}
31
31
}
32
32
```
33
-
from this
33
+
...from this
34
34
```
35
35
Friend {
36
36
String name
@@ -49,27 +49,27 @@ $ swift build -c release
49
49
```
50
50
51
51
## Usage
52
-
To generate a model, you must first create a `.value` file that contains the modle schema. Here is an example:
52
+
To generate a model, you must first create a `.value` file that contains the model schema. Here is an example:
53
53
```
54
54
Friend {
55
55
String name
56
56
Int daySinceFirstMet
57
57
}
58
58
```
59
59
60
-
Once you created the schema file, you can generate the desired swift model with
60
+
Once you create the schema file, you can generate the desired swift model with
To generate models for every .value files in a directory, subtitute the file path with a directory path
65
+
To generate models for each .value file in a directory, substitute the file path with a directory path
66
66
```
67
67
# this will also generate every .value files in any sub-directories recursively
68
68
./ImmutableSwift Path/To/ModelDirectory/
69
69
```
70
70
71
71
## Import
72
-
ImmutableSwift assumes that every types that a model depends on reside in the same module. If a model depends on another module, simply add the required module on top of the schema. For example:
72
+
ImmutableSwift assumes that all types that a model depends on reside in the same module. If a model depends on another module, simply import the required module on top of the schema. For example:
73
73
```
74
74
import PhoneNumber
75
75
Friend {
@@ -78,7 +78,7 @@ Friend {
78
78
PhoneNumber number
79
79
}
80
80
```
81
-
The syntax for import are the same as swift's import syntax. You can import a module with `import module`, import a submodule with `improt module.submodule` or import a specific kind of symbol with `import kind module.symbole`
81
+
The syntax for import is the same as Swift's import syntax. You can import a module with `import module`, import a submodule with `import module.submodule` or import a specific kind of symbol with `import kind module.symbol`
82
82
83
83
## Comments
84
84
ImmutableSwift supports adding comments to the generated models.
@@ -95,7 +95,7 @@ Friend {
95
95
```
96
96
97
97
## AccessControl
98
-
ImmutableSwift supports defining optional access levels for the generated model. At the moment, it only supports `public` and `internal`. This is mainly to help generate models in a module that are meant to be imported. For example:
98
+
ImmutableSwift supports defining optional access levels for the generated models. At the moment, it only supports `public` and `internal`. This is mainly to help generate models in a module that are meant to be imported. For example:
99
99
```
100
100
public Friend {
101
101
String name
@@ -104,9 +104,9 @@ public Friend {
104
104
```
105
105
106
106
## NSCoding
107
-
In some projects, immutable data model might need to support NSCoding. To have ImmutableSwift generates associated methods that support NSCoding, include the plugin `ISCoding` in the model's schema.
107
+
In some projects, immutable data models might need to support NSCoding. To have ImmutableSwift generate associated methods that support NSCoding, include the plugin `ISCoding` in the model's schema.
108
108
```
109
-
# here, ISCoding plugin is responsible for generating the encode and init method required by NSCoding protocol
109
+
# ISCoding plugin is responsible for generating the encode and init method required by NSCoding protocol
110
110
# ISCopying plugin is responsible for generating the copy method required by the NSCopying protocol
111
111
public Friend (ISCoding, ISCopying){
112
112
String name
@@ -115,21 +115,21 @@ public Friend (ISCoding, ISCopying){
115
115
```
116
116
117
117
## Plugins
118
-
Similar to [facebook/remodel](https://github.com/facebook/remodel), ImmutableSwift uses a simple plugin system. The plugin system are designed to encapsulate cohesive generation logics, and extend the functionality of the code generator. You can find a list of plugins here: https://github.com/hackthehackerman/ImmutableSwift/tree/master/Sources/ImmutableSwift/generating/plugins.
118
+
Similar to [facebook/remodel](https://github.com/facebook/remodel), ImmutableSwift uses a simple plugin system. The plugin system is designed to encapsulate cohesive generation logic, and extend the functionality of the code generator. You can find a list of plugins here: https://github.com/hackthehackerman/ImmutableSwift/tree/master/Sources/ImmutableSwift/generating/plugins.
119
119
120
-
To specify plugins for a specific model, add the list after the model name. Noted that, if you don't specific a list of plugins to used, ImmutableSwift will use a default list of plugins: [ISCodable, ISHashable, ISCopying].
120
+
To specify plugins for a specific model, add the list after the model name. Note that, if you don't specify a list of plugins to be used, ImmutableSwift will use a default list of plugins: [ISCodable, ISHashable, ISCopying].
121
121
```
122
-
# ISCodable is responsible for generating codes for the Codable protocol
122
+
# ISCodable is responsible for generating code for the Codable protocol
123
123
# ISHashable is responsible for generating the == and hash function for the Hashable protocol
124
-
# ISCopying plugin is responsible for generating the copy method required by the NSCopying protocol
124
+
# ISCopying is responsible for generating the copy method required by the NSCopying protocol
0 commit comments