private func comparableAttributes<T, U:Equatable>(first f:T, second s:T)->(T->U) -> U?{
return { trans in
let x = trans(f)
let y = trans(s)
return (x == y) ? nil : x
}
}
If i do this it doesnt work...
private func comparableAttributes<T, U:Equatable>(first f:T, second s:T)->(T->U) -> U?{
return { trans in
let x = trans(f)
let y = trans(s)
return (x == y) ? nil : x
}
}
If i do this it doesnt work...
###Subject: isEqual to replace == Equatable Requirement
Hi all,
I would like to propose changing the Equatable protocol to use isEqual(to:Self) -> Bool
, defined inside of a type to replace the currently used operator ==
function, which is defined outside of the type.
###Reasoning:
let arr = [1,2,3,4] | |
func & <T>(lhs:Array<T>,rhs:[Int]) -> T?{ | |
guard let index = rhs.first else{ | |
print("no index!") | |
return nil | |
} | |
if index < 0{ | |
print("negative index") |
enum ListError: ErrorType { | |
case Empty | |
case Unknown | |
} | |
extension CollectionType { | |
typealias Elem = Self.Generator.Element | |
Try writing this with both an option field and a hanging animation closure, with no completion...
UIView.animateWithDuration(0.2, delay: 0, options: .CurveEaseOut, animations: {
///DO ANIMATION STUFF
}, completion: nil)
I should beable to do this
#todo sudoku ui | |
from sudoku_engine import Board | |
from guizero import App, PushButton | |
class SudView: | |
board_code = None | |
board_solution = None | |
app_ref = None |
<>, both not included in range, | |
<=>, both included | |
<==, left not included, | |
==> right not included | |
infix operator <> {} | |
infix operator <=> {} | |
infix operator ==> {} | |
infix operator <== {} |
// Single tab item view | |
struct TabItemView: View { | |
// @State private var isSelected: Bool | |
let imgName: String | |
let title: String | |
let isSelected: Bool | |
let action:()->Void | |
init(img:String, title:String, isSelected:Bool=false, action: @escaping ()->Void={}) { | |
self.imgName = img |
import Foundation | |
import UIKit | |
extension UIButton { | |
func setImage(named: String) { | |
if let image = UIImage(named: named) { | |
self.setImage(image, for: .normal) | |
} | |
} | |
} |