Skip to content

Instantly share code, notes, and snippets.

<connections>
<segue destination="knX-Ex-UQZ" kind="custom" identifier="CustomSegue" customClass="MyCustomSegue" customModule="MyCustomSegueSwift" id="52K-D3-Bbt"/>
</connections>
//set the ViewControllers for the animation
let sourceView = self.source.view as UIView!
let destinationView = self.destination.view as UIView!
let window = UIApplication.shared.delegate?.window!
// 1. beloveSubview
window?.insertSubview(destinationView!, belowSubview: sourceView!)
override func perform() {
//set the ViewControllers for the animation
let sourceView = self.source.view as UIView!
let destinationView = self.destination.view as UIView!
let window = UIApplication.shared.delegate?.window!
//set the destination View center
@IBAction func unwindfromSecondView(_ sender: UIStoryboardSegue) {
self.view.backgroundColor! = UIColor.cyan
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
if (colorstring == "purple") {
self.view.backgroundColor! = UIColor.purple
}
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if (segue.identifier! == "CustomSegue") {
//with Navigation Controller
//let navController = segue.destination as! UINavigationController
//let detailController = ((navController.topViewController) as! SecondViewController)
//without NavigationController:
let detailController = (segue.destination as! SecondViewController)
detailController.colorstring = "purple"
}
}
var colorstring = NSString()
let spotiURL = URL(string: "http://www.spotlessicode.com")
UIApplication.shared.open(spotiURL!, options: [:], completionHandler: nil)
[[UIApplication sharedApplication] openURL:spotiURL options:@{} completionHandler:^(BOOL success) {
if (success) {
NSLog(@"Opened url");
}
}];
content.sound = UNNotificationSound.init(named: "sound01.caf")