Giter Site home page Giter Site logo

socialbase's Introduction

Socialbase

Version Platform Downloads

Socialbase is a framework for building SNS in Cloud Firestore.

Requirements ❗️

Installation ⚙

  • 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)

socialbase's People

Contributors

1amageek avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

entaku0818

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.