Skip to content

Commit

Permalink
update pods
Browse files Browse the repository at this point in the history
  • Loading branch information
lovemo committed Mar 2, 2016
1 parent b86b9a5 commit ac758c5
Show file tree
Hide file tree
Showing 123 changed files with 9,649 additions and 192 deletions.
Binary file modified SUIMVVMDemo/.DS_Store
Binary file not shown.
476 changes: 476 additions & 0 deletions SUIMVVMDemo/SUIMVVMDemo.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Binary file added SUIMVVMDemo/SUIMVVMDemo/SUIMVVMKit/.DS_Store
Binary file not shown.
23 changes: 23 additions & 0 deletions SUIMVVMDemo/SUIMVVMDemo/SUIMVVMKit/SUIMVVMKit.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//
// BQMVVM.h
// MVVMFramework
//
// Created by yuantao on 16/1/21.
// Copyright © 2016年 momo. All rights reserved.
//

#ifndef BQMVVM_h
#define BQMVVM_h

#import "MVVMBaseViewModel.h"
#import "MVVMBaseViewManger.h"
#import "MVVMTableDataDelegate.h"
#import "MVVMCollectionDataDelegate.H"
#import "MVVMExtend.h"
#import "MVVMConstant.h"
#import "MVVMSingleton.h"
#import "SUIUtils.h"
#import "UITableView+FDTemplateLayoutCell.h"
#import "PMKVObserver.h"

#endif /* BQMVVM_h */
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// MVVMBaseViewManger.h
// SUIMVVMDemo
//
// Created by yuantao on 16/2/22.
// Copyright © 2016年 lovemo. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "MVVMViewMangerProtocol.h"

@interface MVVMBaseViewManger : NSObject <MVVMViewMangerProtocol>

/** 用于传递数据的基模型 */
@property (nonatomic, strong) NSObject *vm_model;

@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// MVVMBaseViewManger.m
// SUIMVVMDemo
//
// Created by yuantao on 16/2/22.
// Copyright © 2016年 lovemo. All rights reserved.
//

#import "MVVMBaseViewManger.h"

@implementation MVVMBaseViewManger

- (instancetype)init {
if (self = [super init]) {
[self vm_handleViewMangerWithSubView:nil];
}
return self;
}

@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//
// MVVMBaseViewModel.h
// DevelopFramework
//
// Created by momo on 15/12/5.
// Copyright © 2015年 teason. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "MVVMViewModelProtocol.h"

@interface MVVMBaseViewModel : NSObject <MVVMViewModelProtocol>

@property (nonatomic, weak) UIViewController *viewController;
@property (nonatomic, strong) NSMutableArray *dataArrayList;

+ (instancetype)vm_modelWithViewController:(UIViewController *)viewController;

/**
* 用来判断是否加载成功,方便外部根据不同需求处理 (外部使用)
*/
- (void)vm_getDataSuccessHandler:(void (^)( ))successHandler;

@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
//
// MVVMBaseViewModel.m
// DevelopFramework
//
// Created by momo on 15/12/5.
// Copyright © 2015年 teason. All rights reserved.
//

#import "MVVMBaseViewModel.h"

@implementation MVVMBaseViewModel

/**
* 懒加载存放请求到的数据数组
*/
- (NSMutableArray *)dataArrayList {
if (_dataArrayList == nil) {
_dataArrayList = [NSMutableArray array];
}
return _dataArrayList;
}

+ (instancetype)vm_modelWithViewController:(UIViewController *)viewController{
MVVMBaseViewModel *model = self.new;
if (model) {
model.viewController = viewController;
}
return model;
}

- (void)vm_getDataSuccessHandler:(void (^)())successHandler {

}

- (NSString *)description{
return [NSString stringWithFormat:@"View model:%@ viewController:%@",
super.description,
self.viewController.description
];
}

@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// MVVMConstant.h
// SUIMVVMDemo
//
// Created by yuantao on 16/2/29.
// Copyright © 2016年 lovemo. All rights reserved.
//

#ifndef MVVMConstant_h
#define MVVMConstant_h

// 过期提醒
#define MVVMDeprecated(instead) NS_DEPRECATED(2_0, 2_0, 2_0, 2_0, instead)

#endif /* MVVMConstant_h */
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// .h文件
#define MVVMSingletonH(name) + (instancetype)shared##name;

// .m文件
#if __has_feature(objc_arc)

#define MVVMSingletonM(name) \
static id _instace; \
\
+ (id)allocWithZone:(struct _NSZone *)zone \
{ \
static dispatch_once_t onceToken; \
dispatch_once(&onceToken, ^{ \
_instace = [super allocWithZone:zone]; \
}); \
return _instace; \
} \
\
+ (instancetype)shared##name \
{ \
static dispatch_once_t onceToken; \
dispatch_once(&onceToken, ^{ \
_instace = [[self alloc] init]; \
}); \
return _instace; \
} \
\
- (id)copyWithZone:(NSZone *)zone \
{ \
return _instace; \
}

#else

#define MVVMSingletonM(name) \
static id _instace; \
\
+ (id)allocWithZone:(struct _NSZone *)zone \
{ \
static dispatch_once_t onceToken; \
dispatch_once(&onceToken, ^{ \
_instace = [super allocWithZone:zone]; \
}); \
return _instace; \
} \
\
+ (instancetype)shared##name \
{ \
static dispatch_once_t onceToken; \
dispatch_once(&onceToken, ^{ \
_instace = [[self alloc] init]; \
}); \
return _instace; \
} \
\
- (id)copyWithZone:(NSZone *)zone \
{ \
return _instace; \
} \
\
- (oneway void)release { } \
- (id)retain { return self; } \
- (NSUInteger)retainCount { return 1;} \
- (id)autorelease { return self;}

#endif
Binary file not shown.
18 changes: 18 additions & 0 deletions SUIMVVMDemo/SUIMVVMDemo/SUIMVVMKit/SUIMVVMKit/Extend/MVVMExtend.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// MVVMExtend.h
// SUIMVVMDemo
//
// Created by yuantao on 16/2/22.
// Copyright © 2016年 lovemo. All rights reserved.
//

#ifndef MVVMExtend_h
#define MVVMExtend_h

#import "UIView+Configure.h"
#import "UICollectionView+CollectionDataDelegateAdditions.h"
#import "UICollectionViewCell+Extension.h"
#import "UITableView+TableDataDelegateAdditions.h"
#import "UITableViewCell+Extension.h"

#endif /* MVVMExtend_h */
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// UICollectionView+CollectionDataDelegateAdditions.h
// MVVMFramework
//
// Created by zzZ on 16/1/8.
// Copyright © 2016年 momo. All rights reserved.
//

#import <UIKit/UIKit.h>
@class MVVMCollectionDataDelegate;

NS_ASSUME_NONNULL_BEGIN

@interface UICollectionView (CollectionDataDelegateAdditions)

@property (nullable,nonatomic,strong) MVVMCollectionDataDelegate *collectionHander;

@end

NS_ASSUME_NONNULL_END
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//
// UICollectionView+CollectionDataDelegateAdditions.m
// MVVMFramework
//
// Created by zzZ on 16/1/8.
// Copyright © 2016年 momo. All rights reserved.
//

#import "UICollectionView+CollectionDataDelegateAdditions.h"
#import "MVVMCollectionDataDelegate.h"
#import <objc/runtime.h>

@implementation UICollectionView (CollectionDataDelegateAdditions)


- (MVVMCollectionDataDelegate *)collectionHander
{
return objc_getAssociatedObject(self, _cmd);
}
- (void)setCollectionHander:(MVVMCollectionDataDelegate *)collectionHander
{
if (collectionHander) {
[collectionHander handleCollectionViewDatasourceAndDelegate:self];
}
objc_setAssociatedObject(self, @selector(collectionHander), collectionHander, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}


@end

Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//
// UITableViewCell+Extension.h
// DevelopFramework
//
// Created by momo on 15/12/16.
// Copyright © 2015年 teason. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface UICollectionViewCell (Extension)

/**
* 从nib文件中根据重用标识符注册UICollectionViewcell
*/
+ (void)registerCollect:(UICollectionView *)table
nibIdentifier:(NSString *)identifier ;
/**
* 配置UICollectionViewcell,设置UICollectionViewcell内容
*/
- (void)configure:(UICollectionViewCell *)cell
customObj:(id)obj
indexPath:(NSIndexPath *)indexPath ;
/**
* 获取自定义对象的cell高度
*/
+ (CGFloat)getCellHeightWithCustomObj:(id)obj
indexPath:(NSIndexPath *)indexPath ;

@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
//
// UITableViewCell+Extension.m
// DevelopFramework
//
// Created by momo on 15/12/16.
// Copyright © 2015年 teason. All rights reserved.
//

#import "UICollectionViewCell+Extension.h"

@implementation UICollectionViewCell (Extension)

#pragma mark --
+ (UINib *)nibWithIdentifier:(NSString *)identifier
{
return [UINib nibWithNibName:identifier bundle:nil];
}

#pragma mark - Public
+ (void)registerCollect:(UICollectionView *)collect
nibIdentifier:(NSString *)identifier
{
[collect registerNib:[self nibWithIdentifier:identifier] forCellWithReuseIdentifier:identifier];

}

#pragma mark --
#pragma mark - Rewrite these func in SubClass !
- (void)configure:(UICollectionViewCell *)cell
customObj:(id)obj
indexPath:(NSIndexPath *)indexPath
{
// Rewrite this func in SubClass !

}

+ (CGFloat)getCellHeightWithCustomObj:(id)obj
indexPath:(NSIndexPath *)indexPath
{
// Rewrite this func in SubClass if necessary
if (!obj) {
return 0.0f ; // if obj is null .
}
return 44.0f ; // default cell height
}

@end
Loading

0 comments on commit ac758c5

Please sign in to comment.