AppleGuice is a powerful dependency injection framework for Swift, designed to facilitate building scalable iOS and macOS applications using the principles of inversion of control and dependency injection. By using AppleGuice, you can easily manage and resolve dependencies between different components of your application, making it more modular and testable.

About AppleGuice

AppleGuice is a lightweight dependency injection framework developed specifically for Swift. It simplifies the process of managing dependencies between different components of your iOS or macOS application, allowing you to focus on writing clean and maintainable code.

Why Use AppleGuice?

AppleGuice offers several advantages that make it a great choice for managing dependencies in your iOS or macOS project:

  • Improved modularity: AppleGuice helps you create more modular code by decoupling your classes and reducing the dependency between them.
  • Easy testing: With AppleGuice, you can easily swap dependencies with mocks or stubs during unit testing, making your tests more reliable and efficient.
  • Scalability: As your project grows, managing dependencies manually can become challenging. AppleGuice simplifies this process, allowing your codebase to scale without sacrificing maintainability.
  • Cleaner code: By using AppleGuice, you can separate concerns and achieve a higher level of abstraction in your code.
  • Improved code reusability: AppleGuice encourages the use of interfaces and protocols, enabling easier reuse of components in different parts of your application.


To install AppleGuice in your Swift project, simply follow these steps:

Step 1: Create Podfile

If you haven’t already, create a Podfile in the root directory of your project. Open Terminal, navigate to the project directory, and run the following command:

touch Podfile

Step 2: Add AppleGuice dependency

Edit the Podfile and add the following lines:

platform :ios, '9.0'
target 'YourTargetName' do
  pod 'AppleGuice', '~> 2.0'

Step 3: Install AppleGuice

Save the Podfile, and in Terminal, run the following command:

pod install

Wait for CocoaPods to install AppleGuice and generate the workspace file for your project.


Step 1: Import AppleGuice

In your Swift file where you want to use AppleGuice, import the module by adding the following line at the beginning of the file:

import AppleGuice

Step 2: Define your dependencies

Declare your dependencies using properties in your classes or structs. Use the @Inject attribute to mark properties that should be injected by AppleGuice.

class MyViewController: UIViewController {
  // Injected dependency
  @Inject private var dataManager: DataManager

Step 3: Register dependencies

In your AppDelegate or another suitable entry point of your application, register the dependencies using the DependencyRegistry class provided by AppleGuice.

import UIKit
import AppleGuice

class AppDelegate: UIResponder, UIApplicationDelegate {
  func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    DependencyRegistry.register(DataManager.self) { _ in
      return DataManager()
    // Additional dependencies registration here
    return true


For detailed documentation on AppleGuice’s features and APIs, please refer to the official AppleGuice GitHub repository.


Join the growing community of AppleGuice users! Get help, share ideas, and contribute to the development of the framework on the AppleGuice Discussions page.


We actively welcome contributions to AppleGuice. Fork the repository, make your changes, and submit a pull request. Please see the Contributing Guidelines for more information.


AppleGuice is released under the MIT license. See the LICENSE file for more information.