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 / 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 / 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 / PreventScrollViewScreenshot.swift
Created April 23, 2023 10:56
Screenshot Prevent for ScrollView
extension UIView {
func preventScrollViewScreenshotRecursive() {
guard superview != nil else {
for subview in subviews {
subview.preventScrollViewScreenshotRecursive()
}
return
}
let guardTextField = UITextField()
guardTextField.backgroundColor = .red
@ashishkakkad8
ashishkakkad8 / AKPageView.swift
Created August 31, 2023 18:15
AKPageView for Onboarding View
//
// AKPageView.swift
// AKPageView
//
// Created by Ashish Kakkad on 31/08/23.
//
import SwiftUI
struct AKPageView: View {
@ashishkakkad8
ashishkakkad8 / CardView.swift
Created August 31, 2023 18:09
CardView for Onboarding View
//
// CardView.swift
// AKPageView
//
// Created by Ashish Kakkad on 31/08/23.
//
import SwiftUI
struct CardView: View {
@ashishkakkad8
ashishkakkad8 / ContentView.swift
Last active September 20, 2022 17:51
Sample View to demonstrate Start Activity
import SwiftUI
import ActivityKit
struct ContentView: View {
var body: some View {
VStack {
Image(systemName: "capsule")
.imageScale(.large)
.foregroundColor(.black)
Text("Hello, Dynamic Island!")
@ashishkakkad8
ashishkakkad8 / LiveActivitySample.swift
Created September 20, 2022 17:35
Live Activity Sample Code
//
// LiveActivitySample.swift
// LiveActivitySample
//
// Created by Ashish Kakkad on 20/09/22.
//
import WidgetKit
import SwiftUI
@ashishkakkad8
ashishkakkad8 / ActivityAttributesSample.swift
Created September 20, 2022 17:30
ActivityAttributesSample File
import ActivityKit
struct ActivityAttributesSample: ActivityAttributes {
public typealias Status = ContentState
public struct ContentState: Codable, Hashable {
var value: String
}
}
@ashishkakkad8
ashishkakkad8 / Info.plist
Last active September 20, 2022 17:25
Update Info Plist for Support Live Activities
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSSupportsLiveActivities</key>
<true/>
</dict>
</plist>
@ashishkakkad8
ashishkakkad8 / FirstView.swift
Created August 24, 2022 18:05
PassDataSwiftUI
//
// FirstView.swift
// PassDataSwiftUI
//
// Created by Kode on 24/08/22.
//
import SwiftUI
struct FirstView: View {