This file contains hidden or 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
- cache-push: | |
inputs: | |
- cache_paths: |- | |
# 記得把註解拿掉,bitrise 不會忽略註解,會造成路徑錯誤 | |
$GEM_CACHE_PATH -> ./.ruby-version # 官方文件的環境變數 | |
./vendor -> ./Gemfile.lock # 當 gemfile lock 有變化時,更新 ./vendor 底下的 cache |
This file contains hidden or 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
- script@1: | |
title: Bundle Install | |
inputs: | |
- content: |- | |
bundle i |
This file contains hidden or 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
// | |
// NetworkRequest.swift | |
// | |
// Created by David on 2020/5/31. | |
// Copyright © 2020 David. All rights reserved. | |
// | |
import Alamofire | |
public struct NetworkRequest<Response: Decodable> { |
This file contains hidden or 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
// | |
// DetectDevice.swift | |
// DetectDevice | |
// | |
// Created by David on 2020/5/21. | |
// Copyright © 2020 David Lin. All rights reserved. | |
// | |
import UIKit | |
import CoreTelephony |
This file contains hidden or 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 | |
struct Foobar<T: Equatable> { | |
let value: T | |
let count: Int | |
} | |
extension Collection { | |
func sumOfCounts<T>(where predicate: (T) -> Bool) -> Int where Element == Foobar<T> { | |
reduce(0, { $0 + (predicate($1.value) ? $1.count : 0) }) |
This file contains hidden or 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
// Created by Marcin Krzyzanowski | |
import Foundation | |
public protocol JSONEncodable: Encodable { } | |
public extension JSONEncodable { | |
func toJSON(using encoder: @autoclosure () -> JSONEncoder = JSONEncoder()) throws -> String { | |
try String(decoding: encoder().encode(self), as: UTF8.self) | |
} |
This file contains hidden or 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
// | |
// UIImageView+Unsplash.swift | |
// Created by David on 2019/12/9. | |
// | |
import UIKit.UIImageView | |
import Kingfisher | |
/// check api doc: https://source.unsplash.com/ | |
fileprivate let randomUnsplashImageURL = "https://source.unsplash.com/random" |
This file contains hidden or 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
UIImage(named: "Cross", in: <ANY_BUNDLE>, compatibleWith: nil) |
This file contains hidden or 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
internal struct WrappedBundleImage: _ExpressibleByImageLiteral { | |
let image: UIImage? | |
init(imageLiteralResourceName name: String) { | |
image = UIImage(named: name, in: <ANY_BUNDLE>, compatibleWith: nil) | |
} | |
} | |
extension UIImage { | |
static func fromWrappedBundleImage(_ wrappedImage: WrappedBundleImage) -> UIImage? { |
This file contains hidden or 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
fileprivate class ThisClass {} | |
public struct Resources { | |
public static var testBundle: Bundle { | |
let path = Bundle(for: ThisClass.self).resourcePath! + "/ThisIsATestBundle.bundle" | |
return Bundle(path: path)! | |
} | |
} |