Latest 0.5.0
Homepage https://github.com/1amageek/Socialbase
License MIT
Platforms ios 10.0, requires ARC
Dependencies Firebase/Core, Firebase/Firestore, Firebase/Storage, Pring
Authors

Version
Platform
Downloads

Socialbase is a framework for building SNS in Cloud Firestore.

Requirements ❗️

Installation ⚙

CocoaPods

  • Insert pod 'Socialbase' to your Podfile.
  • Run pod install.

Usage

Make your User defined by Pring compliant with Socialbase.

@objcMembers
final class User: Object, Socialbase {

    dynamic var name: String = "USER_NAME"
    dynamic var type: String = UserType.none.rawValue

    // Organizable
    let organizations: ReferenceCollection<User> = []
    let peoples: ReferenceCollection<User> = []

    // Followable
    let followers: ReferenceCollection<User> = []
    let followees: ReferenceCollection<User> = []
}
extension User {
    typealias Invitation = Test.Invitation
}

class Test {
    @objcMembers
    class Invitation: Object, InvitationProtocol {
        typealias Element = User
        dynamic var status: String = Status.none.rawValue
        dynamic var message: String?
        dynamic var toID: String = ""
        dynamic var fromID: String = ""
    }
}
extension User {
    typealias FollowRequest = Test.FollowRequest
}

extension Test {
    @objcMembers
    class FollowRequest: Object, FollowRequestProtocol {
        typealias Element = User
        dynamic var status: String = Status.none.rawValue
        dynamic var message: String?
        dynamic var toID: String = ""
        dynamic var fromID: String = ""
    }
}

Invite users to your organization.

let user0: User = User(id: "user0", value: [:]) // Organization user
let user1: User = User(id: "user1", value: [:])
let invitation: Test.Invitation = Test.Invitation(fromID: user0.id, toID: user1.id)
invitation.save()

Following users.

let user0: User = User(id: "user0", value: [:])
let user0: User = User(id: "user1", value: [:])
user1.follow(from: user0)

Latest podspec

{
    "name": "Socialbase",
    "version": "0.5.0",
    "summary": "Firestore Social framework",
    "description": "Socialbase is a framework for building SNS in Cloud Firestore.",
    "homepage": "https://github.com/1amageek/Socialbase",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "1amageek": "[email protected]"
    },
    "social_media_url": "http://twitter.com/1amageek",
    "platforms": {
        "ios": "10.0"
    },
    "source": {
        "git": "https://github.com/1amageek/Socialbase.git",
        "tag": "0.5.0"
    },
    "source_files": "Socialbase/**/*.swift",
    "requires_arc": true,
    "static_framework": true,
    "dependencies": {
        "Firebase/Core": [],
        "Firebase/Firestore": [],
        "Firebase/Storage": [],
        "Pring": []
    }
}

Pin It on Pinterest

Share This