Skip to content

Commit

Permalink
viper----Todo
Browse files Browse the repository at this point in the history
viper----Todo
  • Loading branch information
big show committed Dec 7, 2018
1 parent 7d31da4 commit 511e137
Show file tree
Hide file tree
Showing 20 changed files with 582 additions and 27 deletions.
Binary file modified .DS_Store
Binary file not shown.
114 changes: 88 additions & 26 deletions BigShow1949.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// YFToDoBaseViewController.h
// BigShow1949
//
// Created by big show on 2018/12/7.
// Copyright © 2018年 BigShowCompany. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface YFToDoBaseViewController : UIViewController

@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
//
// YFToDoBaseViewController.m
// BigShow1949
//
// Created by big show on 2018/12/7.
// Copyright © 2018年 BigShowCompany. All rights reserved.
//

#import "YFToDoBaseViewController.h"
#import "YFToDoRouter.h"
#import "YFToDoViewController.h"

@interface YFToDoBaseViewController ()

@end

@implementation YFToDoBaseViewController

- (void)viewDidLoad {
[super viewDidLoad];

self.view.backgroundColor = [UIColor whiteColor];

UIButton *redBtn = [[UIButton alloc] initWithFrame:CGRectMake(100, 100, 80, 44)];
[redBtn setTitle:@"Button" forState:UIControlStateNormal];
[redBtn addTarget:self action:@selector(buttonClick) forControlEvents:UIControlEventTouchUpInside];
redBtn.titleLabel.textColor = [UIColor blackColor];
redBtn.backgroundColor = [UIColor blueColor];
[self.view addSubview:redBtn];
}

- (void)buttonClick {
YFToDoViewController *vc = [YFToDoRouter createModule];
[self.navigationController pushViewController:vc animated:YES];
}

/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/

@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// YFToDoInteractor.h
// BigShow1949
//
// Created by big show on 2018/12/7.
// Copyright © 2018年 BigShowCompany. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "YFToDoProtocols.h"
NS_ASSUME_NONNULL_BEGIN
@interface YFToDoInteractor : NSObject<ToDoInteractorInputProtocol>
@property (nonatomic, weak, nullable) id<ToDoInteractorOutputProtocol> output;

@end
NS_ASSUME_NONNULL_END
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//
// YFToDoInteractor.m
// BigShow1949
//
// Created by big show on 2018/12/7.
// Copyright © 2018年 BigShowCompany. All rights reserved.
//

#import "YFToDoInteractor.h"
#import "YFToDoItem.h"

@implementation YFToDoInteractor
#pragma mark - InteractorProtocol

- (void)setOutput:(id<ToDoInteractorOutputProtocol>)output
{
_output = output;
}

- (id<ToDoInteractorOutputProtocol>)getOutputProtocol
{
return self.output;
}

- (void)addToDoItem:(YFToDoItem *)item
{
[self.output sendAddedItem:item];
}
@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// YFToDoItem.h
// BigShow1949
//
// Created by big show on 2018/12/7.
// Copyright © 2018年 BigShowCompany. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface YFToDoItem : NSObject
@property (nonatomic) NSString *text;
@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// YFToDoItem.m
// BigShow1949
//
// Created by big show on 2018/12/7.
// Copyright © 2018年 BigShowCompany. All rights reserved.
//

#import "YFToDoItem.h"

@implementation YFToDoItem

@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//
// YFToDoPresenter.h
// BigShow1949
//
// Created by big show on 2018/12/7.
// Copyright © 2018年 BigShowCompany. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "YFToDoProtocols.h"
#import "YFToDoItem.h"

NS_ASSUME_NONNULL_BEGIN
@interface YFToDoPresenter : NSObject<ToDoInteractorOutputProtocol>
@property (nonatomic, weak, nullable) id<ToDoViewProtocol> view;
@property (nonatomic) id<ToDoInteractorInputProtocol> interactor;
@property (nonatomic, weak) id<ToDoWireframeProtocol> router;

- (instancetype)initWithInterface:(id<ToDoViewProtocol>)interface
interactor:(id<ToDoInteractorInputProtocol>)interactor
router:(id<ToDoWireframeProtocol>)router;
- (void)addToDoItem:(YFToDoItem *)item;
@end
NS_ASSUME_NONNULL_END
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
//
// YFToDoPresenter.m
// BigShow1949
//
// Created by big show on 2018/12/7.
// Copyright © 2018年 BigShowCompany. All rights reserved.
//

#import "YFToDoPresenter.h"

@implementation YFToDoPresenter
- (instancetype)initWithInterface:(id<ToDoViewProtocol>)interface
interactor:(id<ToDoInteractorInputProtocol>)interactor
router:(id<ToDoWireframeProtocol>)router
{
if (self = [super init])
{
self.view = interface;
self.interactor = interactor;
self.router = router;
[self.interactor setOutput:self];
}
return self;
}

- (void)addToDoItem:(YFToDoItem *)item
{
[self.interactor addToDoItem:item];
}


#pragma mark - ToDoInteractorOutputProtocol

- (void)sendAddedItem:(YFToDoItem *)item
{
[self.view showAddedItem:item];
}

@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
//
// YFToDoProtocols.m
//
//
// Created by big show on 2018/12/7.
//

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

#pragma mark - WireFrameProtocol

@protocol ToDoWireframeProtocol <NSObject>

@end

#pragma mark - PresenterProtocol

@protocol ToDoPresenterProtocol <NSObject>

@end

#pragma mark - InteractorProtocol

@protocol ToDoInteractorOutputProtocol <NSObject>

- (void)sendAddedItem:(YFToDoItem *)item;

@end

@protocol ToDoInteractorInputProtocol <NSObject>

- (void)setOutput:(id<ToDoInteractorOutputProtocol>)output;
- (id<ToDoInteractorOutputProtocol>)getOutputProtocol;

- (void)addToDoItem:(YFToDoItem *)item;

@end

#pragma mark - ViewProtocol

@protocol ToDoViewProtocol <NSObject>

- (void)showAddedItem:(YFToDoItem *)item;

@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// YFToDoRouter.h
// BigShow1949
//
// Created by big show on 2018/12/7.
// Copyright © 2018年 BigShowCompany. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "YFToDoProtocols.h"
#import "YFToDoViewController.h"
@interface YFToDoRouter : NSObject<ToDoWireframeProtocol>
@property (nonatomic, weak) YFToDoViewController *viewController;

+ (YFToDoViewController *)createModule;

@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//
// YFToDoRouter.m
// BigShow1949
//
// Created by big show on 2018/12/7.
// Copyright © 2018年 BigShowCompany. All rights reserved.
//

#import "YFToDoRouter.h"
#import "YFToDoViewController.h"
#import "YFToDoInteractor.h"
#import "YFToDoPresenter.h"

@implementation YFToDoRouter
+ (YFToDoViewController *)createModule
{
NSString *viewName = NSStringFromClass([YFToDoViewController class]);
YFToDoViewController *viewController = [[YFToDoViewController alloc] initWithNibName:viewName bundle:nil];
YFToDoInteractor *interactor = [[YFToDoInteractor alloc] init];
YFToDoRouter *router = [[YFToDoRouter alloc] init];
YFToDoPresenter *presenter = [[YFToDoPresenter alloc] initWithInterface:viewController interactor:interactor router:router];
viewController.presenter = presenter;
router.viewController = viewController;
return viewController;
}
@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// YFToDoTableViewCell.h
// BigShow1949
//
// Created by big show on 2018/12/7.
// Copyright © 2018年 BigShowCompany. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface YFToDoTableViewCell : UITableViewCell
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;

@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//
// YFToDoTableViewCell.m
// BigShow1949
//
// Created by big show on 2018/12/7.
// Copyright © 2018年 BigShowCompany. All rights reserved.
//

#import "YFToDoTableViewCell.h"

@implementation YFToDoTableViewCell

- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];

// Configure the view for the selected state
}

@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14113" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="KGk-i7-Jjw" customClass="YFToDoTableViewCell">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
<rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="qPU-GP-Q3g">
<rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstAttribute="trailing" secondItem="qPU-GP-Q3g" secondAttribute="trailing" id="8zX-Qw-abT"/>
<constraint firstAttribute="bottom" secondItem="qPU-GP-Q3g" secondAttribute="bottom" id="FAx-gP-vmp"/>
<constraint firstItem="qPU-GP-Q3g" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" id="nlg-FQ-h8h"/>
<constraint firstItem="qPU-GP-Q3g" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" id="tbR-q3-cKz"/>
</constraints>
</tableViewCellContentView>
<connections>
<outlet property="titleLabel" destination="qPU-GP-Q3g" id="Zl0-bg-ipB"/>
</connections>
<point key="canvasLocation" x="-89" y="108"/>
</tableViewCell>
</objects>
</document>
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// YFToDoViewController.h
// BigShow1949
//
// Created by big show on 2018/12/7.
// Copyright © 2018年 BigShowCompany. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "YFToDoPresenter.h"
#import "YFToDoProtocols.h"

@interface YFToDoViewController : UIViewController<ToDoViewProtocol, UITableViewDelegate, UITableViewDataSource>
@property (weak, nonatomic) IBOutlet UITableView *tableView;
@property (nonatomic, nullable) YFToDoPresenter *presenter;
@end
Loading

0 comments on commit 511e137

Please sign in to comment.