import Foundation

extension MSettings
{
    //MARK: private
    
    private class func factoryItemTypes() -> [MSettingsProtocol.Type]
    {
        let types:[MSettingsProtocol.Type] = [
            MSettingsStorage.self,
            MSettingsTravelMode.self,
            MSettingsDetailLevel.self,
            MSettingsDistance.self]
        
        return types
    }
    
    //MARK: internal
    
    class func factoryItems(
        settings:DSettings,
        database:Database) -> [MSettingsProtocol]
    {
        let itemTypes:[MSettingsProtocol.Type] = factoryItemTypes()
        var items:[MSettingsProtocol] = []
        
        for itemType:MSettingsProtocol.Type in itemTypes
        {
            let item:MSettingsProtocol = itemType.init(
                settings:settings,
                database:database)
            
            items.append(item)
        }
        
        return items
    }
}

import Foundation

extension MSettings
{
    //MARK: private
    
    private class func factoryItemTypes() -> [MSettingsProtocol.Type]
    {
        let types:[MSettingsProtocol.Type] = [
            MSettingsTravelMode.self,
            MSettingsDetailLevel.self,
            MSettingsDistance.self,
            MSettingsStorage.self]
        
        return types
    }
    
    //MARK: internal
    
    class func factoryItems(
        settings:DSettings,
        database:Database) -> [MSettingsProtocol]
    {
        let itemTypes:[MSettingsProtocol.Type] = factoryItemTypes()
        var items:[MSettingsProtocol] = []
        
        for itemType:MSettingsProtocol.Type in itemTypes
        {
            let item:MSettingsProtocol = itemType.init(
                settings:settings,
                database:database)
            
            items.append(item)
        }
        
        return items
    }
}

--- 
+++ 
@@ -7,10 +7,10 @@
     private class func factoryItemTypes() -> [MSettingsProtocol.Type]
     {
         let types:[MSettingsProtocol.Type] = [
+            MSettingsStorage.self,
             MSettingsTravelMode.self,
             MSettingsDetailLevel.self,
-            MSettingsDistance.self,
-            MSettingsStorage.self]
+            MSettingsDistance.self]
         
         return types
     }
Reorder factory, set memory first
