Search
 
SCRIPT & CODE EXAMPLE
 

SWIFT

pop last element array swift


// Initialize the Array
var a = [1,2,3]

// Remove last item
let lastItem = a.removeLast()

print(lastItem)
print(a)
Comment

How to remove the last item from an array in swift

var x = [2, 4, 6, 7]
x.popLast()

print(x.count)
// output : 3
Comment

PREVIOUS NEXT
Code Example
Swift :: post API Call in swift 
Swift :: get keyboard height swift 
Swift :: index string swift 
Swift :: swift round double to 2 decimal places 
Swift :: swift create a method who can return result or throw an error 
Swift :: and in swift4 
Swift :: swift scrollview scroll to bottom 
Swift :: uitableview set space between cells 
Swift :: swift string concatenation 
Swift :: dismiss keyboard when tap outside swift 5 
Swift :: Delete Realm database swift 
Swift :: add navigation bar button swiftui 
Swift :: swift string time to epoch 
Swift :: swift dictionary get key from valye 
Swift :: swift scrollview auto fit content height 
Swift :: Equatable Function Swift 
Swift :: swift dictionary sorted 
Swift :: Play Video in AVPlayer ViewController Sample Code Swift 
Swift :: Function Inside Swift Struct 
Swift :: Swift "Hello, World!" Program 
Swift :: Convert JSON to Data 
Swift :: swift go to main thread 
Swift :: swift disable modal dismiss swift 
Swift :: swift function 
Swift :: swift output 
Swift :: swift open messages app 
Swift :: flow ios swift kotlin 
Swift :: protocol oriented programming swift github Basic 
Swift :: swift truncate a float 
Swift :: Swift Add Elements to a Dictionary 
ADD CONTENT
Topic
Content
Source link
Name
8+3 =