Skip to content

Instantly share code, notes, and snippets.

View codewithsanthoshofficial's full-sized avatar

K Santhosh Kumar codewithsanthoshofficial

View GitHub Profile
@codewithsanthoshofficial
codewithsanthoshofficial / Real example
Created March 31, 2026 15:12
UIKit->SwiftUI && SwiftUI -> UIKit
if uiImages.count > 1 {
let swiftUIView = FullImageViewer(images: uiImages)
// Wrap it in a UIHostingController
let hostingController = UIHostingController(rootView: swiftUIView)
// Present it
hostingController.modalPresentationStyle = .fullScreen
self.present(hostingController, animated: true, completion: nil)
}
##Escaping
-------------
func getSumOf(array: [Int], handler: @escaping (Int) -> Void) {
// Step 2: Move work to async queue
DispatchQueue.global().async {
var sum: Int = 0
for value in array {
sum += value
}
###How to Delete All Cloned Simulators (Fastest Method)
xcrun simctl delete unavailable
### Delete all simulator clones
Delete all simulator clones
###Delete Clones from Xcode UI:
###Clean Architecture
Flow: View → ViewModel → UseCase → Repository (protocol) → RepositoryImpl → API → DTO
Features
└── News
├── Presentation
│ ├── Views
│ │ ├── NewsView.swift
│ │ └── NewsListView.swift
1)
###WithOut SSL Pinning
extension NetworkManager: URLSessionDelegate {
public func urlSession(_ session: URLSession, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) {
let urlCredential = URLCredential(trust: challenge.protectionSpace.serverTrust!)
completionHandler(.useCredential, urlCredential)
}
}
Amazon git
1)
Create New Repo for project Cd path
Git remote -v (check have any old paths)
rm -rf .git (if have any old paths remove)
Git remote -v (check have any old paths)
Git init .
Git remote add origin SSHkey ( SSHKey will get from aws when click on create button and enter project name then get ssh keys and https keys)
Git checkout -b dev
import Foundation
import Combine
enum HttpMethod:String {
case get = "GET"
case post = "POST"
case put = "PUT"
case delete = "DELETE"
import Foundation
enum HttpMethod:String {
case get = "GET"
case post = "POST"
case put = "PUT"
case delete = "DELETE"
}
@codewithsanthoshofficial
codewithsanthoshofficial / APIEndPoint _ SwiftUI_FromSwift
Last active February 10, 2026 18:27
API call _ SwiftUI _Codable
enum APIEndPoint {
static let baseURL = ""
case news
var url:String {
switch self {
case .news: return "\(APIEndPoint.baseURL)+news"
}
}
}
@codewithsanthoshofficial
codewithsanthoshofficial / APIClient _ API call_SwiftUI
Last active February 12, 2026 06:24
SwiftUI_SampleAPICall_List_stackoverflow
import Foundation
struct APIClient {
func fetchQuestions() async throws -> [QuestionsItemData] {
var components = URLComponents(string: "https://api.stackexchange.com/2.3/questions")!
components.queryItems = [
.init(name: "order", value: "desc"),
.init(name: "sort", value: "votes"),