import Foundation

final class MSettings:Model<ArchSettings>
{
    private(set) var items:[MSettingsProtocol]
    private var database:Database?
    private var settings:DSettings?
    
    required init()
    {
        items = []
        
        super.init()
    }
    
    //MARK: private
    
    private func loadSettings(
        settings:DSettings,
        database:Database)
    {
        self.settings = settings
        items = MSettings.factoryItems(
            settings:settings,
            database:database)
        
        view?.settingsLoaded()
    }
    
    //MARK: internal
    
    func loadSettings()
    {
        guard
        
            let database:Database = Database(bundle:nil)
        
        else
        {
            return
        }
        
        self.database = database
        
        database.fetch
        { [weak self] (settingsList:[DSettings]) in
            
            guard
            
                let settings:DSettings = settingsList.first
            
            else
            {
                return
            }
            
            self?.loadSettings(
                settings:settings,
                database:database)
        }
    }
}

import Foundation

final class MSettings:Model<ArchSettings>
{
    private(set) var items:[MSettingsProtocol]
    private var database:Database?
    
    required init()
    {
        items = []
        
        super.init()
    }
    
    //MARK: private
    
    private func loadSettings(
        settings:DSettings,
        database:Database)
    {
        items = MSettings.factoryItems(
            settings:settings,
            database:database)
        
        view?.settingsLoaded()
    }
    
    //MARK: internal
    
    func loadSettings()
    {
        guard
        
            let database:Database = Database(bundle:nil)
        
        else
        {
            return
        }
        
        self.database = database
        
        database.fetch
        { [weak self] (settingsList:[DSettings]) in
            
            guard
            
                let settings:DSettings = settingsList.first
            
            else
            {
                return
            }
            
            self?.loadSettings(
                settings:settings,
                database:database)
        }
    }
}

--- 
+++ 
@@ -4,6 +4,7 @@
 {
     private(set) var items:[MSettingsProtocol]
     private var database:Database?
+    private var settings:DSettings?
     
     required init()
     {
@@ -18,6 +19,7 @@
         settings:DSettings,
         database:Database)
     {
+        self.settings = settings
         items = MSettings.factoryItems(
             settings:settings,
             database:database)
Add strong reference to settings
