@@ -83,9 +83,12 @@ public class ModelGenerator {
83
83
// Notify user that the files are generated!
84
84
let notification : NSUserNotification = NSUserNotification ( )
85
85
notification. title = " SwiftyJSONAccelerator "
86
- notification. subtitle = " Completed - \( name) .swift "
86
+ if name. characters. count > 0 {
87
+ notification. subtitle = " Completed - \( name) .swift "
88
+ } else {
89
+ notification. subtitle = " No files were generated, cannot model arrays inside arrays. "
90
+ }
87
91
NSUserNotificationCenter . defaultUserNotificationCenter ( ) . deliverNotification ( notification)
88
-
89
92
}
90
93
91
94
//MARK: Internal methods
@@ -176,7 +179,6 @@ public class ModelGenerator {
176
179
177
180
}
178
181
179
-
180
182
// Get an instance of the template.
181
183
var content : String = templateContent ( )
182
184
@@ -201,6 +203,16 @@ public class ModelGenerator {
201
203
// Write everything to the file at the path.
202
204
writeToFile ( className, content: content, path: filePath)
203
205
206
+ } else if let object = parsedJSONObject. array {
207
+ // Incase the first object was NOT a dictionary.
208
+ // TODO: Instead of taking a single element consider merging all the elements and decide what to do as a while.
209
+ let subClassType = checkType ( object [ 0 ] )
210
+
211
+ // If the type is an object then make it the base class and generate stuff.
212
+ if subClassType == VariableType . kObjectType {
213
+ self . generateModelForClass ( object [ 0 ] , className: className, isSubModule: false )
214
+ }
215
+ return " "
204
216
}
205
217
206
218
return className
0 commit comments