am creating an iOS app and I want to implement Singleton Pattern. I have created “Singleton” LibraryAPI to act as an entry point UserManager object to get data from web API. after that I used a facade Pattern “method” to call UserManager implementation.
https://www.raywenderlich.com/477-design-patterns-on-ios-using-swift-part-1-2#toc-anchor-004
final class LibraryAPI {
static let shared = LibraryAPI()
private let userManager = UsersManager()
private let isOnline = false
private init(){
}
func getUsers() -> [User] {
return userManager.getUsers()
}
}
my questions:
- if I have another Manager Class like “album” class should I use the same LibraryAPI and it will become a monolithic class and how to avoid that?
- should I create a “Singleton” LibraryAPI class for each manager object like UserLibraryAPI and albumLibraryAPI?
Note: any references or articles are welcome