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 / JOSNArraySwiftParsingiOS
Last active December 31, 2017 05:59
JSON Array Parsing in Swift Langauage - Swift 3 – iOS 10 – Xcode 8 GM
//
// ViewController.swift
// SwiftJSONParsingDemo
//
// Created by Ashish Kakkad on 12/10/16.
// Copyright © 2016 Kode. All rights reserved.
//
import UIKit
@ashishkakkad8
ashishkakkad8 / pyramid.c
Created February 15, 2016 10:12
Pyramid in C
#include<stdio.h>
int main() {
int i, j, spaces = 0, sc, n = 0;
int k = 1;
printf("Enter Number of Lines = ");
scanf("%d",&n);
spaces = n - 1;
@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
@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 / 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 / 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 / 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 / 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 / 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 / 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)