Search
 
SCRIPT & CODE EXAMPLE
 

SWIFT

swiftui hidden

extension View {
    
    /// Hide or show the view based on a boolean value.
    ///
    /// Example for visibility:
    /// ```
    /// Text("Label")
    ///     .isHidden(true)
    /// ```
    ///
    /// Example for complete removal:
    /// ```
    /// Text("Label")
    ///     .isHidden(true, remove: true)
    /// ```
    ///
    /// - Parameters:
    ///   - hidden: Set to `false` to show the view. Set to `true` to hide the view.
    ///   - remove: Boolean value indicating whether or not to remove the view.
    @ViewBuilder func isHidden(_ hidden: Bool, remove: Bool = false) -> some View {
        if hidden {
            if !remove {
                self.hidden()
            }
        } else {
            self
        }
    }
}
Comment

PREVIOUS NEXT
Code Example
Swift :: get last element of array swift 
Swift :: while loop in swift 
Swift :: adding label to navigation bar 
Swift :: swift create custom button with icon programmatically 
Swift :: abstract class in swift 
Swift :: struct vs class in swift 
Swift :: swift 
Swift :: how to send a file from file manager in mail swift 
Swift :: Swift Create String Instance 
Swift :: Swift Assignment Operators 
Swift :: Swift Change Value of a Variable 
Swift :: set time programmatically swift 
Swift :: while loops swift 
Swift :: swift md5 cryptokit 
Swift :: swift api call with certificate 
Swift :: access tuple elements 
Swift :: Swift Operator Associativity 
Swift :: change button image tint color swift 
Swift :: string swift 
Swift :: how to use snippets in xcode 
Swift :: swift 5 on return button action 
Swift :: Struct Instances Swift 
Swift :: string to decimal swift 
Ruby :: validates length rails 
Ruby :: rails activestorage get image url 
Ruby :: How can I rename a database column in a Ruby on Rails migration? 
Ruby :: activerecord less than 
Ruby :: ruby deep merge 
Ruby :: rails date format dd/mm/yyyy 
Ruby :: ruby csv parse 
ADD CONTENT
Topic
Content
Source link
Name
3+1 =