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
| func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { | |
| guard let cell = tableView.cellForRow(at: indexPath) as? FilmTableViewCell else { return } | |
| var film = selectedAuteur.films[indexPath.row] | |
| film.isExpanded = !film.isExpanded | |
| selectedAuteur.films[indexPath.row] = film | |
| cell.moreInfoTextView.text = film.isExpanded ? film.plot : moreInfoText | |
| cell.moreInfoTextView.textAlignment = film.isExpanded ? .left : .center | |
| cell.moreInfoTextView.textColor = film.isExpanded ? UIColor(red:0.75, green:0.75, blue:0.75, alpha:1.0) : .red | |
| tableView.beginUpdates() | |
| tableView.endUpdates() |
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
| protocol ProtoA { | |
| func helloA() | |
| } | |
| protocol ProtoB : ProtoA { | |
| func helloB() | |
| } | |
| infix operator >>> | |
| func >>> <T: ProtoA>(left: T, right: Int) { |
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
| var z = 0 | |
| let s = AnyIterator { () -> Int in | |
| defer { z += 1 } | |
| return z | |
| } | |
| for i in s.lazy.prefix(3) { | |
| print(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
| infix operator >>> : MultiplicationPrecedence | |
| func >>> <A, B, C>(f: @escaping (A) -> B, | |
| g: @escaping (B) -> C) -> (A) -> C { | |
| return { g(f($0)) } | |
| } | |
| func incr(_ x: Int) -> Int { return x + 1 } | |
| func square(_ x: Int) -> Int { return x * x } |
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
| struct KeyboardWillShowPayload { | |
| let endFrame: CGRect | |
| init(userInfo: [AnyHashable: Any]) { | |
| endFrame = userInfo[UIKeyboardFrameEndUserInfoKey] as! CGRect | |
| } | |
| } | |
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 UIView { | |
| public func fadeTransit(duration: TimeInterval = 0.2) { | |
| let transition = CATransition() <- { | |
| $0.duration = duration | |
| $0.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut) | |
| $0.type = kCATransitionFade | |
| } | |
| self.layer.add(transition, forKey: 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
| private func strokedRoundImage(fromImage image: UIImage?, | |
| size: CGSize, | |
| color: UIColor, | |
| lineWidth: CGFloat = 1.0) -> UIImage? { | |
| UIGraphicsBeginImageContextWithOptions(size, false, 0.0) | |
| defer { UIGraphicsEndImageContext() } | |
| let innerRect = CGRect(x: 1.0, y: 1.0, width: size.width - 2.0, height: size.height - 2.0) | |
| image?.draw(in: innerRect) |
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
| class AsyncImageView: UIView { | |
| private var _image: UIImage? | |
| var image: UIImage? { | |
| get { | |
| return _image | |
| } | |
| set { |
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
| kdebug_signpost_start(10, 0, 0, 0, 0) | |
| // your test code | |
| kdebug_signpost_end(10, 0, 0, 0, 0) | |
| let urlSession = URLSession.shared | |
| let dlTask: URLSessionDownloadTask = urlSession.downloadTask(with: url) | |
| kdebug_signpost_start(20, (uintptr_t)dlTask, 0, 0, 0) | |
| // your test code | |
| kdebug_signpost_end(20, (uintptr_t)dlTask, 0, 0, 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
| file="${PROJECT_DIR}/Confidential/env.plist" | |
| if [ -f $file ] | |
| then | |
| echo "env.plist found." | |
| FABRIC_SECRET=$(/usr/libexec/PlistBuddy -c "Print :FabricSecret" $file) | |
| FABRIC_API_KEY=$(/usr/libexec/PlistBuddy -c "Print :Fabric:APIKey" "${PROJECT_DIR}/Potatso/Info.plist") | |
| else | |
| echo "env.plist not found." | |
| FABRIC_SECRET="fake secret" | |
| FABRIC_API_KEY="0000000000000000000000000000000000000000" |
NewerOlder