Skip to content

Instantly share code, notes, and snippets.

View DominatorVbN's full-sized avatar
💭
exploring world of swift

Amit Samant DominatorVbN

💭
exploring world of swift
View GitHub Profile
@DominatorVbN
DominatorVbN / ChoasGame.swift
Created October 1, 2023 09:25
Simulation of mathematical concept of Chaos Game
import SwiftUI
import SwiftData
// TODO: Make this animatable shape
struct Polygon: Shape {
var edges: Int
var pathUpdated: (Path) -> Void
var vertexUpdated:([CGPoint]) -> Void
@DominatorVbN
DominatorVbN / KeyedDecodingContainer+DecodeArrayAsDictionary.swift
Created June 7, 2023 09:52
Utility function that decodes a dictionary in place of array
extension KeyedDecodingContainer {
/// Decodes a dictionary in place of array
/// - Parameters:
/// - type: Type of the element of array should be decodable
/// - key: The key against which the array is present in the container
/// - keyPath: key path on the element type to be the key of dictionay
/// - Returns: return the dictionary
func decodeArrayAsDictionary<T: Decodable, Key: Hashable>(
_ type: Dictionary<Key,T>.Type,
@DominatorVbN
DominatorVbN / Groupboxs.swift
Created July 7, 2020 16:01
New group box view in SwiftUI
import SwiftUI
struct GroupBoxs: View {
@State var progress: CGFloat = 0.3
var body: some View {
VStack(spacing: 20) {
//Groupbox arranges view as an vstack so it's safe to assume that has an implicit VStack in defination
GroupBox(label: Text("Progress"), content: {
ProgressView(value: progress, total: 1.0)
import UIKit
import SwiftUI
import PlaygroundSupport
extension UIView {
var renderedImage: UIImage {
// rect of capure
let rect = self.bounds
// create the context of bitmap
UIGraphicsBeginImageContextWithOptions(rect.size, false, 0.0)
let context: CGContext = UIGraphicsGetCurrentContext()!

Keybase proof

I hereby claim:

  • I am dominatorvbn on github.

  • I am amitsamant (https://keybase.io/amitsamant) on keybase.

  • I have a public key ASDlpjSn-7hWgNG4CJ_5PXhlLg0kYhHP60zEUa7nk7CZpgo

//
// UITextField+placeholdetTextColor.swift
// Textfield place holder color changer
//
// Created by mac on 22/08/19.
// Copyright © 2019 Dominator. All rights reserved.
//
import UIKit
extension UITextField{
@DominatorVbN
DominatorVbN / UIColor+Hex.swift
Created February 1, 2019 13:47
UIColor Extension with convinent initializers for hex code and rgb values
//
// UIColor+RGB.swift
// CfssApp
//
// Created by mac on 31/01/19.
// Copyright © 2019 mmfinfotech. All rights reserved.
//
import UIKit
extension UIColor {
@DominatorVbN
DominatorVbN / CounterView.swift
Created October 24, 2018 13:17
Custom View Counter.
//
// CounterView.swift
// Flo
//
// Created by mac on 24/10/18.
// Copyright © 2018 Dominator. All rights reserved.
//
import UIKit
@DominatorVbN
DominatorVbN / GraphView.swift
Last active October 24, 2018 13:15
Custom UIView Graph.
//
// GraphView.swift
// Flo
//
// Created by mac on 24/10/18.
// Copyright © 2018 Dominator. All rights reserved.
//
import UIKit
//Weekly sample data