Freitag, 30. Juni 2017

IAP with SWIFT

// ------------------------------ PAYMENT CLUSTERF*  ---------------
// HOW TO IMPLEMENT 
    
1. Create and configure products in iTunes Connect.
You can change your products throughout the process, but you need at least
one product configured before you can test any code.
    
2. Get a list of product identifiers, either from the app bundle or your own server. Send that list to the App Store using an instance of SKProductsRequest.
    
3. Implement a user interface for your app’s store, using the instances of SKProduct returned by the App Store. Start with a simple interface during development, such as a table view or a few buttons.
    
4. Implement a final user interface for your app’s store at whatever point makes sense in your development process.
    
5. Request payment by adding an instance of SKPayment to the transaction queue using the addPayment: method of SKPaymentQueue.
    
6. Implement a transaction queue observer, starting with the paymentQueue:updatedTransactions: method.
    
7. Implement the other methods in the SKPaymentTransactionObserver protocol at whatever point makes sense in your development process.
    
8. Deliver the purchased product by making a persistent record of the purchase for future launches, downloading any associated content, and finally calling the finishTransaction: method of SKPaymentQueue.
    
9. During development, you can implement a trivial version of this code at 
first—for example, simply displaying “Product Delivered” on the screen—and 
then implement the real version at whatever point makes sense in your development process.
    
    
// HOW TO TEST

Montag, 19. Juni 2017

identify clicks on 2d overlay

// Sehr  einfach: so filtern wir auch Buttonklicks auf 2D Elemente raus
            let location2d = touch.location(in: overlayScene)
            let hitResult2d = overlayScene.atPoint(location2d)
            if let nname = hitResult2d.name {
                print(nname)

            }

Donnerstag, 4. Mai 2017

subclassing SCNNode and add parameters to the call

class box : SCNNode {

     override init() {
        super.init()
    }
    
    init(x: Float, y: Float) {
        super.init()
        
        // grüner würfel
        let boxmesh = SCNBox(width: 1, height: 1, length:1, chamferRadius: 0 )
        let mat = SCNMaterial()
        mat.diffuse.contents = UIColor(red: 0.3, green: 0.8, blue: 0.3, alpha: 1)
        boxmesh.materials = [mat]
        self.geometry = boxmesh
        self.name = "box"
        self.castsShadow = false
        world.addChildNode(self)
        
        self.position.x = x
        self.position.y = y
    }

    /* Xcode required this */
    required init(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }


}