Skip to content

Commit e774f4e

Browse files
committed
update version:
- now can create form with dic
1 parent e909544 commit e774f4e

30 files changed

+365
-33
lines changed

Application/ViewController.swift

+31-2
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,39 @@ class ViewController: UIViewController, PFormulary {
1414
override func viewDidLoad() {
1515
super.viewDidLoad()
1616

17+
18+
//-- Create form Type with JSON --
19+
20+
// let formulary = Formulary.shared
21+
// formulary.start(self.view, jsonFile: "json_formulary.json")
22+
// formulary.delegate = self
23+
24+
25+
//-- Create form Type with Array Dic --
26+
27+
let dic1:[String: AnyObject] = ["key": "a1" as AnyObject,
28+
"type": "text" as AnyObject,
29+
"label": "validador sin" as AnyObject,
30+
"mandatory": true as AnyObject]
31+
32+
let dic2:[String: AnyObject] = ["key": "a2" as AnyObject,
33+
"type": "text" as AnyObject,
34+
"label": "validador email" as AnyObject,
35+
"validator": "email" as AnyObject,
36+
"mandatory": true as AnyObject]
37+
38+
let dic3:[String: AnyObject] = ["key": "a3" as AnyObject,
39+
"type": "text" as AnyObject,
40+
"label": "validador custom" as AnyObject,
41+
"validator": "customValidator" as AnyObject,
42+
"customValidator": "^([0-9])+$" as AnyObject,
43+
"mandatory": true as AnyObject]
44+
1745
let formulary = Formulary.shared
18-
formulary.start(self.view, jsonFile: "json_formulary.json")
46+
formulary.start(self.view, listItems: [dic1, dic2, dic3])
1947
formulary.delegate = self
20-
48+
49+
2150

2251
//-- Case: Populate data --
2352
//let dic = ["a1":"eduardo"]

Cartfile.resolved

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
git "https://bitbucket.org/gigigo/gigigo-giglibrary-ios" "b77b2579f647ce192619f1335abe09dcd7943539"
1+
git "https://bitbucket.org/gigigo/gigigo-giglibrary-ios" "e1b8e41c57863388fef60283d00012b63ddda78d"
Binary file not shown.

Carthage/Build/iOS/GIGLibrary.framework/Headers/GIGConstants.h

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Carthage/Build/iOS/GIGLibrary.framework/Headers/GIGLibrary-Swift.h

+24-22
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Binary file not shown.
Binary file not shown.

GIGFormulary.xcodeproj/project.pbxproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@
511511
isa = PBXProject;
512512
attributes = {
513513
LastSwiftUpdateCheck = 0730;
514-
LastUpgradeCheck = 0800;
514+
LastUpgradeCheck = 0820;
515515
ORGANIZATIONNAME = gigigo;
516516
TargetAttributes = {
517517
7BB82EF11D4B5DB800DC85F5 = {
@@ -786,7 +786,7 @@
786786
isa = XCBuildConfiguration;
787787
buildSettings = {
788788
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
789-
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
789+
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
790790
DEFINES_MODULE = YES;
791791
DEVELOPMENT_TEAM = SU5BA5HAQK;
792792
DYLIB_COMPATIBILITY_VERSION = 1;

GIGFormulary.xcodeproj/xcshareddata/xcschemes/GIGFormulary.xcscheme

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0800"
3+
LastUpgradeVersion = "0820"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

GIGFormulary/Formulary.swift

+8-2
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,20 @@ open class Formulary: PFormController {
2727
self.formController!.delegate = self
2828
}
2929

30+
open func start(_ viewContainerFormulary: UIView, listItems: [[String: AnyObject]]) {
31+
self.formController = FormController(viewContainerFormulary: viewContainerFormulary)
32+
self.formController!.loadFieldsFromJSONDictionary(listItems)
33+
self.formController!.delegate = self
34+
}
35+
3036
open func start(_ button: UIButton, jsonFile: String) -> UIView {
3137
self.formController = FormController(button: button)
3238
self.formController!.loadFieldsFromJSONFile(jsonFile)
3339
self.formController!.delegate = self
3440

3541
return self.formController!.recoverView()
36-
}
37-
42+
}
43+
3844
open func populateData(_ values: [String:String]) {
3945
self.formController!.populateData(values as [String : AnyObject])
4046
}

GIGFormulary/Resources/Localizable.strings

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99

1010
//-- Generic --
11-
"error_generic_field" = "texto de error del framework";
11+
"error_generic_field" = "El campo no puede ser vacio";
1212

1313
//-- Picker --
14-
"gig_form_accept_button_picker" = "OK";
14+
"gig_form_accept_button_picker" = "OK";

GIGFormulary/Source/Builder/FormBuilderFields.swift

+8
Original file line numberDiff line numberDiff line change
@@ -120,4 +120,12 @@ class FormBuilderFields: NSObject {
120120

121121
return listFormField
122122
}
123+
124+
func fieldsFromDictionary(_ listItems: [[String: AnyObject]]) -> [FormField] {
125+
var listFormField = [FormField]()
126+
for fieldDic in listItems {
127+
listFormField.append(self.createField(fieldDic))
128+
}
129+
return listFormField
130+
}
123131
}

GIGFormulary/Source/FormController.swift

+6
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ class FormController: NSObject, PFormField, PFormBuilderViews {
4242
self.formViews!.updateFormularyContent(self.formFields)
4343
}
4444

45+
func loadFieldsFromJSONDictionary(_ listItems: [[String: AnyObject]]) {
46+
let builder = FormBuilderFields(formController: self)
47+
self.formFields = builder.fieldsFromDictionary(listItems)
48+
self.formViews!.updateFormularyContent(self.formFields)
49+
}
50+
4551
func populateData(_ values: [String:AnyObject]) {
4652
var _ = values.map {key, value -> [String: AnyObject] in
4753
var _ = self.formFields.map { formField -> FormField in

Gemfile

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# frozen_string_literal: true
2+
source "https://rubygems.org"
3+
4+
# gem "rails"
5+
gem "fastlane"
6+
gem "fastlane"
7+
gem "fastlane"

Gemfile.lock

+147
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
GEM
2+
remote: https://rubygems.org/
3+
specs:
4+
CFPropertyList (2.3.4)
5+
activesupport (4.2.7.1)
6+
i18n (~> 0.7)
7+
json (~> 1.7, >= 1.7.7)
8+
minitest (~> 5.1)
9+
thread_safe (~> 0.3, >= 0.3.4)
10+
tzinfo (~> 1.1)
11+
addressable (2.5.0)
12+
public_suffix (~> 2.0, >= 2.0.2)
13+
babosa (1.0.2)
14+
claide (1.0.1)
15+
colored (1.2)
16+
commander (4.4.2)
17+
highline (~> 1.7.2)
18+
domain_name (0.5.20161129)
19+
unf (>= 0.0.5, < 1.0.0)
20+
dotenv (2.1.1)
21+
excon (0.54.0)
22+
faraday (0.10.0)
23+
multipart-post (>= 1.2, < 3)
24+
faraday-cookie_jar (0.0.6)
25+
faraday (>= 0.7.4)
26+
http-cookie (~> 1.0.0)
27+
faraday_middleware (0.10.1)
28+
faraday (>= 0.7.4, < 1.0)
29+
fastimage (2.0.1)
30+
addressable (~> 2)
31+
fastlane (2.2.0)
32+
activesupport (< 5)
33+
addressable (>= 2.3, < 3.0.0)
34+
babosa (>= 1.0.2, < 2.0.0)
35+
bundler (~> 1.12)
36+
colored
37+
commander (>= 4.4.0, < 5.0.0)
38+
dotenv (>= 2.1.1, < 3.0.0)
39+
excon (>= 0.45.0, < 1.0.0)
40+
faraday (~> 0.9)
41+
faraday-cookie_jar (~> 0.0.6)
42+
faraday_middleware (~> 0.9)
43+
fastimage (>= 1.6)
44+
gh_inspector (>= 1.0.1, < 2.0.0)
45+
google-api-client (~> 0.9.1)
46+
highline (>= 1.7.2, < 2.0.0)
47+
json (< 3.0.0)
48+
mini_magick (~> 4.5.1)
49+
multi_json
50+
multi_xml (~> 0.5)
51+
multipart-post (~> 2.0.0)
52+
plist (>= 3.1.0, < 4.0.0)
53+
rubyzip (>= 1.1.0, < 2.0.0)
54+
security (= 0.1.3)
55+
slack-notifier (>= 1.3, < 2.0.0)
56+
terminal-notifier (>= 1.6.2, < 2.0.0)
57+
terminal-table (>= 1.4.5, < 2.0.0)
58+
word_wrap (~> 1.0.0)
59+
xcodeproj (>= 0.20, < 2.0.0)
60+
xcpretty (>= 0.2.4, < 1.0.0)
61+
xcpretty-travis-formatter (>= 0.0.3)
62+
gh_inspector (1.0.2)
63+
google-api-client (0.9.20)
64+
addressable (~> 2.3)
65+
googleauth (~> 0.5)
66+
httpclient (~> 2.7)
67+
hurley (~> 0.1)
68+
memoist (~> 0.11)
69+
mime-types (>= 1.6)
70+
representable (~> 2.3.0)
71+
retriable (~> 2.0)
72+
googleauth (0.5.1)
73+
faraday (~> 0.9)
74+
jwt (~> 1.4)
75+
logging (~> 2.0)
76+
memoist (~> 0.12)
77+
multi_json (~> 1.11)
78+
os (~> 0.9)
79+
signet (~> 0.7)
80+
highline (1.7.8)
81+
http-cookie (1.0.3)
82+
domain_name (~> 0.5)
83+
httpclient (2.8.3)
84+
hurley (0.2)
85+
i18n (0.7.0)
86+
json (1.8.3)
87+
jwt (1.5.6)
88+
little-plugger (1.1.4)
89+
logging (2.1.0)
90+
little-plugger (~> 1.1)
91+
multi_json (~> 1.10)
92+
memoist (0.15.0)
93+
mime-types (3.1)
94+
mime-types-data (~> 3.2015)
95+
mime-types-data (3.2016.0521)
96+
mini_magick (4.5.1)
97+
minitest (5.10.1)
98+
multi_json (1.12.1)
99+
multi_xml (0.6.0)
100+
multipart-post (2.0.0)
101+
nanaimo (0.2.3)
102+
os (0.9.6)
103+
plist (3.2.0)
104+
public_suffix (2.0.4)
105+
representable (2.3.0)
106+
uber (~> 0.0.7)
107+
retriable (2.1.0)
108+
rouge (1.11.1)
109+
rubyzip (1.2.0)
110+
security (0.1.3)
111+
signet (0.7.3)
112+
addressable (~> 2.3)
113+
faraday (~> 0.9)
114+
jwt (~> 1.5)
115+
multi_json (~> 1.10)
116+
slack-notifier (1.5.1)
117+
terminal-notifier (1.7.1)
118+
terminal-table (1.7.3)
119+
unicode-display_width (~> 1.1.1)
120+
thread_safe (0.3.5)
121+
tzinfo (1.2.2)
122+
thread_safe (~> 0.1)
123+
uber (0.0.15)
124+
unf (0.1.4)
125+
unf_ext
126+
unf_ext (0.0.7.2)
127+
unicode-display_width (1.1.2)
128+
word_wrap (1.0.0)
129+
xcodeproj (1.4.2)
130+
CFPropertyList (~> 2.3.3)
131+
activesupport (>= 3)
132+
claide (>= 1.0.1, < 2.0)
133+
colored (~> 1.2)
134+
nanaimo (~> 0.2.3)
135+
xcpretty (0.2.4)
136+
rouge (~> 1.8)
137+
xcpretty-travis-formatter (0.0.4)
138+
xcpretty (~> 0.2, >= 0.0.7)
139+
140+
PLATFORMS
141+
ruby
142+
143+
DEPENDENCIES
144+
fastlane
145+
146+
BUNDLED WITH
147+
1.13.5

0 commit comments

Comments
 (0)