Skip to content

Instantly share code, notes, and snippets.

View ashishkakkad8's full-sized avatar
👨‍💻
Koding

Ashish Kakkad ashishkakkad8

👨‍💻
Koding
View GitHub Profile
@ashishkakkad8
ashishkakkad8 / Models.swift
Created August 21, 2022 12:36
Models for Contacts JSON Response
//
// Models.swift
// APISwiftUI
//
// Created by Kode on 04/08/22.
//
import Foundation
// MARK: - ContactResult
struct ContactResult: Codable {
@ashishkakkad8
ashishkakkad8 / APIHelper.swift
Last active August 21, 2022 12:51
APIHelper in SwiftUI
//
// APIHelper.swift
// APISwiftUI
//
// Created by Kode on 04/08/22.
//
import Foundation
class APIHelper : ObservableObject {
@ashishkakkad8
ashishkakkad8 / PreventScreenshot.swift
Created July 18, 2022 17:12
Prevent Screenshot of UIView - iOS
extension UIView {
func preventScreenshot() {
DispatchQueue.main.async {
let field = UITextField()
field.isSecureTextEntry = true
self.addSubview(field)
field.centerYAnchor.constraint(equalTo: self.centerYAnchor).isActive = true
field.centerXAnchor.constraint(equalTo: self.centerXAnchor).isActive = true
self.layer.superlayer?.addSublayer(field.layer)
field.layer.sublayers?.first?.addSublayer(self.layer)
@ashishkakkad8
ashishkakkad8 / AKParticleView.swift
Created April 30, 2022 19:28
SwiftUI Particle View for AKSwiftUIParticles
//
// AKParticleView.swift
// AKSwiftUIParticles
//
// Created by Ashish Kakkad on 30/04/22.
//
import SwiftUI
import SpriteKit
@ashishkakkad8
ashishkakkad8 / KodeHideKeyboard.swift
Created March 14, 2022 03:48
How to hide Keyboard in SwiftUI?
private enum Field: Int, CaseIterable {
case username, password
}
@State private var username: String = ""
@State private var password: String = ""
@FocusState private var focusedField: Field?
var body: some View {
@ashishkakkad8
ashishkakkad8 / SnippetNavigationTitle.swift
Created January 30, 2021 12:55
Navigation Bar with Title in SwiftUI
NavigationView {
Text("Hello, navigation!").padding()
.navigationBarTitle(Text("SwiftUI"), displayMode: .inline)
}
@ashishkakkad8
ashishkakkad8 / SnippetNavigationBar.swift
Created January 30, 2021 12:52
Navigation Bar in SwiftUI
NavigationView {
Text("Hello, navigation!").padding()
.navigationBarTitle(Text("SwiftUI"), displayMode: .inline)
.navigationBarItems(leading:
HStack {
Button(action: {
print("Apple button tapped!")
}) {
Image(systemName: "applelogo")
@ashishkakkad8
ashishkakkad8 / UIColorPickerViewControllerSample.swift
Created August 29, 2020 09:51
UIColorPickerViewController - iOS 14 - A view controller that informs your app about user interaction with the color picker.
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
}
@IBAction func btnColorPickerPressed(_ sender: Any) {
let colorPickerVC = UIColorPickerViewController()
@ashishkakkad8
ashishkakkad8 / UIColorWellSample.swift
Created August 29, 2020 09:18
UIColorWell - iOS 14 - A control that displays a color picker.
import UIKit
class ViewController: UIViewController {
var colorWell: UIColorWell!
override func viewDidLoad() {
super.viewDidLoad()
addColorWell()
}
@ashishkakkad8
ashishkakkad8 / AFWrapper.swift
Last active January 13, 2020 07:08
Alamofire - SwiftyJSON Wrapper
//
// AFWrapper.swift
// AFSwiftDemo
//
// Created by Ashish on 10/4/16.
// Copyright © 2016 Ashish Kakkad. All rights reserved.
//
import UIKit
import Alamofire