Skip to content

Instantly share code, notes, and snippets.

View shawn-frank's full-sized avatar

Shawn Frank shawn-frank

View GitHub Profile
@shawn-frank
shawn-frank / OverlapViewController.swift
Created April 9, 2022 10:40
This is a small example created that demonstrates the use of a custom UICollectionViewFlowLayout to create cells that overlap each other. This demo was created in response to this StackOverflow question: https://stackoverflow.com/q/71784968/1619193
//
// OverlapViewController.swift
// TestApp
//
// Created by Shawn Frank on 09/04/2022.
//
import UIKit
class OverlapViewController: UIViewController {
@shawn-frank
shawn-frank / TableScrollVC.swift
Created March 23, 2022 12:55
This is a paging example using UITableView with local data when the user scrolls to the end of the list. This example is for iOS using Swift and was created as an answer for this stack overflow question: https://stackoverflow.com/q/71574920/1619193
//
// TableScrollVC.swift
// TestApp
//
// Created by Shawn Frank on 23/03/2022.
//
import UIKit
class TableScrollVC: UITableViewController {
@shawn-frank
shawn-frank / SegmentCollectionViewVC.swift
Created March 22, 2022 10:56
This is an example of using a UICollectionView to create a custom segment control. This example shows a strategy to resize a UILabel's font so that it fits within the frame provided. This sample code is for iOS using Swift and was created in response to this stack overflow question: https://stackoverflow.com/q/71566815/1619193
//
// SegmentCollectionViewVC.swift
// TestApp
//
// Created by Shawn Frank on 22/03/2022.
//
import UIKit
fileprivate class SegmentCell: UICollectionViewCell {
@shawn-frank
shawn-frank / CustomLayoutVC.swift
Created March 21, 2022 17:03
This is an example of creating a custom UICollectionViewFlowLayout with a decoration view in order to give each section a border for iOS using Swift. This was in response to this stack overflow question: https://stackoverflow.com/questions/71552265/is-there-a-way-to-give-outer-border-in-every-section-of-uicollctionview?noredirect=1#comment126463…
//
// CustomLayoutVC.swift
// TestApp
//
// Created by Shawn Frank on 21/03/2022.
//
import UIKit
// This is used as the header and footer of each section
@shawn-frank
shawn-frank / SwipeCollectionView.swift
Created March 18, 2022 10:30
A small example of using a UIPanGestureRecognizer to swipe up and bring a UICollectionView interaction. This was created as a demo to this StackOverflow question: https://stackoverflow.com/q/71304657/1619193
//
// SwipeCollectionView.swift
// TestApp
//
// Created by Shawn Frank on 01/03/2022.
//
import UIKit
class SwipeCollectionView: UIViewController
@shawn-frank
shawn-frank / UnderlineString.playground
Last active March 7, 2022 03:23
This is a playground example of how to underline text that occurs a specified number of times in response to this stack overflow question: https://stackoverflow.com/q/71359204/1619193
import UIKit
struct MatchProperty
{
// Stores the index of the iCor array the current
// word belongs to
var iCorRIndex: Int
// Stores the index of the sentence in the which the word
// was encountered in the current iCor array
@shawn-frank
shawn-frank / NewsTableViewVC.swift
Created February 16, 2022 17:39
Set up a UITableView to get the default animation when working with a UISearchController like seen in the Apple iOS News app
//
// NewsTableViewVC.swift
// TestApp
//
// Created by Shawn Frank on 16/02/2022.
//
import UIKit
fileprivate class CustomCell: UITableViewCell
@shawn-frank
shawn-frank / InputViewController.swift
Created February 16, 2022 17:01
A UITableView with editable UITextFields in UITableView cells that change based on the value of another
//
// InputViewController.swift
// TestApp
//
// Created by Shawn Frank on 30/01/2022.
//
import UIKit
// Your model to store data in text fields
// REF: https://stackoverflow.com/a/62787968/1619193
private func configureNavBar() {
navigationBar.standardAppearance.backgroundColor = UIColor.clear
navigationBar.standardAppearance.backgroundEffect = nil
navigationBar.standardAppearance.shadowImage = UIImage()
navigationBar.standardAppearance.shadowColor = .clear
navigationBar.standardAppearance.backgroundImage = UIImage()
}
private func configureNavBar2() {
@shawn-frank
shawn-frank / UITableViewHeader.swift
Last active February 8, 2023 00:45
UITableViewHeader
//
// UITableViewHeaderSectionView.swift
// Site Visit
//
// Created by Shawn Frank on 10/06/2021.
//
import UIKit
class UITableViewHeaderSectionView: UITableViewHeaderFooterView {