txtodo

[DORMANT] a minimalist todo list app inspired by jeff huang
git clone git://git.figbert.com/txtodo.git
Log | Files | Refs | README

DevicePaddingModifiers.swift (633B)


      1 //
      2 //  DevicePaddingModifiers.swift
      3 //  txtodo
      4 //
      5 //  Created by FIGBERT on 8/11/20.
      6 //
      7 
      8 import SwiftUI
      9 
     10 struct HorizontalPadding: ViewModifier {
     11     func body(content: Content) -> some View {
     12         return content.padding(.horizontal)
     13     }
     14 }
     15 
     16 extension View {
     17     func horizontalPaddingOnIOS() -> some View {
     18         #if os(iOS)
     19             return self.modifier(HorizontalPadding())
     20         #else
     21             return self
     22         #endif
     23     }
     24     func horizontalPaddingOnMacOS() -> some View {
     25         #if os(macOS)
     26             return self.modifier(HorizontalPadding())
     27         #else
     28             return self
     29         #endif
     30     }
     31 }