This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#->Usage: launch_ipa.sh <PATH.app> [DEVICE_TYPE] [IOS_RUNTIME] | |
#-> | |
#-> Create a new simulator, install the app in it, launch it, wait 20s then kill it. | |
#-> The main purpose of this script is to just launch an app and let the applicationDidFinishLaunching… callback be called | |
#-> | |
#-> - [DEVICE_TYPE] the model of simulator to use. See `xcrun simctl list devicetypes` for the full list. Defaults to 'iPhone-6s' | |
#-> Note: You just need to provide the last part of the full device ID from | |
#-> com.apple.CoreSimulator.SimDeviceType.<DEVICE_TYPE> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Coordinator.swift | |
import Foundation | |
public protocol Coordinator: class { | |
var components: CoordinatorComponents { get } | |
/// Set up here everything that needs to happen just before the Coordinator is presented | |
/// | |
/// - Parameter modalSetup: A parameter you can use to customize the default mainViewController's |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func json(from dict: [String: Any]) -> String { | |
let jsonData = try! JSONSerialization.data(withJSONObject: dict, options: []) | |
let str = String(data: jsonData, encoding: .utf8)! | |
return str | |
} | |
struct Product { | |
var price: Double | |
var quantity: Int |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//#! Swift 5 | |
import Foundation | |
import AppKit | |
//////////////////////////////////////////////////////////////////// | |
//: ## Type Definition | |
struct AttrString { | |
let attributedString: NSAttributedString |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
//: ## Option 1: A Failable type for each item | |
//: In practice, it's very similar to the concept of the "Result" type that you see in most code bases (and that will be integrated in Swift 5), so if you already have a Result type, you might just want to use it instead, but if not, this is a super-simplification of it | |
enum Failable<T>: CustomStringConvertible { | |
case success(T) | |
case failure(Error) | |
var description: String { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'tmpdir' | |
require 'open3' | |
# The first parameter is supposed to be the path to the markdown file | |
input_file = ARGV.first | |
config_file = ARGV[1] || '.swiftlint.yml' | |
config_param = File.exist?(config_file) ? " --config #{File.realpath(config_file)}" : '' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
class CopyLabel : UILabel { | |
// MARK: Setup | |
override init(frame: CGRect) { | |
super.init(frame: frame) | |
configureMenu() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
let json = """ | |
{ | |
"data": { | |
"items": [ | |
{ "name": "Alice" }, | |
{ "name": "Bob" }, | |
{ "name": "Claudia" } | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension Mirror { | |
/// Use this to help you implement a custom debugDescription listing all properties of your instances | |
/// | |
/// - Parameters: | |
/// - subject: The instance for which to return the description. | |
/// | |
/// Example usage: | |
/// | |
/// extension MyType: CustomDebugStringConvertible { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
####################################### | |
# Check that some Build Settings (those defined by VERSION_SETTINGS below) are set on the right level (target/project) | |
####################################### | |
VERSION_SETTINGS = %w(GLOBAL_APP_VERSION GLOBAL_APP_BUILD_VERSION) | |
require 'xcodeproj' | |
project = Xcodeproj::Project.open('YOUR_PROJECT_NAME.xcodeproj') | |
target = project.targets.find("YOUR_TARGET_NAME").first | |
target.build_configurations.each do |bc| | |
## Don't allow some build settings at target level (but only at project level) |