Search
 
SCRIPT & CODE EXAMPLE
 

SQL

swiftui onappear only once

If you're linking against iOS15 then you can take advantage of the new scenePhase concept:

@Environment(.scenePhase) var scenePhase

Where ever you are the Environment if injecting this property that you can test against three conditions:

switch newPhase {
    case .inactive:
        print("inactive")
    case .active:
        print("active")
    case .background:
        print("background")
}

So, all together:

struct ContentView: View {
    @Environment(.scenePhase) var scenePhase

    var body: some View {
        Text("Hello, World!")
            .onChange(of: scenePhase) { newPhase in
                switch newPhase {
                    case .inactive:
                        print("inactive")
                    case .active:
                        print("active")
                    case .background:
                        print("background")
                }
            }
    }
}
Comment

PREVIOUS NEXT
Code Example
Sql :: add column to all tables after first column mysql 
Sql :: how to check rollback status in oracle 
Sql :: sqlalchemy get sql 
Sql :: oracle activate program 
Sql :: delete from table and truncate table 
Sql :: postgres type equivalent to timespan c# 
Sql :: mysql select all and rename one 
Sql :: {"error":{"root_cause":[{"type":"index_not_found_exception","reason":"no such index 
Sql :: sql tablo hangi sp de 
Sql :: contraint default SQL 
Sql :: sqldf change user 
Sql :: mysql set variable in a session 
Sql :: TSQL Find csv file in folder 
Sql :: como leer datos de mysql esp32 
Sql :: prestashop alter table if not exists 
Sql :: sql server bool select 
Sql :: radius search with point data in mysql 
Sql :: delete in sql 
Sql :: column value should show as latest using sql query 
Sql :: postgresql copy backup table 
Sql :: how to put value in parameters in mysqldataadapter 
Sql :: Alter precision 
Sql :: mysql beautifier terminla 
Sql :: mysql equivalent decode oracle 
Sql :: alling a function from PL/SQL in a select statement in ORACLE 
Sql :: mysql select where field is a value 
Sql :: druid sql list all tables 
Sql :: Raw query must include the primary key 
Sql :: Prepared statements in mysql 
Sql :: openquery update linked server 
ADD CONTENT
Topic
Content
Source link
Name
2+1 =