- List your dependencies in a Cartfile. Refer to the Carthage documentation for details.
- Run
carthage bootstrap --no-build --use-submodules
- Create a new workspace.
- Drag your existing App project into the workspace.
- Drag framework dependency projects from ./Carthage/Checkouts into the workspace.
- Go to the General tab of your target properties.
- Add framework dependencies to Linked Frameworks and Libraries. They will show up as Workspace frameworks.
- Add the same frameworks to Embedded Binaries.
- Note, the previous step will probably create duplicates in Linked Frameworks and Libraries. Delete the duplicates.
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 SwiftUI | |
#if os(macOS) | |
public typealias PlatformViewType = NSView | |
#elseif !os(watchOS) | |
import UIKit | |
public typealias PlatformViewType = UIView | |
#endif | |
#if !os(watchOS) |
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 | |
func mean(_ values: [Float]) -> Float { | |
return sum(values) / Float(values.count) | |
} | |
func median(_ values: [Float]) -> Float { | |
var sorted = values.sorted() | |
guard values.count > 0 else { return 0 } | |
while sorted.count > 2 { |
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
#!/bin/sh | |
# https://superuser.com/questions/436056/how-can-i-get-ffmpeg-to-convert-a-mov-to-a-gif | |
# Requires ffmpeg and ImageMagick | |
INPUT=$1 | |
OUTPUT=$2 | |
TMP=giffer_tmp_$$.gif |
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
class DetailViewController: UIViewController { | |
@IBOutlet var label: UILabel! { | |
didSet { | |
label?.text = episode.title | |
} | |
} | |
let episode: Episode | |
init(episode: Episode) { |
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
struct Foo : CustomStringConvertible { | |
let text:String | |
init(text:String) { | |
self.text = text | |
} | |
var description:String { return self.text } | |
} |
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
/* | |
"WatchKit ignores attempts to set values of interface objects | |
while your interface is inactive.... Modifications can be made | |
only during initialization of your interface controller and | |
between calls to willActivate and [didDeactivate]." | |
*/ | |
class MyWKInterfaceController: WKInterfaceController { | |
private var isActive:Bool = true |
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
// Create CustomView.xib, set File's Owner to CustomView. | |
// Link the top level view in the XIB to the contentView outlet. | |
class CustomView : UIView { | |
@IBOutlet private var contentView:UIView? | |
// other outlets | |
override init(frame: CGRect) { // for using CustomView in code | |
super.init(frame: frame) | |
self.commonInit() |
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
#!/bin/bash | |
theSite="https://developer.apple.com/wwdc/" | |
foo=$(curl $theSite) | |
echo $foo | |
oldFile=$(date +"%Y-%m-%d-%H_%M_%S").start | |
echo "$foo" > $oldFile | |
while true; do |