Skip to content

Instantly share code, notes, and snippets.

View thomsmed's full-sized avatar
:octocat:
✌️😎

Thomas Asheim Smedmann thomsmed

:octocat:
✌️😎
View GitHub Profile
@thomsmed
thomsmed / FullScreenTransitionManager.swift
Last active December 20, 2021 15:44
FullScreenTransitionManager.swift - From "Transition images to full screen animated" @ medium.com
//
// FullScreenTransitionManager.swift
//
import Foundation
import UIKit
final class FullScreenTransitionManager: NSObject, UIViewControllerTransitioningDelegate {
private let anchorViewTag: Int
private weak var anchorView: UIView?
@thomsmed
thomsmed / FullScreenAnimationController.swift
Created December 19, 2021 23:09
FullScreenAnimationController.swift - From "Transition images to full screen animated" @ medium.com
//
// FullScreenAnimationController.swift
//
import Foundation
import UIKit
import TinyConstraints
final class FullScreenAnimationController: NSObject, UIViewControllerAnimatedTransitioning {
fileprivate enum AnimationType {
@thomsmed
thomsmed / TableViewController.swift
Last active December 20, 2021 15:58
TableViewController.swift - From "Transition images to full screen animated" @ medium.com
//
// TableViewController.swift
//
import UIKit
typealias Octocat = (name: String, imagePath: String)
extension String {
func capitalizeFirstLetter() -> String {
@thomsmed
thomsmed / TableViewCell.swift
Created December 20, 2021 15:50
TableViewCell.swift - From "Transition images to full screen animated" @ medium.com
//
// TableViewCell.swift
//
import UIKit
import TinyConstraints
class TableViewCell: UITableViewCell {
private let octocatNameLabel: UILabel = {
let label = UILabel()
@thomsmed
thomsmed / FullScreenImageViewController.swift
Created December 20, 2021 16:07
FullScreenImageViewController.swift (no zooming) - From "Transition images to full screen animated" @ medium.com
//
// FullScreenImageViewController.swift
//
import UIKit
import TinyConstraints
class FullScreenImageViewController: UIViewController {
private let octocatImageView: UIImageView = {
let imageView = UIImageView()
@thomsmed
thomsmed / FullScreenImageViewController.swift
Created December 20, 2021 17:27
FullScreenImageViewController.swift (with zooming) - From "Transition images to full screen animated" @ medium.com
//
// FullScreenImageViewController.swift
//
import UIKit
import TinyConstraints
class FullScreenImageViewController: UIViewController {
private let scrollView: UIScrollView = {
let scrollView = UIScrollView()
@thomsmed
thomsmed / StretchyTableHeaderView.swift
Last active December 20, 2021 22:17
StretchyTableHeaderView.swift - From "Stretchy table view header" @ medium.com
//
// StretchyTableHeaderView.swift
//
import Foundation
import UIKit
import TinyConstraints
class StretchyTableHeaderView: UIView {
internal let contentView: UIView = {
@thomsmed
thomsmed / OctocatTableHeaderView.swift
Last active December 20, 2021 21:31
OctocatTableHeaderView.swift - From "Stretchy table view header" @ medium.com
//
// OctocatTableHeaderView.swift
//
import Foundation
import UIKit
class OctocatTableHeaderView: StretchyTableHeaderView {
// UITableView.tableHeaderView needs a defined height: https://developer.apple.com/documentation/uikit/uitableview/1614904-tableheaderview
@thomsmed
thomsmed / TableViewController.swift
Last active December 20, 2021 21:31
TableViewController.swift - From "Stretchy table view header" @ medium.com
//
// TableViewController.swift
//
import UIKit
typealias Octocat = (name: String, imagePath: String)
extension String {
func capitalizeFirstLetter() -> String {
@thomsmed
thomsmed / printKeychainItems.swift
Created December 30, 2021 10:29
Print all available keychain items (iOS, iPadOS, macOS, watchOS, tvOS)
//
// printKeychainItems.swift
//
import Security
enum SecClass: String, CaseIterable {
// Available keychain item classes:
// https://developer.apple.com/documentation/security/keychain_services/keychain_items/item_class_keys_and_values#1678477