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
// | |
// ContentView.swift | |
// Example of using matchedGeometryEffect in iOS 13 code | |
// matchedGeometryEffect example code taken and adapted from : | |
// https://sarunw.com/posts/a-first-look-at-matchedgeometryeffect/ | |
// | |
// Created by Emil Pedersen on 16/10/2020. | |
// | |
struct ContentView: View { |
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 SwiftUI | |
import GoogleMobileAds | |
import UIKit | |
final class Interstitial:NSObject, GADInterstitialDelegate{ | |
var interstitial:GADInterstitial = GADInterstitial(adUnitID: interstitialID) | |
override init() { | |
super.init() | |
LoadInterstitial() |
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
@objc func handlePan(panGesture: UIPanGestureRecognizer) { | |
guard let view = view as? SCNView else { return } | |
let location = panGesture.location(in: self.view) | |
switch panGesture.state { | |
case .began: | |
// existing logic from previous approach. Keep this. | |
guard let hitNodeResult = view.hitTest(location, options: nil).first else { return } | |
panStartZ = CGFloat(view.projectPoint(lastPanLocation!).z) | |
// lastPanLocation is new | |
lastPanLocation = hitNodeResult.worldCoordinates |