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 / SecondView.swift
Created August 24, 2022 18:03
PassDataSwiftUI
//
// SecondView.swift
// PassDataSwiftUI
//
// Created by Kode on 24/08/22.
//
import SwiftUI
struct SecondView: View {
@ashishkakkad8
ashishkakkad8 / ContactListView.swift
Created August 21, 2022 12:56
Populate Contact List in SwiftUI
//
// ContactListView.swift
// APISwiftUI
//
// Created by Kode on 21/08/22.
//
import SwiftUI
struct ContactListView: View {
@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()