title: How to enumerate over an ALAssetsGroup in Swift
body: <p>I tried my best, but i got stuck in here. I wanted to import all photos from iPhone camera album. So i come up with this ALAssestsLibrary API.</p>
  
  <pre><code> photoLibrary.enumerateGroupsWithTypes(ALAssetsGroupType(ALAssetsGroupSavedPhotos), usingBlock: { group  in
          if group != nil
  
          {
  
          }
  
          }, failureBlock: { error in println("\(error)")})
  </code></pre>
  
  <p>how to add this line of code.</p>
  
  <pre><code>group enumerateAssetsUsingBlock:groupEnumerAtion
  </code></pre>
  
  <p>I tried adding this but it does not showing any enumerateAssetsUsingBlock property.?</p>
  
  <p>This is the actual code. !! In Objective-C</p>
  
  <pre><code>    dispatch_async(dispatch_get_main_queue(), ^
          {
              @autoreleasepool
              {
                  ALAssetsLibraryAccessFailureBlock failureblock = ^(NSError *myerror)
                      {
                          NSLog(@"error occour =%@", [myerror localizedDescription]);
                  };
  
                  ALAssetsGroupEnumerationResultsBlock groupEnumerAtion = ^(ALAsset *result, NSUInteger index, BOOL *stop)
                      {
                          if (result!=NULL)
                          {
                              if ([[result valueForProperty:ALAssetPropertyType] isEqualToString:ALAssetTypePhoto])
                              {
                                  [self.g_imageArray addObject:result];
                              }
                          }
                  };
  
                  ALAssetsLibraryGroupsEnumerationResultsBlock
                  libraryGroupsEnumeration = ^(ALAssetsGroup* group, BOOL* stop)
                      {
                          if (group == nil)
                          {
                              return;
                          }
  
                          if (group!=nil) {
                              [group enumerateAssetsUsingBlock:groupEnumerAtion];
                          }
                          [self updatephotoList];
                  };
  
                  self.library = [[ALAssetsLibrary alloc] init];
                  [self.library enumerateGroupsWithTypes:ALAssetsGroupSavedPhotos
                  usingBlock:libraryGroupsEnumeration 
                  failureBlock:failureblock];
              }
          });
  </code></pre>