mirror of
https://github.com/wahyd4/libr-ios.git
synced 2026-08-09 05:06:46 +10:00
26 lines
683 B
Swift
26 lines
683 B
Swift
//
|
|
// LocalStore.swift
|
|
// librx
|
|
//
|
|
// Created by Yunlong Zheng on 15/8/26.
|
|
// Copyright (c) 2015年 librx. All rights reserved.
|
|
//
|
|
|
|
import UIKit
|
|
|
|
struct PostsStore {
|
|
|
|
private static let userDefaults = NSUserDefaults.standardUserDefaults()
|
|
|
|
static func setPostsCacheBySection(section: PostsLoader.PostSection, posts: NSData) {
|
|
print("set posts cache for key \(section.cacheKey)")
|
|
userDefaults.setObject(posts, forKey: section.cacheKey)
|
|
userDefaults.synchronize()
|
|
}
|
|
|
|
static func getPostsCacheBySection(section: PostsLoader.PostSection) -> NSData?{
|
|
return userDefaults.objectForKey(section.cacheKey) as? NSData
|
|
}
|
|
|
|
}
|