What’s new in swift 4.2


Good news: Swift 4.2 is now available in Xcode 10 beta! This release updates important Swift 4.1 features and improves the language in preparation for ABI stability. 1. toggle() for Bool swift propose adding a mutating func toggle to Bool. It toggles the Bool. var isVisible = true print(isVisible.toggle()) // false 2. Adding in-place removeAll(where:) to the Standard Library It is common to want... Continue Reading →

Advertisements

how to fetch all media from device using asset library


Hey use this methods to fetch video and photos from photo gallary in iOS  -(void)getAllVideo {     [queue cancelAllOperations];     queue = [[NSOperationQueue alloc] init];     [queue addOperationWithBlock:^{         //imageArray=[[NSArray alloc] init];         mutableArray =[[NSMutableArray alloc]init];         NSMutableArray* assetURLDictionaries = [[NSMutableArray alloc] init];... Continue Reading →

Common method in Swift


1. Check for any field empty in NSDictionary class func checkforEmptyValueinDictioanty(dic:NSDictionary)-> Bool{ for (keyVal, dataVal) in dic {   if (dataVal.length()==0){                 println("\(keyVal): \(dataVal.length())")                 return false             }                 ... Continue Reading →

Make movie file with picture Array and song file, using AVAsset


-(void) writeImagesToMovieAtPath:(NSString *) path withSize:(CGSize) size { NSString *documentsDirectoryPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]; NSArray *dirContents = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:documentsDirectoryPath error:nil]; for (NSString *tString in dirContents) { if ([tString isEqualToString:@"essai.mp4"]) { [[NSFileManager defaultManager]removeItemAtPath:[NSString stringWithFormat:@"%@/%@",documentsDirectoryPath,tString] error:nil]; } } NSLog(@"Write Started"); NSError *error = nil; AVAssetWriter *videoWriter = [[AVAssetWriter alloc] initWithURL: [NSURL fileURLWithPath:path] fileType:AVFileTypeMPEG4 error:&error]; NSParameterAssert(videoWriter); NSDictionary... Continue Reading →

Blog at WordPress.com.

Up ↑

%d bloggers like this: