Skip to content

Instantly share code, notes, and snippets.

View thejohnlima's full-sized avatar
:octocat:

John Lima thejohnlima

:octocat:
View GitHub Profile
@thejohnlima
thejohnlima / Fastfile
Last active December 31, 2022 01:14
CI fastlane script
# This file contains the fastlane.tools configuration
# You can find the documentation at https://docs.fastlane.tools
default_platform(:ios)
platform :ios do
before_all do |lane|
sh "sh ./prepare_files.sh"
sh "sh ./prepare_simulators.sh"
sh("bundle install; bundle exec pod install")
@thejohnlima
thejohnlima / HapticFeeback.md
Last active March 11, 2022 13:27
Implements haptic feedback as a View extension in SwiftUI

The hapticFeedback function can be used like in the following view file, just calling it in the button action and the haptic feedback will be fired when the button is tapped.

close_button_view

@thejohnlima
thejohnlima / Font+Extensions.swift
Created March 5, 2022 21:49
Extensions to help using custom fonts in SwiftUI and UIKit
import SwiftUI
import UIKit
/// Custom fonts
enum CustomFont: String {
case primary = "Topsicle"
case secondary = "SpaceAndAstronomy"
case tertiary = "Velezodiac"
}
@thejohnlima
thejohnlima / UIStoryboard+Extensions.swift
Created March 5, 2022 21:28
Extensions to help on UIStoryboard files configurations
import UIKit
extension UIStoryboard {
// MARK: - Enums
/// All the storyboards files names should be added here.
/// **Important info:** Under the identity inspector on storyboard file, the storyboard id be the class name.
///
/// **Example**
/// - `profile` represents the storyboard file *Profile.storyboard*
@thejohnlima
thejohnlima / UIAlertController+Extensions.swift
Created March 5, 2022 20:47
Extensions to help on UIAlertController implementation
import UIKit
extension UIAlertController {
struct Settings {
var title: String?
var message: String?
var style: UIAlertController.Style = .alert
var interfaceStyle: UIUserInterfaceStyle?
var actions: [Action] = [Action()]
var target: UIViewController?
@thejohnlima
thejohnlima / UICollectionView+Extensions.swift
Created March 5, 2022 20:11
Extensions to help on UICollectionView implementation
import UIKit
extension UICollectionView {
/// Register cell
/// - Parameter cell: Cell to be registered
public func register(_ cell: UICollectionViewCell.Type) {
let nib = UINib(nibName: cell.identifier, bundle: nil)
register(nib, forCellWithReuseIdentifier: cell.identifier)
}
@thejohnlima
thejohnlima / UITableView+Extensions.swift
Last active February 2, 2023 00:10
Extensions to help on UITableView implementation
import UIKit
extension NSObject {
public var identifier: String {
String(describing: type(of: self))
}
public static var identifier: String {
String(describing: self)
}
@thejohnlima
thejohnlima / FairPlayer.swift
Created February 18, 2022 18:04 — forked from fousa/FairPlayer.swift
Integrate HLS with FairPlay.
class FairPlayer: AVPlayer {
private let queue = DispatchQueue(label: "com.icapps.fairplay.queue")
func play(asset: AVURLAsset) {
// Set the resource loader delegate to this class. The `resourceLoader`'s delegate will be
// triggered when FairPlay handling is required.
asset.resourceLoader.setDelegate(self, queue: queue)
// Load the asset in the player.
@thejohnlima
thejohnlima / AppDelegate.swift
Last active July 11, 2020 19:17
StoryKitManager is a helper for subscription purchase
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
let storeManager = StoreKitManager()
var window: UIWindow?
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
storeManager.setup()
@thejohnlima
thejohnlima / homebrew-permissions-issue.md
Created October 5, 2019 22:44 — forked from irazasyed/homebrew-permissions-issue.md
Homebrew: Permissions Denied Issue Fix (OS X / macOS)

Homebrew Permissions Denied Issues Solution

sudo chown -R $(whoami) $(brew --prefix)/*