summaryrefslogtreecommitdiffhomepage
path: root/ios/MullvadVPN/Extensions/NSDiffableDataSourceSnapshot+Reconfigure.swift
blob: bd0c42f28f062c843402dded05012547f808e1d4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
//
//  NSDiffableDataSourceSnapshot+Reconfigure.swift
//  MullvadVPN
//
//  Created by pronebird on 27/11/2023.
//  Copyright © 2023 Mullvad VPN AB. All rights reserved.
//

import UIKit

extension NSDiffableDataSourceSnapshot {
    /// Reconfigures cell on iOS 15 or newer, with fallback to reloading cells on earlier iOS.
    /// - Parameter itemIdentifiers: item identifiers to reconfigure when possible, otherwise reload.
    mutating func reconfigureOrReloadItems(_ itemIdentifiers: [ItemIdentifierType]) {
        if #available(iOS 15, *) {
            reconfigureItems(itemIdentifiers)
        } else {
            reloadItems(itemIdentifiers)
        }
    }
}