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
public struct LoginUserData { | |
public var userId: String? = "" | |
public var userName: String? = "" | |
public var email: String? = "" | |
public var gender: Int = 0 | |
public var birthday: String? = "" | |
public var about: String? = "" | |
public var photoUrl: String? = "" | |
public var idToken: String? = "" | |
public var accessToken: String? = "" |
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 Foundation | |
import AuthenticationServices | |
@available(iOS 13.0, *) | |
open class AppleSignInManager: NSObject { | |
static let shared: AppleSignInManager = AppleSignInManager() | |
var userData: LoginUserData? = nil | |
var isShareImageVideo: Bool = false |
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
// | |
// RecordAudio.swift | |
// | |
// This is a Swift class (updated for Swift 5) | |
// that uses the iOS RemoteIO Audio Unit | |
// to record audio input samples, | |
// (should be instantiated as a singleton object.) | |
// | |
// Created by Ronald Nicholson on 10/21/16. | |
// Copyright © 2017,2019 HotPaw Productions. All rights reserved. |
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 Foundation | |
import AVFoundation | |
import ReplayKit | |
class RPScreenWriter { | |
// Write video | |
var videoOutputURL: URL | |
var videoWriter: AVAssetWriter? | |
var videoInput: AVAssetWriterInput? | |
// Write audio |
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
// 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 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 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 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 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 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] | |
} |
NewerOlder