summaryrefslogtreecommitdiffhomepage
path: root/ios/MullvadVPN/UI appearance/UIEdgeInsets+Extensions.swift
blob: b02f4291a19bd1ef9ca78d085c9198d389bd6d40 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
//
//  UIEdgeInsets+Extensions.swift
//  MullvadVPN
//
//  Created by Marco Nikic on 2023-09-20.
//  Copyright © 2025 Mullvad VPN AB. All rights reserved.
//

import SwiftUI
import UIKit

extension UIEdgeInsets {
    /// Returns directional edge insets mapping left edge to leading and right edge to trailing.
    var toDirectionalInsets: NSDirectionalEdgeInsets {
        NSDirectionalEdgeInsets(
            top: top,
            leading: left,
            bottom: bottom,
            trailing: right
        )
    }

    /// Returns edge insets.
    var toEdgeInsets: EdgeInsets {
        EdgeInsets(toDirectionalInsets)
    }
}