Creating a custom Combine Publisher to extend UIKit: https://www.avanderlee.com/swift/custom-combine-publisher/
let button = UIButton()
button
.publisher(for: .touchUpInside)
.sink{ control in print("touch up inside")}
<?php | |
// Sets the default categories | |
function add_the_categories() { | |
$categories = array( | |
'Case Study', | |
'Blog', | |
'Article' | |
); | |
foreach( $categories as $category ) { | |
$exists = term_exists( $category, 'category' ); |
import SwiftUI | |
extension Calendar { | |
func generateDates( | |
inside interval: DateInterval, | |
matching components: DateComponents | |
) -> [Date] { | |
var dates: [Date] = [] | |
dates.append(interval.start) |
import Foundation | |
import Combine | |
public func async<T>(_ body: @escaping (Yield<T>) throws -> ()) -> Async<T> { | |
Async(body: body) | |
} | |
public func await<P>(_ publisher: P) throws -> P.Output where P: Publisher { | |
try publisher.await() | |
} |
protocol CaseEquatable { | |
associatedtype Case: Equatable | |
var `case`: Case { get } | |
static func ~=(lhs: Self, rhs: Self) -> Bool | |
} | |
extension CaseEquatable { | |
static func ~=(lhs: Self, rhs: Self) -> Bool { | |
return lhs.case == rhs.case |
Creating a custom Combine Publisher to extend UIKit: https://www.avanderlee.com/swift/custom-combine-publisher/
let button = UIButton()
button
.publisher(for: .touchUpInside)
.sink{ control in print("touch up inside")}
The always enthusiastic and knowledgeable mr. @jasaltvik shared with our team an article on writing (good) Git commit messages: How to Write a Git Commit Message. This excellent article explains why good Git commit messages are important, and explains what constitutes a good commit message. I wholeheartedly agree with what @cbeams writes in his article. (Have you read it yet? If not, go read it now. I'll wait.) It's sensible stuff. So I decided to start following the
import Quick | |
import Nimble | |
class CodableDecimalSpec: QuickSpec { | |
override func spec() { | |
context("encode Model to JSON") { | |
var model: Model! | |
var json: [String: String]? | |
beforeEach { |
import UIKit | |
// Conform the `Polygon` protocol to specify the vertices of the polygon. | |
protocol Polygon { | |
var vertices: [CGPoint] { get } | |
} | |
// UIView conforms the protocol `Polygon` to specified the vertices of the rectangle. | |
extension UIView: Polygon { |
import UIKit | |
import WebKit | |
// Disableing `WKWebView` user zooming by returning `nil` in `UIScrollViewDelegate`'s | |
// `viewForZooming` delegate method. | |
// On iOS 12, the delegate method only called when set the web view itself as the | |
// scroll view delegate. | |
class WebView: WKWebView {} |
import UIKit | |
/// キーボードイベントを監視し、キーボードの開閉に合わせてviewをtransformで上下移動させる | |
final class KeyboardManager { | |
private var view: UIView | |
/// キーボード開閉時に可能なら表示されるように画面スライド位置が調整されるビュー | |
/// 縦長フォームの一番下にあるサブミットボタンみたいなやつを想定 | |
private var subFocusView: UIView? |