Skip to content

rakeshchander/CachingLibrary-KMM

Repository files navigation

Caching Manager - SDK

Carthage compatible

SAVE / READ Serialized Objects / Standard Data Types (String, Int, Data, Boolean, FLoat, Decimal, Array, Map) in User Preferences OR App Internal Storage

  • Supports KMM, iOS & Android apps
    • Android version 26 & above
    • iOS version 12 & Above
    • Apple TvOS version 13 & Above
    • Apple WatchOS version 7 & Above

Installation

KMM

Module level build.gradle

repositories {
    mavenCentral()
}

dependencies {
    implementation 'io.github.rakeshchander:RCCachingManager:<version>'
}
Android
Kotlin

App level build.gradle

repositories {
    mavenCentral()
}

dependencies {
    implementation 'io.github.rakeshchander:RCCachingManager:<version>'
}
JAVA

App level build.gradle

plugins {
    id 'com.android.application'
    id 'org.jetbrains.kotlin.android'
}

android {
    kotlinOptions {
        jvmTarget = '1.8'
    }
}

dependencies {
    implementation 'io.github.rakeshchander:RCCachingManager:<version>'
}

Project level build.gradle

plugins {
    id 'org.jetbrains.kotlin.android' version '1.5.30' apply false
}
iOS
CocoaPods

CocoaPods is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website. To integrate Alamofire into your Xcode project using CocoaPods, specify it in your Podfile:

  • Add below line in your podfile, if not there

    • source 'https://github.com/CocoaPods/Specs.git'
      
  • Add below in podfile - in respective target block

pod 'RCCachingManager'
  • Execute below command in terminal

    pod install --repo-update
Swift Package Manager - SPM

The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swiftcompiler.

Once you have your Swift package set up, adding GrowthBook as a dependency is as easy as adding it to the dependencies value of your Package.swift.

dependencies: [
    .package(url: "https://github.com/rakeshchander/CachingLibrary-KMM.git")
]
Carthage (min Carthage version 0.38.0)

Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks. To integrate Alamofire into your Xcode project using Carthage, specify it in your Cartfile:

binary "https://github.com/rakeshchander/CachingLibrary-KMM/blob/main/Carthage/RCCachingManager.json"
carthage update --use-xcframework

Usage

Caching Manager - App Internal Storage

  • You can save/ read String Data
  • You can save/ read Serailzable Class Objects
// Instantiate Caching Manager
val cachingLayer = RCCachingManager()

// Save String Content
cachingLayer.saveContent("AppMetaData", dataModel)
// Read String Content
val content = cachingLayer.getContent("AppMetaData")

// Save Serialzed Objects
cachingLayer.putSerializedData("AppMetaData", dataModel)
// Read Serialized Objects
val dataModel = cachingLayer.getSerializedData("AppMetaData")

Shared Preferences / User Defaults

  • You can save/ read Supported Data types in Shared Prefrences / User Defaults
// Instantiate Preferences Manager
val prefLayer = RCUserPreferences()

// Save Content
prefLayer.setPrefValue("AppMetaData", dataModel)
// Read Content
val content = prefLayer.setPrefValue("AppMetaData")

License

This project uses the Apache v2.0 license. The SDK will always remain open and free, although we may add some commercial enterprise add-ons in the future.