Mix.Tasks.Nativegen.Swift

Handle swift code utilities

Summary

arg(atom, variable, type)
arg_param(params, route, opts)

Return arguments parameter of request method Example: iex> arg_param(["id:integer", "username:string"], “/users/:id/register”, []) “["username": username]“

arg_prop(params, opts \\ [])

Return prop method dictionary of JsonModel Example: iex> arg_prop(["id:integer", "username:string"]) “["id": id, "username": username]“

default_args(params)
extract_param(method_name)

extract parameters from route

extract_params(method_name, params \\ [])

Extract parameters from route Example: iex> extract_params(“/users/:id/register”)

["id"]
generate_params(params)
generate_prop(params)
is_include?(arg, params)
parse_swift(body)

Parse swift repository code to {imports, jsom_models, repo_def, methods, repo_end}

swift_var_type(params)

Parse parameter to variable and Swift’s type

to_swift_method(atom)

Swift HTTP method type

to_swift_type(type, sub_type \\ "")

Parse parameter to Swift’s type

transform_prop(prop)
translate_prop(arg)
while_imports(lines)
while_json_models(lines)
while_methods(lines)
while_repo_def(lines)
wrap_dict(param_str, key)

Functions

arg(atom, variable, type)
arg_param(params, route, opts)

Return arguments parameter of request method Example: iex> arg_param(["id:integer", "username:string"], “/users/:id/register”, []) “["username": username]“

arg_prop(params, opts \\ [])

Return prop method dictionary of JsonModel Example: iex> arg_prop(["id:integer", "username:string"]) “["id": id, "username": username]“

default_args(params)
extract_param(method_name)

extract parameters from route.

Example: iex> extract_param(“/users/:id/show”) %{“param” => “id”}

extract_params(method_name, params \\ [])

Extract parameters from route Example: iex> extract_params(“/users/:id/register”)

["id"]
generate_params(params)
generate_prop(params)
is_include?(arg, params)
parse_swift(body)

Parse swift repository code to {imports, jsom_models, repo_def, methods, repo_end}

swift_var_type(params)

Parse parameter to variable and Swift’s type

to_swift_method(atom)

Swift HTTP method type

to_swift_type(type, sub_type \\ "")

Parse parameter to Swift’s type

transform_prop(prop)
translate_prop(arg)
while_imports(lines)
while_json_models(lines)
while_methods(lines)
while_repo_def(lines)
wrap_dict(param_str, key)