Giter Site home page Giter Site logo

at9009 / absavesystem Goto Github PK

View Code? Open in Web Editor NEW

This project forked from alexblunck/absavesystem

0.0 0.0 0.0 116 KB

Objective-C Helper class to save NSData, Ints, Floats, Strings, Booleans in a persistent storage (.absave binary file)

Home Page: http://www.ablfx.com

absavesystem's Introduction

ABSaveSystem is a helper class written in Objective-C which can be used in iOS and Mac OSX Applications to save data. (Also works perfectly with the iOS/Mac game engine "cocos2D"


FEATURES:

  • Helper Methods for quickly saving strings (NSString), integers (int), floats (float) and booleans (BOOL)

  • Save NSData

  • Saved Data is encrypted (With Public Apple frameworks->iTunes Connect safe)

  • Save/Load to/from multiple files

  • Saves the data into a clean .absave binary file

  • Mac / iOS / Cocos2D compatible

  • Extremely easy to use


USAGE:

  1. Add File from "ABSaveSystem" folder to your project and import ABSaveSystem.h into your class, in the ASaveSystem.m file at the top change "AppName" to whatever your App is named and "OS" to either IOS or MAC.

  2. Init ABSaveSystem
    ABSaveSystem *saveSystem = [ABSaveSystem saveSystem];

    1. You can basically convert any object that conforms to the NSCoding protocol to an NSData Object and safe that with the SaveSystem (See the Example App for using a Custom NSObject subclass exmaple)
    NSArray *myArray = [NSArray arrayWithObjects:@"Object1", @"Object2", nil];
    NSData *arrayData = [NSKeyedArchiver archivedDataWithRootObject:myArray];
    [saveSystem saveData:arrayData withKey:@"myarray"];


    2. Load NSData objects:
    NSData *loadedData = [saveSystem loadDataForKey:@"myarray"];
    NSArray *loadedArray = [NSKeyedUnarchiver unarchiveObjectWithData:loadedData];

  3. There are also Helper Methods that let you very quickly save strings/ int's / floats's / BOOL's

[mySaveSystem saveString:@"string Value" withKey:@"stringKey"];
[mySaveSystem saveINT:4563 withKey:@"intKey"];
[mySaveSystem saveFloat:5.674f withKey:@"floatKey"];
[mySaveSystem saveBool:YES withKey:@"boolKey"];
  1. Load strings/ int's / floats's
NSLog(@"loaded String: %@", [mySaveSystem loadStringForKey:@"stringKey"]);
NSLog(@"loaded INT: %i", [mySaveSystem loadINTForKey:@"intKey"]);
NSLog(@"loaded Float: %f", [mySaveSystem loadFloatForKey:@"floatKey"]);
  1. Load data directly into variables
NSString *myString = [mySaveSystem loadStringForKey:@"stringKey"]
int myINT = [mySaveSystem loadINTForKey:@"intKey"]
float myINT = [mySaveSystem loadFloatForKey:@"floatKey"]
  1. Dont forget to release the Save System after use!
    [mySaveSystem release];

Other Features
- Use following method to save / load to/ from a different file(.plist):
ABSaveSystem *ss = [ABSaveSystem saveSystem];
ss.superFileName = @"MyPlistName";
//Do saving / Loading

- If you need to set the OS (mac/iOS) dynamically in code use the "superOS" property of the ABSaveSystem instance to either "ssIOS" or "ssMAC" (useful for projects with seperate MAC/iOS Targets)

- There is also a convience method to save/load NSData to different .plist's:
[saveSystem saveData:myData withKey:@"myKey" fileName:@"MyPlistName"];

Check out the Example app for iOS and Mac for a usage example!


___

Some Other Stuff

If you like this consider supporting me by buying my game "Be The Kiwi" for iPhone/iPad:
Be The Kiwi for iOS

or

Downloading "Be The Kiwi" for Mac OS for free and leaving a kind review ;)
Be The Kiwi for Mac

CONTACT:

Feel free to contact me about any improvement requests / issues via mail
([email protected]) or via Twitter (http://www.twitter.com/blunckalex)

LICENSE:

ABSaveSystem is licensed under the MIT License…or in simple use as you please, just don't sell the code itself ;)

Copyright (c) 2012 Ablfx (Alexander Blunck)

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.

absavesystem's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.