Search
 
SCRIPT & CODE EXAMPLE
 

SWIFT

create alert in swift

class ViewController: UIViewController {

    @IBAction func showAlertButtonTapped(_ sender: UIButton) {

        // create the alert
        let alert = UIAlertController(title: "My Title", message: "This is my message.", preferredStyle: .alert)

        // add an action (button)
        alert.addAction(UIAlertAction(title: "OK", style: UIAlertAction.Style.default, handler: nil))

        // show the alert
        self.present(alert, animated: true, completion: nil)
    }
}
Comment

simple alert swifti

struct ContentView: View {
    @State private var showingAlert = false

    var body: some View {
        Button("Show Alert") {
            showingAlert = true
        }
        .alert("Important message", isPresented: $showingAlert) {
            Button("OK", role: .cancel) { }
        }
    }
}
Comment

PREVIOUS NEXT
Code Example
Swift :: dismiss keyboard on tap outside swiftui 
Swift :: average in array swift 
Swift :: check notification permission ios swift 
Swift :: swift remove value dictionary 
Swift :: swift constructor 
Swift :: convert image to base64 swift Ui 
Swift :: swift dictionary sorted 
Swift :: type String and int swift addition 
Swift :: response.result.value alamofire 5 
Swift :: swift show title on navigation bar programmatically 
Swift :: swift replace newlines with space 
Swift :: enum in swift 
Swift :: swift create custom button with icon programmatically 
Swift :: swifter apply progress bar 
Swift :: swift wait until condition is true 
Swift :: Swift nal Within The Same Module 
Swift :: set color of indicator line in collectionview swift 
Swift :: table flutter stackoverflow 
Swift :: swift variables 
Swift :: Swift Boolean Literals 
Swift :: swiftui polygon 
Swift :: crud php native with navicat 
Swift :: called a function after some time in swift 
Swift :: swift 5 for loop with index <= 
Swift :: redux trong swift 
Swift :: Swift Nested for Loop 
Swift :: swift get last element of array 
Ruby :: command to run all rspec tests 
Ruby :: How can I rename a database column in a Ruby on Rails migration? 
Ruby :: rails form select 
ADD CONTENT
Topic
Content
Source link
Name
2+6 =