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
- Host: GitHub
- URL: https://github.com/space-code/service-locator
- Owner: space-code
- License: mit
- Created: 2024-02-12T07:23:47.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-02-13T19:18:25.000Z (about 2 years ago)
- Last Synced: 2025-08-17T03:03:39.089Z (6 months ago)
- Topics: service-locator, service-locator-pattern
- Language: Objective-C
- Homepage:
- Size: 15.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
service-locator
## 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.