Skip to content

Instantly share code, notes, and snippets.

View badrinathvm's full-sized avatar

Badarinath Venkatnarayansetty badrinathvm

View GitHub Profile
@badrinathvm
badrinathvm / CustomStyleViewModifier.swift
Created June 18, 2024 00:25
Providing option for Custom Style View Modifier
import SwiftUI
// MARK: 2. Create view style protocol
protocol CardStyle {
associatedtype Body: View
typealias Configuration = CardStyleConfiguration
func makeBody(configuration: Self.Configuration) -> Self.Body
}
@badrinathvm
badrinathvm / CircularLoaderView.swift
Last active June 16, 2024 21:40
Circular Loader View
import Combine
import Foundation
import SwiftUI
struct CircularLoaderView: View {
@State private var circleProgress: CGFloat = 0.0
@State private var timerCancellable: Cancellable? = nil
@State private var isComplete = false
let gradient = AngularGradient(
@badrinathvm
badrinathvm / GradientAnimatedBorderCardView.swift
Last active June 18, 2024 20:39
Gradient Animated Border
//
// ContentView.swift
// Exploration
//
//
import SwiftUI
struct ContentView: View {
var body: some View {
@badrinathvm
badrinathvm / ActionViewController.swift
Last active April 17, 2024 17:17
Sharing images via Action extension target
class ActionViewController: UIViewController {
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
getImageDataFromExtension()
}
}
extension ActionViewController {
private func getImageDataFromExtension() {
@badrinathvm
badrinathvm / Info.plist
Created April 17, 2024 16:49
Info.plist for the Share Extension iOS
<?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>NSExtension</key>
<dict>
<key>NSExtensionAttributes</key>
<dict>
<key>NSExtensionActivationRule</key>
<string>
@badrinathvm
badrinathvm / ShareViewController.swift
Last active April 17, 2024 16:45
Sharing Images via Share Extension iOS
class ShareViewController: UIViewController {
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
getImageDataFromExtension()
}
}
extension ShareViewController {
private func getImageDataFromExtension() {
@badrinathvm
badrinathvm / DropDown.swift
Created May 26, 2023 05:20
Disclosure Group
//
// DropDown.swift
// Custom Action Sheet
//
// Created by Rani Badri on 5/25/23.
// Copyright © 2023 Balaji. All rights reserved.
//
import Foundation
import SwiftUI
@badrinathvm
badrinathvm / SideBarView.swift
Last active April 16, 2023 23:51
Generalized Sidebar
import SwiftUI
enum MenuItem: String, CaseIterable, Identifiable {
case pinned = "Pinned"
case activity = "Activity"
case legal = "Legal"
var id: MenuItem { MenuItem(rawValue: self.rawValue) ?? .pinned }
}
@badrinathvm
badrinathvm / CatgeoryTemplateView.swift
Created December 30, 2020 20:14
Category Template Gist
//
// CategoryTemplateView.swift
// Basics
//
// Created by Venkatnarayansetty, Badarinath on 12/30/20.
// Copyright © 2020 Badarinath Venkatnarayansetty. All rights reserved.
//
import SwiftUI
@badrinathvm
badrinathvm / Network.swift
Last active May 16, 2020 21:35
Combine Networking
import Combine
struct Welcome: Codable {
let page: Int
let results: [Result]
let totalPages, totalResults: Int
init(page:Int = 0, results: [Result], totalPages:Int = 0, totalResults: Int = 0) {
self.page = page
self.results = results