Skip to content

Instantly share code, notes, and snippets.

@roblav96
Created September 9, 2016 06:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save roblav96/09bdd052deae9d9aa12c6dd2854cad5f to your computer and use it in GitHub Desktop.
Save roblav96/09bdd052deae9d9aa12c6dd2854cad5f to your computer and use it in GitHub Desktop.
How do I work with delegates?
declare class SSZipArchive extends NSObject {
static alloc(): SSZipArchive; // inherited from NSObject
static createZipFileAtPathWithContentsOfDirectory(path: string, directoryPath: string): boolean;
static createZipFileAtPathWithContentsOfDirectoryKeepParentDirectory(path: string, directoryPath: string, keepParentDirectory: boolean): boolean;
static createZipFileAtPathWithContentsOfDirectoryKeepParentDirectoryWithPassword(path: string, directoryPath: string, keepParentDirectory: boolean, password: string): boolean;
static createZipFileAtPathWithContentsOfDirectoryWithPassword(path: string, directoryPath: string, password: string): boolean;
static createZipFileAtPathWithFilesAtPaths(path: string, paths: NSArray): boolean;
static createZipFileAtPathWithFilesAtPathsWithPassword(path: string, paths: NSArray, password: string): boolean;
static isFilePasswordProtectedAtPath(path: string): boolean;
static new(): SSZipArchive; // inherited from NSObject
static unzipFileAtPathToDestination(path: string, destination: string): boolean;
static unzipFileAtPathToDestinationDelegate(path: string, destination: string, delegate: SSZipArchiveDelegate): boolean;
static unzipFileAtPathToDestinationOverwritePasswordError(path: string, destination: string, overwrite: boolean, password: string): boolean;
static unzipFileAtPathToDestinationOverwritePasswordErrorDelegate(path: string, destination: string, overwrite: boolean, password: string, error: interop.Pointer | interop.Reference<NSError>, delegate: SSZipArchiveDelegate): boolean;
static unzipFileAtPathToDestinationOverwritePasswordProgressHandlerCompletionHandler(path: string, destination: string, overwrite: boolean, password: string, progressHandler: (p1: string, p2: unz_file_info, p3: number, p4: number) => void, completionHandler: (p1: string, p2: boolean, p3: NSError) => void): boolean;
static unzipFileAtPathToDestinationPreserveAttributesOverwritePasswordErrorDelegate(path: string, destination: string, preserveAttributes: boolean, overwrite: boolean, password: string, error: interop.Pointer | interop.Reference<NSError>, delegate: SSZipArchiveDelegate): boolean;
static unzipFileAtPathToDestinationProgressHandlerCompletionHandler(path: string, destination: string, progressHandler: (p1: string, p2: unz_file_info, p3: number, p4: number) => void, completionHandler: (p1: string, p2: boolean, p3: NSError) => void): boolean;
/* readonly */ close: boolean;
/* readonly */ open: boolean;
constructor(o: { path: string; });
initWithPath(path: string): this;
writeDataFilenameWithPassword(data: NSData, filename: string, password: string): boolean;
writeFileAtPathWithFileNameWithPassword(path: string, fileName: string, password: string): boolean;
writeFileWithPassword(path: string, password: string): boolean;
writeFolderAtPathWithFolderNameWithPassword(path: string, folderName: string, password: string): boolean;
}
interface SSZipArchiveDelegate extends NSObjectProtocol {
zipArchiveDidUnzipArchiveAtPathZipInfoUnzippedPath?(path: string, zipInfo: unz_global_info, unzippedPath: string): void;
zipArchiveDidUnzipArchiveFileEntryPathDestPath?(zipFile: string, entryPath: string, destPath: string): void;
zipArchiveDidUnzipFileAtIndexTotalFilesArchivePathFileInfo?(fileIndex: number, totalFiles: number, archivePath: string, fileInfo: unz_file_info): void;
zipArchiveDidUnzipFileAtIndexTotalFilesArchivePathUnzippedFilePath?(fileIndex: number, totalFiles: number, archivePath: string, unzippedFilePath: string): void;
zipArchiveProgressEventTotal?(loaded: number, total: number): void;
zipArchiveShouldUnzipFileAtIndexTotalFilesArchivePathFileInfo?(fileIndex: number, totalFiles: number, archivePath: string, fileInfo: unz_file_info): boolean;
zipArchiveWillUnzipArchiveAtPathZipInfo?(path: string, zipInfo: unz_global_info): void;
zipArchiveWillUnzipFileAtIndexTotalFilesArchivePathFileInfo?(fileIndex: number, totalFiles: number, archivePath: string, fileInfo: unz_file_info): void;
}
declare var SSZipArchiveDelegate: {
prototype: SSZipArchiveDelegate;
};
declare var SSZipArchiveVersionNumber: number;
declare var SSZipArchiveVersionString: interop.Reference<number>;
declare var ZipArchiveVersionNumber: number;
declare var ZipArchiveVersionString: interop.Reference<number>;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment