This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
/* | |
What is Generics in swift and how useful in the applications? | |
- Generics in swift allows flexible and reusable code that can work in different types while maintaining type safety | |
- Key Points are | |
- Type Safety, | |
- Reusability | |
- Parameterization |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import PlaygroundSupport | |
PlaygroundPage.current.needsIndefiniteExecution = true | |
extension Date { | |
var currentTimeStamp: Int64 { | |
Int64(self.timeIntervalSince1970 * 1000) | |
} | |
} | |
func concurrency() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Combine | |
import Foundation | |
import PlaygroundSupport | |
PlaygroundPage.current.needsIndefiniteExecution = true | |
// A simple publisher that emits integers from 1 to 5 | |
let numberPublisher = [1, 2, 3, 4, 5].publisher |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
let sampleURL = URL(string: "https://example.com/auth-callback#access_token=mytoken&expires_in=36000&scope=zap+profile") | |
var sampleComponents = URLComponents() | |
sampleComponents.query = sampleURL?.fragment | |
for item in sampleComponents.queryItems! { | |
print("\(item.name): \(item.value)") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Created by kanagasabapathy on 11/10/23. | |
import Foundation | |
//: [Next](@next) | |
// Higher Order Functions | |
/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
/* | |
Closures are the self-contained blocks that can be passed around and used the code. | |
Capture the values and store a reference to any constants and variables | |
*/ | |
/* |