• Stars
    star
    193
  • Rank 201,081 (Top 4 %)
  • Language
    Objective-C
  • Created over 9 years ago
  • Updated over 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

GCD Interface Encapsulation.

GCD-Program

需要swift版本GCD的请移步-swift版本GCD

//
//  ViewController.m
//  GCD
//
//  Created by YouXianMing on 15/10/19.
//  Copyright © 2015年 ZiPeiYi. All rights reserved.
//

#import "ViewController.h"
#import "GCD.h"

@interface ViewController ()

@property (nonatomic, strong) GCDTimer *timer;

@end

@implementation ViewController

- (void)viewDidLoad {
    
    [super viewDidLoad];
    
    [GCDQueue executeInGlobalQueue:^{
        
        // download task, etc
        
        [GCDQueue executeInMainQueue:^{
            
            // update UI
        }];
    }];
    
    
    
    
    // init group
    GCDGroup *group = [GCDGroup new];
    
    // add to group
    [[GCDQueue globalQueue] execute:^{
        // task one
    } inGroup:group];
    
    // add to group
    [[GCDQueue globalQueue] execute:^{
        // task two
    } inGroup:group];
    
    // notify in mainQueue
    [[GCDQueue mainQueue] notify:^{
        // task three
    } inGroup:group];
    
    
    
    
    // init timer
    self.timer = [[GCDTimer alloc] initInQueue:[GCDQueue mainQueue]];
    
    // timer event
    [self.timer event:^{
        // task
    } timeInterval:NSEC_PER_SEC * 3];
    
    // start timer
    [self.timer start];
    
    
    
    
    // init semaphore
    GCDSemaphore *semaphore = [GCDSemaphore new];
    
    // wait
    [GCDQueue executeInGlobalQueue:^{
        
        [semaphore wait];
        // todo sth else
    }];
    
    // signal
    [GCDQueue executeInGlobalQueue:^{
        
        // do sth
        [semaphore signal];
    }];
}

@end

More Repositories

1

Animations

The Animation Collection.
Objective-C
2,898
star
2

YoCelsius

A weather app that uses animation to give you an at-a-glance look at the weather.
Objective-C
2,877
star
3

iOS-Design-Patterns

iOS Design pattern collection.
Objective-C
588
star
4

Swift-Animations

The Swift Animation Collection.
Swift
258
star
5

UI-Component-Collection

Personal UI Component Collection.
Objective-C
115
star
6

ViewControllersTransition

The ViewControllers Transition Example.
Objective-C
104
star
7

Tween-o-Matic-CN

汉化了Tween-o-Matic,用于查看CAMediaTimingFunction的效果。
Objective-C
103
star
8

UIImageBlur

Add the blur effect to UIImage.
Objective-C
89
star
9

iOS-General-Tools

个人开发常用工具
Objective-C
57
star
10

EasingAnimation

Used for Easing animation
C
55
star
11

WriteStories

Objective-C
53
star
12

StatusBarMessage

在statusBar上面做渐变动画效果
Objective-C
51
star
13

iOS-Project-Examples

iOS Project Examples.
HTML
44
star
14

Networking-Encapsulation

抽象层遵循依赖倒置原则,实现层遵循迪米特法则,便于后续无缝升级AFNetworking版本,目前兼容AFNetworking2.x与AFNetworking3.x系列.
Objective-C
40
star
15

Swift-GCD

Swift GCD Interface Encapsulation.
Swift
27
star
16

StringAttribute

简易的富文本封装
Objective-C
15
star
17

Xcode-Themes

Xcode主题
Shell
12
star
18

YxmGCD

Objective-C中GCD的封装
Objective-C
10
star
19

Networking

针对AFNetworking网络请求的封装
Objective-C
10
star
20

flutter_canvas

Examples of use flutter canvas.
Dart
9
star
21

Create-Swift-JSON-Model

Create models from JSON data.
Swift
8
star
22

CSS-Animations

CSS
8
star
23

Create-JSON-Model

用于创建 JSON Model 的 mac 程序
Objective-C
8
star
24

AuthorizationManager

Objective-C
8
star
25

FaceDetection

脸部识别简单示例
Objective-C
7
star
26

flutter_project_pkg

A flutter base libs package, used in company's project.
Dart
7
star
27

CreateModelFromJson

Objective-C
6
star
28

flutter_projects

Personal use.
Dart
6
star
29

QiuShiBaiKeText

糗事百科文本数据抓取
Python
4
star
30

BeautifulSoup4-WebCralwer

WebCralwer
HTML
4
star
31

POP-Animation

非CocoaPods版本的POP
Objective-C++
3
star
32

cnblogsTitleGetter

根据给定的账号名抓取该账号所有的文章标题以及文章链接地址
Python
2
star
33

FileManager

文件扫描
Python
2
star
34

SwiftProject

Swift
2
star
35

NSOperationExample

NSOperation使用示例
Objective-C
2
star
36

Personal-Repository-Collections

1
star
37

Java-Studies

Java
1
star
38

Java-Web-Study

Java
1
star
39

Network

Python
1
star