Search
 
SCRIPT & CODE EXAMPLE
 

SWIFT

Swift Generic Function

// create a generic function
func displayData<T>(data: T){
  ...
}
Comment

Generic Function Swift

// create a generic function
func displayData<T>(data: T) {
  print("Generic Function:")
  print("Data Passed:", data)
}

// generic function working with String
displayData(data: "Swift")

// generic function working with Int
displayData(data: 5)
Comment

PREVIOUS NEXT
Code Example
Swift :: Swift Assigning and accessing a value from an optional 
Swift :: Swift Tuple in Switch Statement 
Swift :: Swfit Add Elements to an Array 
Swift :: how to darken view swiftui 
Swift :: Swift Equatable Protocol 
Swift :: Changing default url to static-media in Flask 
Swift :: map vs compactmap in swiftui 
Swift :: swift multiline comment 
Swift :: Initializer Swift 
Swift :: how to call another view controller method when button click from another ios swift 
Swift :: swift view controller background image 
Swift :: Swift if...else 
Swift :: Trailing Closure Swift 
Swift :: Function Call Using try Keyword Swift 
Swift :: key path expression as functions ios swift 
Swift :: Swift Literals 
Swift :: How to make dart typing stricter 
Swift :: how to do corner radius from button image in swift 
Swift :: allowed filename characters swift 
Ruby :: rails skip authenticity token 
Ruby :: devise add trackable 
Ruby :: rails migration rename column 
Ruby :: ruby read file 
Ruby :: how to get current month end date in ruby 
Ruby :: ruby check if value in array 
Ruby :: ruby timestamp 
Ruby :: ruby read stdin 
Ruby :: rails filter hashes by key value 
Ruby :: ruby create array 
Ruby :: run Rspec 
ADD CONTENT
Topic
Content
Source link
Name
6+7 =