xcode-select --print-path
xcodebuild -version
swift --version
swift build --version
pkgutil --pkg-info=com.apple.pkg.CLTools_Executables | grep version // Check Xcode Command-Line-Tools Version
This file contains 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 UIKit | |
/// View controller, that publishes events for it's `view`'s lifecycle, | |
/// and allows type safe access to it's main `UIView`. | |
class ObservableViewController<V: UIView>: UIViewController { | |
typealias LifecycleEvent = (view: V, animated: Bool) | |
/// Broadcasts event after the controller's view is loaded, e.g. `viewDidLoad()`. |
This file contains 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
// Define callback blocks | |
// Success | |
__block typeof (self) weakSelf = self; | |
void (^successBlock)(NSURLRequest *, NSHTTPURLResponse *, UIImage *) = | |
^(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image) { | |
// Assigning an image that has not yet been decoded leads | |
// to stuttering in UI animations | |
// Forcing image decoding on a background thread fixes this | |
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0), ^(void) { |
You can constrain the content, the UIStackView
, to the contentLayoutGuide
top, bottom, leading, and trailing to define the scrollable area. You can then constrain the UIStackView
’s width to the frameLayoutGuide
so that it only scrolls vertically. That’s it—your content can now scroll as it shrinks or grows!
final class SomeView: UIView {
This file contains 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
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath { | |
// setup initial state (e.g. before animation) | |
cell.layer.shadowColor = [[UIColor blackColor] CGColor]; | |
cell.layer.shadowOffset = CGSizeMake(10, 10); | |
cell.alpha = 0; | |
cell.layer.transform = CATransform3DMakeScale(0.5, 0.5, 0.5); | |
cell.layer.anchorPoint = CGPointMake(0, 0.5); | |
// define final state (e.g. after animation) & commit animation | |
[UIView beginAnimations:@"scaleTableViewCellAnimationID" context:NULL]; |
This file contains 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
# install ffmpeg | |
brew install ffmpeg | |
# convert .mov file to .mp4 | |
ffmpeg -i demo.mov -vcodec h264 demo.mp4 |
This file contains 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 | |
import UIKit | |
import Combine | |
import PlaygroundSupport | |
/// The `ScopedReceivePublisher` modifies any returned `Publisher` property of `V` to receive | |
/// published elements on the specified `Scheduler`. | |
/// | |
/// Usage: | |
/// ``` |
NewerOlder