An open API service indexing awesome lists of open source software.

https://github.com/space-code/service-locator

service-locator is a framework written in Objective-C that implements a design pattern used in software development to encapsulate the processes involved in obtaining a service with a strong abstraction layer
https://github.com/space-code/service-locator

service-locator service-locator-pattern

Last synced: 5 months ago
JSON representation

service-locator is a framework written in Objective-C that implements a design pattern used in software development to encapsulate the processes involved in obtaining a service with a strong abstraction layer

Awesome Lists containing this project

README

          

service-locator


CodeCov
CodeCov
CodeCov
CI
CodeCov

## Description
`service-locator` is a framework written in Objective-C that implements a design pattern used in software development to encapsulate the processes involved in obtaining a service with a strong abstraction layer.

- [Usage](#usage)
- [Requirements](#requirements)
- [Communication](#communication)
- [Contributing](#contributing)
- [Author](#author)
- [License](#license)

## Usage

1. Define a protocol:

```objc
@protocol MyProtocol
@end
```

2. Define a class that conforms to this protocol:

```objc
@interface MyClass: NSObject
@end
```

3. Register an object in a registry:

```objc
#import

[[NVRegistry sharedInstance] register:@protocol(MyProtocol) scope:NVRegistryScopePrototype factory:factory:^id _Nonnull {
return [[MyClass alloc] init];
}];
```

4. Resolve an object based on a protocol:

```objc
#import

MyClass *myClass = [[NVRegistry sharedInstance] resolve:@protocol(MyProtocol)];
```

## Requirements
- iOS 12.0 / macOS 10.14+ / tvOS 12.0 / watchOS 6.0
- Xcode 15.0

## Communication
- If you **found a bug**, open an issue.
- If you **have a feature request**, open an issue.
- If you **want to contribute**, submit a pull request.

## Contributing
Bootstrapping development environment

```
make bootstrap
```

Please feel free to help out with this project! If you see something that could be made better or want a new feature, open up an issue or send a Pull Request!

## Author
Nikita Vasilev, nv3212@gmail.com

## License
service-locator is available under the MIT license. See the LICENSE file for more info.