This file contains hidden or 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
// add the following code in to info.plist | |
<key>CFBundleURLTypes</key> | |
<array> | |
<dict> | |
<key>CFBundleURLSchemes</key> | |
<array> | |
<string>fb1801381186770425</string> | |
</array> | |
</dict> | |
</array> |
This file contains hidden or 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
// facebook login in swift 3.0 | |
// the following code into info.plist | |
<key>CFBundleURLTypes</key> | |
<array> | |
<dict> | |
<key>CFBundleURLSchemes</key> | |
<array> |
This file contains hidden or 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
// add text field in alert view controller | |
UIAlertController * alertController = [UIAlertController alertControllerWithTitle: @"Login" | |
message: @"Input username and password" | |
preferredStyle:UIAlertControllerStyleAlert]; | |
[alertController addTextFieldWithConfigurationHandler:^(UITextField *textField) { | |
textField.placeholder = @"name"; | |
textField.textColor = [UIColor blueColor]; | |
textField.clearButtonMode = UITextFieldViewModeWhileEditing; | |
textField.borderStyle = UITextBorderStyleRoundedRect; |
This file contains hidden or 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
// | |
// WebService.swift | |
// ArtCaller | |
// | |
// Created by Twistfuture on 6/9/15. | |
// Copyright (c) 2015 Twist. All rights reserved. | |
// | |
import Foundation | |
import UIKit |
This file contains hidden or 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
// add the following code in app delegate | |
import UserNotifications | |
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { | |
// Override point for customization after application launch. | |
if #available(iOS 10.0, *) { | |
let center = UNUserNotificationCenter.current() | |
center.requestAuthorization(options: [.alert, .sound]) { (granted, error) in | |
// Enable or disable features based on authorization. | |
} | |
} else { |
This file contains hidden or 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
func checkPhotoLibraryPermission() { | |
let status = PHPhotoLibrary.authorizationStatus() | |
switch status { | |
case .authorized: | |
self.GetGalleryImage() | |
break | |
//handle authorized status | |
case .denied, .restricted : break | |
//handle denied status |
This file contains hidden or 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
// call the delegate on button click | |
// call following delegate into your view controller | |
//GIDSignInUIDelegate,GIDSignInDelegate | |
// register your app and download the googleservices-info.plist | |
GIDSignIn.sharedInstance().uiDelegate = self | |
GIDSignIn.sharedInstance().clientID = "58108526797-sen1e9fq0gnlicnkhb6krmflva86ie1k.apps.googleusercontent.com" |
This file contains hidden or 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
// rotate imageview via 90 degree | |
myview.transform = CGAffineTransform(rotationAngle: CGFloat.pi / 2) | |
// rotate imageview via 180 degree | |
myview.transform = CGAffineTransform(rotationAngle: CGFloat.pi) | |
// rotate imageview via 270 degree | |
myview.transform = CGAffineTransform(rotationAngle: -CGFloat.pi / 2) | |
// totate iamge | |
func imageRotatedByDegrees(oldImage: UIImage,degrees: CGFloat) -> UIImage { | |
let size = oldImage.size |
This file contains hidden or 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
let clientID = "aef611af2a1e4806a7de8c0aca13daac" | |
let redirect_uri = "https://www.twistfuture.com/" | |
let getAccessToken = "https://api.instagram.com/oauth/authorize/?client_id=\(clientID)&redirect_uri=\(redirect_uri)&response_type=token" | |
self.InstagramWebViewLogin.loadRequest(NSURLRequest(url: NSURL(string:getAccessToken as String)! as URL) as URLRequest) |
This file contains hidden or 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
// swift code 3.0 | |
func downloadImage(url: URL) | |
{ | |
print("Download Started \(url)") | |
getDataFromUrl(url: url) { (data, response, error) in | |
guard let data = data, error == nil else { return } | |
//print(response?.suggestedFilename) | |
print(url.lastPathComponent) | |