Skip to content

Instantly share code, notes, and snippets.

View Coder-ACJHP's full-sized avatar
:bowtie:
Creating buggy programs

Onur Işık Coder-ACJHP

:bowtie:
Creating buggy programs
View GitHub Profile
@Coder-ACJHP
Coder-ACJHP / ImageRippleTransitionViewController.swift
Last active October 24, 2024 07:11
Applying Ripple Transition effect for 2 images using CIFilter and DisplayLink for transition timing, transition starts from user touch location (tested on iOS 12, UIKit)
class ImageRippleTransitionViewController: UIViewController, UIViewControllerTransitioningDelegate {
public let backgroundImageView: UIImageView = {
let imageView = UIImageView()
imageView.contentMode = .scaleAspectFill
imageView.isUserInteractionEnabled = true
imageView.clipsToBounds = true
imageView.translatesAutoresizingMaskIntoConstraints = false
return imageView
}()
@Coder-ACJHP
Coder-ACJHP / CarouselFlowLayout.swift
Last active October 23, 2024 20:20
Android 14 Samsung calendar like carousel collectionView (iOS 12, UIKit) video clip in first comment
class CarouselFlowLayout: UICollectionViewFlowLayout {
let scaleFactor: CGFloat = 0.7 // Minimum scale for side cells
override func prepare() {
super.prepare()
guard let collectionView else { return }
scrollDirection = .horizontal
// Define cell size
itemSize = collectionView.bounds.inset(by: UIEdgeInsets(top: 20, left: 20, bottom: 20, right: 20)).size
@Coder-ACJHP
Coder-ACJHP / StackedItemsViewController.swift
Last active October 23, 2024 20:26
iOS lock screen stacked notifications like stacked views (animated and removable iOS 12, UIKit) video clip in first comment
class StackedItemsViewController: UIViewController {
private let backgroundImageView: UIImageView = {
let image = UIImage(resource: .background)
let imageView = UIImageView(image: image)
imageView.contentMode = .scaleAspectFill
imageView.isUserInteractionEnabled = true
imageView.clipsToBounds = true
imageView.translatesAutoresizingMaskIntoConstraints = false
return imageView
@Coder-ACJHP
Coder-ACJHP / AnimationsTestViewController.swift
Created October 22, 2024 13:12
3DFlipScaleAnimation any UIView using Swift UIKit (tested on iOS 12 and later)
class AnimationsTestViewController: UIViewController {
enum AnimationPosiXDirection {
case left, center, right
}
enum AnimationFlipDirection {
case yAxis, center, xAxis
}
@Coder-ACJHP
Coder-ACJHP / NavBarTestViewController.swift
Last active April 3, 2024 12:38
How to Add a UINavigationBar Without a UINavigationBarController programmatically (supports large title animated also)
class NavBarTestViewController: UIViewController, UINavigationBarDelegate, UIScrollViewDelegate {
private let navBar: UINavigationBar = {
let navBar = UINavigationBar()
navBar.translatesAutoresizingMaskIntoConstraints = false
return navBar
}()
private let vScrollView: UIScrollView = {
let scrollView = UIScrollView(frame: .zero)
@Coder-ACJHP
Coder-ACJHP / PhotoCell.swift
Created October 20, 2023 14:17
Custom PinterestLayout with UIKit iOS 11 (included example usage)
//
// PhotoCell.swift
// TestApp
//
// Created by Coder ACJHP on 20.10.2023.
//
import UIKit
class PhotoCell: UICollectionViewCell {
@Coder-ACJHP
Coder-ACJHP / PositionAnimationByPercentage.swift
Created September 4, 2023 08:13
Move image along UIBezierPath by percentage
fileprivate var circleIcon: UIImageView!
fileprivate var circlePathaAnimation: CAKeyframeAnimation!
// Drawing func that takes x position as an argument
// Call this funtion inside 'drawRect' or 'onTouchMoves'
fileprivate func drawHighlightCircleFromLeftPosition(_ posiX: CGFloat) {
// If imageView and animation already created and existing change percentage
if let circleIcon = self.circleIcon,
let animation = circlePathaAnimation {
@Coder-ACJHP
Coder-ACJHP / Example.swift
Created July 11, 2023 07:42
Read, Update, Delete keys from keychain in swift
// Save into keychain
let nameData = Data(weparents_auth.utf8)
let passwordData = Data(weparents_PI.utf8)
KeychainHelper.shared.save(nameData, service: .userName, account: .account)
KeychainHelper.shared.save(passwordData, service: .password, account: .account)
// Read from keychain
if let nameData = KeychainHelper.shared.read(service: .userName, account: .account),
let passwordData = KeychainHelper.shared.read(service: .password, account: .account),
let nameString = String(data: nameData, encoding: .utf8),
@Coder-ACJHP
Coder-ACJHP / SplitMirror.swift
Last active March 14, 2022 12:17
SplitMirror filter with UIGraphics applied on UIImage
//
// SplitMirror filter.swift
// Image Editor
//
// Created by Coder ACJHP on 25.02.2022.
//
// SnapChat & Tiktok & Motion App like image filter
// Inspired from 'https://support.apple.com/tr-tr/guide/motion/motn169f94ea/mac'
// Splits an image in half vertically and reverses the left remaining half to create a reflection.
@Coder-ACJHP
Coder-ACJHP / CreateVideo.swift
Last active August 26, 2021 06:58
This code creating MPEG4 video with multiple small video parts from given UIImage array and then merging all of video parts into one and save it in user library
@IBAction func onApply(_ sender: Any) {
if selectedAssetInfo.isEmpty {
return
}
var tempVideoURLs: Array<URL> = []
waiting.startAnimating()
waiting.isHidden = false