Permalink
Browse files

Updated readme and license file. Also added example project.

  • Loading branch information...
wess committed Oct 16, 2012
1 parent b5744bb commit 91f1b51c3cd67ee406aacb6784ca2155d126a9d1
View
19 LICENSE
@@ -0,0 +1,19 @@
+Copyright (c) 2012 Wess Cope
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
View
@@ -1,4 +1,89 @@
-If you stumbled upon this, don't use it. At the moment is very VERY under development.
+# Survey
-Thanks,
-Wess
+> Survey is a library to simplify the process of creating and validating forms. This library is loosely based on CoreData and Django forms.
+
+## To-do: (Just starting development, much more to come)
+* More Validators
+* Generate forms from ManagedObject models
+* Block based form actions.
+
+## Setting up
+> To set up, place the Survey project file into your project, link to the libSurvey.a framework and add it as a target dependency, then just #import <Survey/Survey.h> and go to town!
+
+## Example Form Model:
+> Setting up a form is pretty simple, you just subclass SurveyFormModel and set up properties for the fields you want. Then, in the implementation, set up each field with the properties you want.
+
+```objectivec
+
+// RegisterForm.h
+@interface RegisterForm : SurveyFormModel
+@property (strong, nonatomic) SurveyField *firstname;
+@property (strong, nonatomic) SurveyField *lastname;
+@property (strong, nonatomic) SurveyField *email;
+@property (strong, nonatomic) SurveyField *password;
+@end
+
+// RegisterForm.m
+@implementation RegisterForm
+-(SurveyField *)firstname
+{
+ SurveyField *field = [SurveyField fieldWithPlaceholder:@"First Name"];
+ field.isRequired = NO;
+ field.label = @"First Name";
+
+ return field;
+}
+
+-(SurveyField *)lastname
+{
+ SurveyField *field = [SurveyField fieldWithPlaceholder:@"Last Name"];
+ field.isRequired = YES;
+ field.label = @"Last Name";
+
+ return field;
+}
+
+-(SurveyField *)email
+{
+ SurveyField *field = [SurveyField fieldWithPlaceholder:@"Email"];
+ field.isRequired = YES;
+
+ return field;
+}
+
+-(SurveyField *)password
+{
+ SurveyField *field = [SurveyField fieldWithPlaceholder:@"Password"];
+ field.isRequired = YES;
+ field.isSecure = YES;
+
+ return field;
+}
+
+
+```
+
+## Using the form
+> Using the form is also pretty simple, you just init the form and then when you want to use it, you just check that it's valid then grab the values you need.
+
+```objectivec
+
+RegisterForm *registerForm = [[RegisterForm alloc] init];
+if(registerForm.isValid)
+{
+ NSString *firstname = [registerForm.form valueForField:@"firstname"];
+ NSString *lastname = [registerForm.form valueForField:@"lastname"];
+ NSString *email = [registerForm.form valueForField:@"email"];
+ NSString *password = [registerForm.form valueForField:@"password"];
+
+ // Now do something with your new values.
+}
+
+```
+
+## If you need me
+* [Github](http://www.github.com/wess)
+* [@WessCope](http://www.twitter.com/wess)
+
+## License
+Read LICENSE file for more info.
@@ -23,6 +23,16 @@
082D3993162C97A100973067 /* SurveyFieldCell.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 082D398D162C8F3E00973067 /* SurveyFieldCell.h */; };
/* End PBXBuildFile section */
+/* Begin PBXContainerItemProxy section */
+ 08C867FC162CE99300B98C14 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 08C867F8162CE99200B98C14 /* SurveyExample.xcodeproj */;
+ proxyType = 2;
+ remoteGlobalIDString = 08C867D7162CE99200B98C14;
+ remoteInfo = SurveyExample;
+ };
+/* End PBXContainerItemProxy section */
+
/* Begin PBXCopyFilesBuildPhase section */
082D392E162C825A00973067 /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
@@ -59,6 +69,7 @@
082D3954162C835300973067 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
082D398D162C8F3E00973067 /* SurveyFieldCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SurveyFieldCell.h; sourceTree = "<group>"; };
082D398E162C8F3E00973067 /* SurveyFieldCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SurveyFieldCell.m; sourceTree = "<group>"; };
+ 08C867F8162CE99200B98C14 /* SurveyExample.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SurveyExample.xcodeproj; path = SurveyExample/SurveyExample.xcodeproj; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -77,6 +88,7 @@
082D3925162C825A00973067 = {
isa = PBXGroup;
children = (
+ 08C867F8162CE99200B98C14 /* SurveyExample.xcodeproj */,
082D3935162C825A00973067 /* Survey */,
082D3932162C825A00973067 /* Frameworks */,
082D3931162C825A00973067 /* Products */,
@@ -192,6 +204,14 @@
name = Cell;
sourceTree = "<group>";
};
+ 08C867F9162CE99200B98C14 /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 08C867FD162CE99300B98C14 /* SurveyExample.app */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@@ -231,13 +251,29 @@
mainGroup = 082D3925162C825A00973067;
productRefGroup = 082D3931162C825A00973067 /* Products */;
projectDirPath = "";
+ projectReferences = (
+ {
+ ProductGroup = 08C867F9162CE99200B98C14 /* Products */;
+ ProjectRef = 08C867F8162CE99200B98C14 /* SurveyExample.xcodeproj */;
+ },
+ );
projectRoot = "";
targets = (
082D392F162C825A00973067 /* Survey */,
);
};
/* End PBXProject section */
+/* Begin PBXReferenceProxy section */
+ 08C867FD162CE99300B98C14 /* SurveyExample.app */ = {
+ isa = PBXReferenceProxy;
+ fileType = wrapper.application;
+ path = SurveyExample.app;
+ remoteRef = 08C867FC162CE99300B98C14 /* PBXContainerItemProxy */;
+ sourceTree = BUILT_PRODUCTS_DIR;
+ };
+/* End PBXReferenceProxy section */
+
/* Begin PBXSourcesBuildPhase section */
082D392C162C825A00973067 /* Sources */ = {
isa = PBXSourcesBuildPhase;
@@ -344,6 +380,7 @@
082D3940162C825A00973067 /* Release */,
);
defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
Oops, something went wrong.

0 comments on commit 91f1b51

Please sign in to comment.