<commit_before>//
//  ViewModelResolver.swift
//  Eurofurence
//
//  Copyright © 2017 Eurofurence. All rights reserved.
//

import Foundation
import Dip

/**
Dependency container with registered instances for all view models
*/
class ViewModelResolver {

	private static let instance = ViewModelResolver()
	/// Direct access to the wrapped DependencyContainer
	public static let container = ViewModelResolver.instance._container

	private let _container = DependencyContainer()

	private init() {
		_container.collaborate(with: ContextResolver.container)
		_container.register(.singleton) {
			try AnnouncementsViewModel(dataContext: ContextResolver.container.resolve())
		}
		_container.register(.singleton) {
			try CurrentEventsViewModel(dataContext: ContextResolver.container.resolve())
		}
		_container.register(.singleton) {
			try EventsViewModel(dataContext: ContextResolver.container.resolve())
		}
		_container.register(.singleton) {
			try MapViewModel(dataContext: ContextResolver.container.resolve())
		}
	}
}
<commit_msg>Make use of container collaboration in ViewModelResolver<commit_after>//
//  ViewModelResolver.swift
//  Eurofurence
//
//  Copyright © 2017 Eurofurence. All rights reserved.
//

import Foundation
import Dip

/**
Dependency container with registered instances for all view models
*/
class ViewModelResolver {

	private static let instance = ViewModelResolver()
	/// Direct access to the wrapped DependencyContainer
	public static let container = ViewModelResolver.instance._container

	private let _container = DependencyContainer()

	private init() {
		_container.collaborate(with: ContextResolver.container)
		_container.register(.singleton) {
			AnnouncementsViewModel(dataContext: $0)
		}
		_container.register(.singleton) {
			CurrentEventsViewModel(dataContext: $0)
		}
		_container.register(.singleton) {
			EventsViewModel(dataContext: $0)
		}
		_container.register(.singleton) {
			MapViewModel(dataContext: $0)
		}
	}
}

{'fraction_non_alphanumeric': 0.09465648854961832, 'fraction_numerical': 0.0061068702290076335, 'mean_word_length': 4.799410029498525, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1458728', 'n_tokens_mistral': 599, 'n_tokens_neox': 520, 'n_words': 132}