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
// For Pass Valid Parameters & number of Images in Array in Image Upload Function | |
var dicImgData : NSMutableDictionary? = NSMutableDictionary() | |
if let img = UIImage(named: "Your Image") { | |
if let data:Data = UIImagePNGRepresentation(img) { | |
var imageData : NSData = data | |
dicImgData! .setObject(imageData, forKey: "data" as NSCopying) | |
dicImgData! .setObject("file", forKey: "name" as NSCopying) | |
dicImgData! .setObject("file.png", forKey: "fileName" as NSCopying) |
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
import UIKit | |
public protocol ContainerViewControllerDelegate { | |
func outerScrollViewShouldScroll() -> Bool | |
} | |
public class BaseScrollViewController: UIViewController, UIScrollViewDelegate { | |
public var topVc: UIViewController? | |
public var leftVc: UIViewController! |
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
import UIKit | |
import GoogleMobileAds | |
//MARK: - Google Ads Unit ID | |
struct GoogleAdsUnitID { | |
//Google Test Unit ID | |
struct Test { | |
static var strBannerAdsID = "ca-app-pub-XXXXXXXXXXXXXXXX/XXXXXXXXXXX" | |
static var strInterstitialAdsID = "ca-app-pub-XXXXXXXXXXXXXXXX/XXXXXXXXXXX" |
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 uploadGoogleURL(imageName: String,contents : String,parentsFolderId : String?) { | |
self.showProgressHUD(viewController: self, title: "uploadImage".localize(), subtitle: "") | |
let metadata = GTLRDrive_File.init() | |
metadata.name = imageName | |
if parentsFolderId != nil | |
{ | |
let folderId: String = parentsFolderId! | |
metadata.parents = [folderId] | |
} |
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
#import <Foundation/Foundation.h> | |
typedef NS_OPTIONS(NSInteger, APITask){ | |
Login = 0, | |
Register = 1 | |
}; | |
@interface APIManager : NSObject |
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
class ViewController: UIViewController { | |
@IBOutlet weak var label: UILabel! | |
var count = 0 | |
@IBAction func doAction(_ sender: UIButton) { | |
// This will fade: | |
label.fadeTransition(0.4) | |
count += 1 | |
label.text = "\(count)" |
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
enum StatusShape:Int { | |
case Rectangle | |
case Triangle | |
case Circle | |
} | |
// Programmatically: use the enum | |
var shape:StatusShape = .Rectangle | |
// IB: use the adapter |
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
extension UIImage { | |
enum CompressImageErrors: Error { | |
case invalidExSize | |
case sizeImpossibleToReach | |
} | |
func compressImage(_ expectedSizeKb: Int, completion : (UIImage,CGFloat) -> Void ) throws { | |
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
// Media is a video | |
let videoUrl = "Your URL FILE" as! NSURL | |
let asset = AVAsset(url: videoUrl as URL) | |
let first: CMTimeRange = CMTimeRange.init(start: kCMTimeZero, duration: CMTime.init(seconds: 2, preferredTimescale: asset.duration.timescale)) | |
let firstScael: CMTime = CMTimeMakeWithSeconds((Float64(2) * Float64(5)), asset.duration.timescale) | |
let second: CMTimeRange = CMTimeRange.init(start: CMTime.init(seconds: 5, preferredTimescale: asset.duration.timescale), duration: CMTime.init(seconds: 5, preferredTimescale: asset.duration.timescale)) | |
let secondScael: CMTime = CMTimeMakeWithSeconds((Float64(5) / Float64(5.0)), asset.duration.timescale) | |
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
import Foundation | |
import AVFoundation | |
import ReplayKit | |
class RPScreenWriter { | |
// Write video | |
var videoOutputURL: URL | |
var videoWriter: AVAssetWriter? | |
var videoInput: AVAssetWriterInput? | |
// Write audio |