https://github.com/digipolitan/session-kit
https://github.com/digipolitan/session-kit
Last synced: 10 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/digipolitan/session-kit
- Owner: Digipolitan
- License: bsd-3-clause
- Created: 2017-10-24T08:26:58.000Z (about 8 years ago)
- Default Branch: develop
- Last Pushed: 2018-12-19T14:19:25.000Z (almost 7 years ago)
- Last Synced: 2025-02-17T08:16:43.605Z (10 months ago)
- Language: Swift
- Size: 64.5 KB
- Stars: 0
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
SessionKit
=================================
[](https://developer.apple.com/swift/)
[](https://travis-ci.org/Digipolitan/session-kit)
[](https://img.shields.io/cocoapods/v/SessionKit.svg)
[](https://github.com/Carthage/Carthage)
[](https://swift.org/package-manager/)
[](http://cocoadocs.org/docsets/SessionKit)
[](http://twitter.com/Digipolitan)
Session access for swift apps
## Installation
### CocoaPods
To install SessionKit with CocoaPods, add the following lines to your `Podfile`.
```ruby
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
use_frameworks!
pod 'SessionKit'
```
### Carthage
[Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.
You can install Carthage with [Homebrew](http://brew.sh/) using the following command:
```bash
$ brew update
$ brew install carthage
```
To integrate SessionKit into your Xcode project using Carthage, specify it in your `Cartfile`:
```
github 'Digipolitan/session-kit ~> 1.0
```
Run `carthage update` to build the framework and drag the built `SessionKit.framework` into your Xcode project.
### Swift Package Manager
The [Swift Package Manager](https://swift.org/package-manager/) is a tool for automating the distribution of Swift code and is integrated into the `swift` compiler.
Once you have your Swift package set up, adding SessionKit as a dependency is as easy as adding it to the `dependencies` value of your `Package.swift`.
```swift
dependencies: [
.package(url: "https://github.com/Digipolitan/session-kit.git", from: "1.0.0")
]
```
## The Basics
First you must start your session
```swift
let session = Session.start()
```
Then after that you can add variables to session.
```swift
session?.userInfo["token"] = "ndfzfoerhnce32rkeznf"
```
to retrieve your session data you need to use the **restore** method
```swift
if let session = Session.restore() {
printf(session["token"]) // display: ndfzfoerhnce32rkeznf
}
```
When the session is finished you can remove it using the **destroy** method
```swift
if let session = Session.restore() {
session.destroy()
}
```
## Contributing
See [CONTRIBUTING.md](CONTRIBUTING.md) for more details!
This project adheres to the [Contributor Covenant Code of Conduct](CODE_OF_CONDUCT.md).
By participating, you are expected to uphold this code. Please report
unacceptable behavior to [contact@digipolitan.com](mailto:contact@digipolitan.com).
## License
SessionKit is licensed under the [BSD 3-Clause license](LICENSE).