Latest 0.1.0
License MIT
Platforms ios 8.0


JKServiceManager is a lightweight manager for registering and invoking custom services(app modules), written in Swift.


In Jike app, due to rapid growth of modules for various business, we need a modulized architecture for several causes:

  • Faster compilation speed, which matters a lot to Swift developers :)
  • Decoupled business logic, each module can be maintained and tested by different people
  • Unified service invocation style, take full advantage of Swift language features for simplest code


1. Define Service Protocol

// Define a service protocol
public protocol TestServiceProtocol: ServiceProtocol {
    func doTestJob()

// Extend Services class with typed static member for convenience
// Otherwise each caller needs to call (ServiceManager.getInstance(for: "testService") as? TestServiceProtocol)
extension Services {
    public static var test: TestServiceProtocol? {
        return ServiceManager.getInstance(for: "testService")

2. Implement Service

// Implement of a service protocol. Can be defined in another framework/module for decoupling.
class TestService: TestServiceProtocol {
    static var isSingleton: Bool = true

    static var sharedInstance: ServiceProtocol = TestService()

    public required init() {}

    func doTestJob() {
        print("Test service instance is doing job")

3. Add to Services.json

    "Services": {
        "testService": "TestService"

4. Invoke Service

// Register and start all services at app launch
ServiceManager.registerAndStartAllServices(in: [Bundle.main])


Simple enough?


We have a 3 level architecture in Jike app.
From top to bottom:

  • Services: Implement services, which conform to corresponding service protocols
  • Common: Define service protocols, meant to be imported by all business modules
  • Core: Infrastructure of app, including JKServiceManager


See example folder.


  • iOS 8.0+
  • Swift 3.0+


JKServiceManager is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "JKServiceManager"


JKServiceManager is available under the MIT license. See the LICENSE file for more info.

Latest podspec

    "name": "JKServiceManager",
    "version": "0.1.0",
    "summary": "A lightweight service manager written in Swift.",
    "homepage": "",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "authors": {
        "Jason Yu": "[email protected]"
    "source": {
        "git": "",
        "tag": "0.1.0"
    "platforms": {
        "ios": "8.0"
    "source_files": "JKServiceManager/**/*",
    "pushed_with_swift_version": "3.0"

Pin It on Pinterest

Share This