internal extension Color {
// Assets.xcassets
static var midnightBlue : Color { Color("midnightBlue", bundle: BundleToken.bundle) }
}
internal extension Image {
// Assets.xcassets
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
// Given array of 2-tuples, return two arrays | |
func unzip<T, U>(array: [(T, U)]) -> ([T], [U]) { | |
var t = Array<T>() | |
var u = Array<U>() | |
for (a, b) in array { | |
t.append(a) | |
u.append(b) | |
} | |
return (t, u) | |
} |
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
#! /usr/bin/env sh | |
firstTag=$(git tag | sort -r | head -1) | |
secondTag=$(git tag | sort -r | head -2 | awk '{split($0, tags, "\n")} END {print tags[1]}') | |
echo "Changes between ${secondTag} and ${firstTag}\n" | |
git log --pretty=format:' * %s' ${secondTag}..${firstTag} |
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
#!/usr/bin/env bash | |
# This script installs brew and chowns the right directories needed to run | |
# brew as a standard user. Your user should be the owner of /usr/local which | |
# gets set during the installation of brew. The global homebrew cache directory | |
# group should be set to 'staff' which is not set during a brew install. This | |
# script fixes that. | |
# To begin, you MUST execute this script with your user account while it has | |
# admin privileges. Once the script completes, you can change your |
This notes is written by Sheldon. You can find me with #iOSBySheldon in Github, Youtube, Facebook, etc.
Convert .mov/.MP4 to .gif
As a developer, I feel better to upload a short video when I create the pull request to show other viewers what I did in this PR. I tried .mov format directly got after finishing recording screen using Quicktime, however, gif offers preview in most web pages, and has smaller file size.
This is not limited to developer, anyone has this need can use this method to convert the files.
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 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
mr Marathi | |
bs Bosnian | |
ee_TG Ewe (Togo) | |
ms Malay | |
kam_KE Kamba (Kenya) | |
mt Maltese | |
ha Hausa | |
es_HN Spanish (Honduras) | |
ml_IN Malayalam (India) | |
ro_MD Romanian (Moldova) |
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 SwiftUI | |
public struct FormattedTextField<Formatter: TextFieldFormatter>: View { | |
public init(_ title: String, | |
value: Binding<Formatter.Value>, | |
formatter: Formatter) { | |
self.title = title | |
self.value = value | |
self.formatter = formatter | |
} |
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 Combine | |
/** | |
An observable, mutable property. | |
Replays the current value when subscribed. | |
*/ | |
@propertyWrapper | |
struct Published<Output>: Publisher { | |
typealias Failure = Never |
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 Combine | |
import Foundation | |
extension NSObjectProtocol where Self: NSObject { | |
/// Assigns each unique element assigned to the key paths specified to the inverse object. | |
func bidirectionallyAssign<Value: Equatable, B: NSObject>( | |
from firstKeyPath: ReferenceWritableKeyPath<Self, Value>, | |
to secondKeyPath: ReferenceWritableKeyPath<B, Value>, | |
on otherObject: B | |
) -> [AnyCancellable] { |
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
extension Publisher where Self.Failure == Never { | |
public func assignNoRetain<Root>(to keyPath: ReferenceWritableKeyPath<Root, Self.Output>, on object: Root) -> AnyCancellable where Root: AnyObject { | |
sink { [weak object] (value) in | |
object?[keyPath: keyPath] = value | |
} | |
} | |
} |