Skip to content

Instantly share code, notes, and snippets.

View Kanishka3's full-sized avatar

Kanishka C Kanishka3

View GitHub Profile
@abhi21git
abhi21git / UIAnimatableLabel.swift
Created April 4, 2023 11:08
An animatable label with push text animation which can either be used from storyboard or programatically.
//
// UIAnimatableLabel.swift
//
// Created by Abhishek Maurya on 04/04/23.
//
import UIKit
// MARK: - UIAnimatableLabel
final class UIAnimatableLabel: UILabel {
@pawan-preet
pawan-preet / AutolayoutHelper.swift
Last active August 5, 2019 11:19
Helper Class to ease Constraints when adding Programatically.
//
// AutolayoutHelper.swift
//
// Created by Pawan on 30/07/19.
// Copyright © 2019 Pawan. All rights reserved.
//
import Foundation
view.subviews.compactMap({ $0 as? UITextField }).forEach { textfield in
if let text = textfield.text, text.isEmpty {
textfield.backgroundColor = .yellow // highlight
} else {
textfield.backgroundColor = .white // default
}
}
@netgfx
netgfx / AudioPlayer.swift
Created February 23, 2018 21:26
A basic audio player with observers and extra features. Based on AVFoundation and AVQueuePlayer
//
// AudioPlayer.swift
//
// Created by MDobekidis
//
import Foundation
import AVFoundation
import UIKit
import Signals
@JadenGeller
JadenGeller / Matrix Examples.swift
Last active August 10, 2023 10:03
Matrices in Swift
// Numerical matrix examples
let x: Matrix = [[10, 9, 8], [3, 2, 1]]
let y: Matrix = [[1, 2, 3], [4, 5, 6]]
let z: Matrix = [[1, 2], [3, 4], [5, 6]]
x + y // [[11, 11, 11], [7, 7, 7]]
x * y // [[10, 18, 24], [12, 10, 6]]
2 * x // [[20, 18, 16], [6, 4, 2]]
y ** z // [[22, 28], [49, 64]]