Skip to content

Instantly share code, notes, and snippets.

View marcosgriselli's full-sized avatar

Marcos Griselli marcosgriselli

View GitHub Profile
@marcosgriselli
marcosgriselli / Canvas.swift
Created May 18, 2021 21:09
Simulate side-by-side Xcode Previews
View Canvas.swift
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
PreviewsPlus.Canvas(
content: ContentView(),
previews: [
Preview(device: .iPhoneSE, colorScheme: .light, contentSizeCategory: .extraExtraExtraLarge),
Preview(device: .iPhone12Pro, colorScheme: .dark),
Preview(device: .iPhone12Pro, contentSizeCategory: .accessibilityExtraLarge, layoutDirection: .rightToLeft),
Preview(device: .iPhone12Pro, colorScheme: .dark, contentSizeCategory: .extraSmall, layoutDirection: .rightToLeft)
]
@marcosgriselli
marcosgriselli / ffmpeg-compress-mp4
Created January 19, 2021 12:19 — forked from lukehedger/ffmpeg-compress-mp4
Compress mp4 using FFMPEG
View ffmpeg-compress-mp4
$ ffmpeg -i input.mp4 -vcodec h264 -acodec mp2 output.mp4
View SwiftUI ContentView test
import SwiftUI
struct ContentView: View {
var body: some View {
Text("I work!")
}
}
@marcosgriselli
marcosgriselli / bitrise.yml
Created December 17, 2018 22:41
Bitrise.yml configuration for ViewAnimator
View bitrise.yml
---
format_version: '6'
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git
project_type: fastlane
app:
envs:
- FASTLANE_XCODE_LIST_TIMEOUT: '120'
- opts:
is_expand: false
FASTLANE_WORK_DIR: "."
@marcosgriselli
marcosgriselli / Array + Util.swift
Last active May 17, 2018 15:24
Array utility functions
View Array + Util.swift
import Foundation
// MARK: - Array
public extension Array {
/// Safe subscript for element at index
///
/// - Parameter index: array's index to subscript.
/// - Returns: Optional array element if it exists in that index.
public func item(at index: Int) -> Element? {
@marcosgriselli
marcosgriselli / ViewMorphing.swift
Created May 5, 2018 18:27
Morph a view to another view's via transforms or frame
View ViewMorphing.swift
//
// Morphable.swift
// Morphable
//
// Created by marcosgriselli on 05/05/2018.
// Copyright (c) 2018 marcosgriselli. All rights reserved.
//
import UIKit
@marcosgriselli
marcosgriselli / BasicSearch.swift
Created April 21, 2018 21:39
Basic implementation of a UISearchController reusing the same type of UIViewController as the base and results.
View BasicSearch.swift
import UIKit
protocol Searchable {
func update(text: String?)
}
class BaseSearchResultUpdating: NSObject, UISearchResultsUpdating {
func updateSearchResults(for searchController: UISearchController) {
guard let searchable = searchController.searchResultsController as? Searchable else {
fatalError("The searchResultsController is does not conform to Searchable.")
View ReusableCells.swift
//
// ReusableCells.swift
// ella
//
// Created by Marcos Griselli on 12/17/17.
// Copyright © 2017 Hirsh Group LLC. All rights reserved.
//
import UIKit
@marcosgriselli
marcosgriselli / AudioLoader.swift
Created October 2, 2017 04:21
Play an audio file from resources or .xcassets
View AudioLoader.swift
import AVFoundation
var audioPlayer: AVAudioPlayer?
enum AudioLoader {
case fromResource(URL)
case fromAsset(NSDataAsset)
}
enum AudioLoaderError: Error {
case resourceNotFound
@marcosgriselli
marcosgriselli / UIImageView+URL.swift
Created August 30, 2017 14:44
Bridge between Kingfisher and UIImageView for easy swapping between 3rd party image download libraries
View UIImageView+URL.swift
//
// UIImageView+URL.swift
// marcosgriselli
//
// Created by Marcos Griselli.
// Copyright © 2017 marcosgriselli. All rights reserved.
//
import Kingfisher