Skip to content

Instantly share code, notes, and snippets.

@StephenHeaps
StephenHeaps / MPMediaItemEnumerateValuesNullabilityFix.h
Last active August 5, 2018 16:46
Quick fix for enumerateValues(forProperties: block:) returning value as type Any instead of Any? (as a Category on MPMediaItem)
//
// MPMediaItemEnumerateValuesNullabilityFix.h
// Shuffle
//
// Created by Stephen Heaps on 2018-02-13.
// Copyright © 2018 Stephen Heaps. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <MediaPlayer/MediaPlayer.h>
@StephenHeaps
StephenHeaps / Custom Swipe Actions in UITableViewCells
Created June 6, 2017 16:22
iOS 11 added a nice easy way to add Custom Swipe-able Actions in UITableView using the UITableViewDelegate protocol
override func tableView(_ tableView: UITableView, leadingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
let contextItem = UIContextualAction(style: .normal, title: "Leading & .normal") { (contextualAction, view, boolValue) in
print("Leading Action style .normal")
}
let swipeActions = UISwipeActionsConfiguration(actions: [contextItem])
return swipeActions
}
override func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {