Skip to content

Instantly share code, notes, and snippets.

Alex Persian alexpersian

Block or report user

Report or block alexpersian

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View DVDScene3.swift
// Update is called once per frame
public override func update(_ currentTime: TimeInterval) {
// Collect a reference frame for the node's current position
let currentFrame = dvdNode.calculateAccumulatedFrame()
// Top bound
if currentFrame.maxY >= self.frame.maxY {
moveTransform.ty = -1.0
dvdNode.run(changeColor)
}
View DVDScene2.swift
// ...
private var changeColor: SKAction {
return SKAction.colorize(with: UIColor.generateRandomColor(), colorBlendFactor: 1.0, duration: 0)
}
// ...
private func setup() {
addChild(dvdNode)
View UIColor+Random.swift
extension UIColor {
static func generateRandomColor() -> UIColor {
let hue = CGFloat(arc4random() % 256) / 256 // use 256 to get full range from 0.0 to 1.0
return UIColor(hue: hue, saturation: 1, brightness: 1, alpha: 1) // Max saturation, max brightness
}
}
View DVDScene1.swift
import SpriteKit
public class DVDScene: SKScene {
private let dvdNode: SKNode
public init(node: SKNode, size: CGSize) {
self.dvdNode = node
super.init(size: size)
setup()
View DVDLogo.swift
import SpriteKit
import PlaygroundSupport
let viewFrame = CGRect(x: 0, y: 0, width: 400, height: 400)
let view = SKView(frame: viewFrame)
let dvdNode = SKSpriteNode(imageNamed: "dvd-logo.png")
dvdNode.size = CGSize(width: 100, height: 47)
let mainScene = SKScene(size: view.frame.size)
View ThreeFunctions.swift
func requestFirstData() {
firstly {
firstPromise()
}.done { data in
self.process(content: data)
}.catch { error in
print("Error: ", error.localizedDescription)
}
}
View ThenFailure.swift
firstly {
firstPromise()
}.then { data in
// This is just passing the data down the chain
return secondPromise()
}.then { data in
// and doesn't do what I was looking for.
return thirdPromise()
}.done { data in
self.process(data)
View TriplePromiseWhen.swift
firstly {
// Execute all promises simultaneously
when(fulfilled: firstPromise(), secondPromise(), thirdPromise())
}.done { first, second, third in
// Once they all complete, data will be available here
let newData = [first, second, third].flatMap { return $0 }
process(newData)
}.catch { error in
print("Error: ", error.localizedDescription)
}
View gist:e6ab115dc12f3d48eee0e7f27dfb567d

Update on ERROR ITMS-90502: "Invalid Bundle. Apps that only contain the arm64 slice must also have 'arm64' in the list of UIRequiredDeviceCapabilities in Info.plist."

This looks to be an issue with armv7 / armv7s architecture flags hanging around after a project has been transitioned to arm64 only. The UIRequiredDeviceCapabilities flag for arm64 previously was enough to block 32bit installs, but Apple must have silently changed their criteria yesterday to enforce that explicitly across all proj files within a bundle. Our main project had fully transitioned to 64bit, but an internal SDK proj and our Pods proj still had armv7/armv7s flags.

Adding this to the podfile was enough to fix the issue:

post_install do |installer|
  installer.pods_project.build_configurations.each do |config|
View gist:906207d6f8a30ab3acdf378ee0b4d258
0 swift 0x00000001091b242a PrintStackTraceSignalHandler(void*) + 42
1 swift 0x00000001091b1866 SignalHandler(int) + 662
2 libsystem_platform.dylib 0x00007fffe4997b3a _sigtramp + 26
3 libsystem_platform.dylib 0x00007fc27734e530 _sigtramp + 2459658768
4 swift 0x0000000106d12225 swift::NominalTypeDecl::hasFixedLayout() const + 21
5 swift 0x00000001068a5f41 (anonymous namespace)::LowerType::visitAnyStructType(swift::CanType, swift::StructDecl*) + 49
6 swift 0x00000001068a4cd7 swift::Lowering::TypeConverter::getTypeLowering(swift::Lowering::AbstractionPattern, swift::Type) + 2791
7 swift 0x00000001063ff076 (anonymous namespace)::RValueEmitter::emitForceValue(swift::SILLocation, swift::Expr*, unsigned int, swift::Lowering::SGFContext) + 2342
8 swift 0x00000001063ed13d swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void
You can’t perform that action at this time.