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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>A Beginner Dartpad- enigmatic7earth</title> | |
<script defer src="main.dart.js"></script> | |
</head> | |
<body> | |
<p id="Sample"> | |
Sample paragraph. |
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
// | |
// Reachability.swift | |
// | |
// | |
// Created by NETBIZ on 12/10/18. | |
// Copyright © 2018 Netbiz.in. All rights reserved. | |
// | |
import Foundation |
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
@IBAction func aboutTapped(_ sender: UIBarButtonItem) { | |
let storyboard = UIStoryboard.init(name: "Main", bundle: nil) | |
let vc = storyboard.instantiateViewController(withIdentifier: "aboutPopover") | |
vc.modalPresentationStyle = UIModalPresentationStyle.popover | |
let popvc = vc.popoverPresentationController | |
popvc?.delegate = self | |
popvc?.permittedArrowDirections = UIPopoverArrowDirection.any | |
popvc?.barButtonItem = sender | |
vc.preferredContentSize = CGSize.init(width: 300, height: 300) | |
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
// the alert view | |
let alert = UIAlertController(title: "", message: "alert disappears after 5 seconds", preferredStyle: .alert) | |
self.present(alert, animated: true, completion: nil) | |
// change to desired number of seconds (in this case 5 seconds) | |
let when = DispatchTime.now() + 5 | |
DispatchQueue.main.asyncAfter(deadline: when){ | |
// your code with delay | |
alert.dismiss(animated: true, completion: nil) | |
} |
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
// Just call this funtion by passing to it the **required** view to which you wish to draw a user's attention. | |
func shake(viewToShake: UIView){ | |
let colorAnimation = CABasicAnimation(keyPath: "borderColor") | |
colorAnimation.fromValue = UIColor.red.cgColor | |
colorAnimation.toValue = UIColor.lightGray.cgColor | |
viewToShake.layer.borderColor = UIColor.lightGray.cgColor | |
viewToShake.layer.borderWidth = 1 |
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
-(void) checkForAppUpdate{ | |
BOOL updateAvailable = NO; | |
NSDictionary* infoDictionary = [[NSBundle mainBundle] infoDictionary]; | |
NSString* appID = infoDictionary[@"CFBundleIdentifier"]; | |
NSURL* url = [NSURL URLWithString:[NSString stringWithFormat:@"http://itunes.apple.com/lookup?bundleId=%@", appID]]; | |
NSData* data = [NSData dataWithContentsOfURL:url]; | |
NSDictionary* lookup = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil]; | |
if ([lookup[@"resultCount"] integerValue] == 1){ | |
NSString* appStoreVersion = lookup[@"results"][0][@"version"]; |