├── .gitignore
├── 设计图
├── 中介者模式.png
├── 享元模式.png
├── 代理模式.png
├── 单列模式.png
├── 原型模式.png
├── 命令模式.png
├── 备忘录模式.png
├── 外观模式.png
├── 工厂方法模式.png
├── 建造者模式.png
├── 抽象工厂模式.png
├── 桥接模式.png
├── 模板方法模式.png
├── 状态模式.png
├── 策略模式.png
├── 简单工厂模式.png
├── 组合模式.png
├── 装饰模式.jpg
├── 观察者模式.png
├── 解释器模式.png
├── 访问者模式.png
├── 责任链模式.png
├── 迭代器模式.png
└── 适配器模式.png
├── 2策略模式
├── .DS_Store
├── 2策略模式.xcodeproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcuserdata
│ │ │ ├── yifan.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ │ │ └── huangchengdu.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcuserdata
│ │ ├── yifan.xcuserdatad
│ │ └── xcschemes
│ │ │ └── xcschememanagement.plist
│ │ └── huangchengdu.xcuserdatad
│ │ └── xcschemes
│ │ └── xcschememanagement.plist
└── 2策略模式
│ ├── ViewController.h
│ ├── HCDCashNormal.h
│ ├── AppDelegate.h
│ ├── HCDCaseReturn.h
│ ├── HCDCashRobate.h
│ ├── HCDCashNormal.m
│ ├── HCDCashBase.h
│ ├── main.m
│ ├── HCDCashContext.h
│ ├── HCDCaseReturn.m
│ ├── HCDCashRobate.m
│ └── Images.xcassets
│ └── AppIcon.appiconset
│ └── Contents.json
├── 3装饰模式
├── .DS_Store
├── 3装饰模式
│ ├── 装饰模式图片.jpg
│ ├── ConcreteComponent.h
│ ├── ConcreteDecoratorB.h
│ ├── Component.m
│ ├── ViewController.h
│ ├── Component.h
│ ├── Decorator.h
│ ├── AppDelegate.h
│ ├── ConcreteComponent.m
│ ├── Decorator.m
│ ├── ConcreteDecoratorA.h
│ ├── main.m
│ ├── ConcreteDecoratorA.m
│ ├── ConcreteDecoratorB.m
│ └── Images.xcassets
│ │ └── AppIcon.appiconset
│ │ └── Contents.json
└── 3装饰模式.xcodeproj
│ ├── project.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcuserdata
│ │ └── yifan.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
│ └── xcuserdata
│ ├── yifan.xcuserdatad
│ └── xcschemes
│ │ └── xcschememanagement.plist
│ └── huangchengdu.xcuserdatad
│ └── xcschemes
│ └── xcschememanagement.plist
├── 1简单工厂模式
├── .DS_Store
├── 1简单工厂模式
│ ├── CommonTool.m
│ ├── ViewController.h
│ ├── HCDCalculateAdd.h
│ ├── HCDCalculateMinus.h
│ ├── HCDCalculateDivide.h
│ ├── HCDCalcuteMultiply.h
│ ├── AppDelegate.h
│ ├── main.m
│ ├── HCDCalcuteFactory.h
│ ├── HCDCalculateMinus.m
│ ├── HCDCalcuteMultiply.m
│ ├── CommonTool.h
│ ├── HCDCalculateAdd.m
│ ├── HCDCalculateDivide.m
│ └── HCDCalculate.h
└── 1简单工厂模式.xcodeproj
│ ├── project.xcworkspace
│ ├── xcuserdata
│ │ ├── yifan.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ │ └── huangchengdu.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── contents.xcworkspacedata
│ └── xcuserdata
│ ├── yifan.xcuserdatad
│ └── xcschemes
│ │ └── xcschememanagement.plist
│ └── huangchengdu.xcuserdatad
│ └── xcschemes
│ └── xcschememanagement.plist
├── 5工厂方法模式
├── .DS_Store
├── 5工厂方法模式
│ ├── HCDfactory.m
│ ├── HCDfactoryAdd.h
│ ├── HCDfactoryDivide.h
│ ├── HCDfactoryMinus.h
│ ├── HCDfactoryMultiply.h
│ ├── ViewController.h
│ ├── HCDCalculateAdd.h
│ ├── HCDCalculateMinus.h
│ ├── HCDCalculateDivide.h
│ ├── HCDCalcuteMultiply.h
│ ├── HCDfactory.h
│ ├── AppDelegate.h
│ ├── HCDfactoryAdd.m
│ ├── HCDfactoryMinus.m
│ ├── HCDfactoryDivide.m
│ ├── HCDfactoryMultiply.m
│ ├── main.m
│ ├── HCDCalculateAdd.m
│ ├── HCDCalculate.h
│ ├── HCDCalculateMinus.m
│ ├── HCDCalcuteMultiply.m
│ ├── HCDCalculateDivide.m
│ └── ViewController.m
└── 5工厂方法模式.xcodeproj
│ ├── project.xcworkspace
│ ├── xcuserdata
│ │ └── yifan.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── contents.xcworkspacedata
│ └── xcuserdata
│ └── yifan.xcuserdatad
│ └── xcschemes
│ └── xcschememanagement.plist
├── 17桥接模式
├── 17桥接模式
│ ├── 桥接模式.png
│ ├── HCDPhone.m
│ ├── HCDNokiaPhone.h
│ ├── ViewController.h
│ ├── HCDGameSoftware.h
│ ├── HCDPlaySoftWare.h
│ ├── HCDWorkSoftWare.h
│ ├── AppDelegate.h
│ ├── main.m
│ ├── HCDSoftware.h
│ ├── HCDWorkSoftWare.m
│ ├── HCDGameSoftware.m
│ ├── HCDPlaySoftWare.m
│ ├── HCDPhone.h
│ └── Images.xcassets
│ │ └── AppIcon.appiconset
│ │ └── Contents.json
└── 17桥接模式.xcodeproj
│ ├── project.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcuserdata
│ │ └── yifan.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
│ └── xcuserdata
│ └── yifan.xcuserdatad
│ └── xcschemes
│ └── xcschememanagement.plist
├── 21享元模式
├── 21享元模式
│ ├── 享元模式.png
│ ├── HCDUser.m
│ ├── ViewController.h
│ ├── HCDUser.h
│ ├── HCDWebSite.h
│ ├── AppDelegate.h
│ ├── HCDConcreteWebSite.h
│ ├── HCDConcreteWebSite.m
│ ├── main.m
│ ├── HCDWebSiteFactory.h
│ └── Images.xcassets
│ │ └── AppIcon.appiconset
│ │ └── Contents.json
└── 21享元模式.xcodeproj
│ ├── project.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcuserdata
│ │ ├── yifan.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
│ │ └── huangchengdu.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
│ └── xcuserdata
│ ├── yifan.xcuserdatad
│ └── xcschemes
│ │ └── xcschememanagement.plist
│ └── huangchengdu.xcuserdatad
│ └── xcschemes
│ └── xcschememanagement.plist
├── 11状态模式
├── 11状态模式
│ ├── 状态模式结构图.png
│ ├── ViewController.h
│ ├── HCDNoonState.h
│ ├── HCDRestState.h
│ ├── HCDSleepState.h
│ ├── HCDState.h
│ ├── HCDAfternoonState.h
│ ├── HCDForenoonState.h
│ ├── AppDelegate.h
│ ├── HCDEventState.h
│ ├── HCDRestState.m
│ ├── HCDSleepState.m
│ ├── main.m
│ ├── HCDWork.h
│ ├── HCDWork.m
│ ├── HCDNoonState.m
│ ├── HCDForenoonState.m
│ ├── HCDAfternoonState.m
│ ├── HCDEventState.m
│ └── Images.xcassets
│ │ └── AppIcon.appiconset
│ │ └── Contents.json
└── 11状态模式.xcodeproj
│ ├── project.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcuserdata
│ │ └── yifan.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
│ └── xcuserdata
│ └── yifan.xcuserdatad
│ └── xcschemes
│ └── xcschememanagement.plist
├── 13备忘录模式
├── 13备忘录模式
│ ├── 备忘录模式.png
│ ├── HCDGameState.m
│ ├── ViewController.h
│ ├── AppDelegate.h
│ ├── main.m
│ ├── HCDGameState.h
│ ├── HCDStateManager.h
│ ├── HCDStateManager.m
│ └── HCDGameRoll.h
└── 13备忘录模式.xcodeproj
│ ├── project.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcuserdata
│ │ └── huangchengdu.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
│ └── xcuserdata
│ └── huangchengdu.xcuserdatad
│ └── xcschemes
│ └── xcschememanagement.plist
├── 19职责链模式
├── 19职责链模式
│ ├── 职责链模式.png
│ ├── HCDReuquest.m
│ ├── HCDCommonManager.h
│ ├── HCDMajorManager.h
│ ├── HCDGenaralManager.h
│ ├── ViewController.h
│ ├── AppDelegate.h
│ ├── HCDReuquest.h
│ ├── main.m
│ ├── HCDMnager.h
│ ├── HCDMnager.m
│ ├── HCDMajorManager.m
│ ├── HCDCommonManager.m
│ └── HCDGenaralManager.m
└── 19职责链模式.xcodeproj
│ ├── project.xcworkspace
│ ├── xcuserdata
│ │ └── yifan.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── contents.xcworkspacedata
│ └── xcuserdata
│ └── yifan.xcuserdatad
│ └── xcschemes
│ └── xcschememanagement.plist
├── 20中介者模式
├── 20中介者模式
│ ├── 中介者模式.png
│ ├── Mediator.m
│ ├── Colleague.m
│ ├── ConcreteColleague1.h
│ ├── ConcreteColleague2.h
│ ├── ViewController.h
│ ├── ConcreteMediator.h
│ ├── AppDelegate.h
│ ├── main.m
│ ├── Colleague.h
│ ├── Mediator.h
│ ├── HCDMediatorProtocal.h
│ ├── ConcreteMediator.m
│ ├── ConcreteColleague2.m
│ └── ConcreteColleague1.m
└── 20中介者模式.xcodeproj
│ ├── project.xcworkspace
│ ├── xcuserdata
│ │ ├── yifan.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ │ └── huangchengdu.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── contents.xcworkspacedata
│ └── xcuserdata
│ ├── yifan.xcuserdatad
│ └── xcschemes
│ │ └── xcschememanagement.plist
│ └── huangchengdu.xcuserdatad
│ └── xcschemes
│ └── xcschememanagement.plist
├── 9观察者模式
├── 9观察者模式
│ ├── 观察者模式类图.png
│ ├── HCDSecreteSubject.h
│ ├── ViewController.h
│ ├── HCDObserver.h
│ ├── HCDNBAObserver.h
│ ├── HCDStockObserver.h
│ ├── HCDNBAObserver.m
│ ├── HCDStockObserver.m
│ ├── AppDelegate.h
│ ├── main.m
│ ├── HCDSecreteSubject.m
│ └── HCDSubject.h
└── 9观察者模式.xcodeproj
│ ├── project.xcworkspace
│ ├── xcuserdata
│ │ └── yifan.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── contents.xcworkspacedata
│ └── xcuserdata
│ └── yifan.xcuserdatad
│ └── xcschemes
│ └── xcschememanagement.plist
├── 10抽象工厂模式
├── 10抽象工厂模式
│ ├── SQLUser.m
│ ├── SQLDepartment.m
│ ├── SQLUser.h
│ ├── SQLDepartment.h
│ ├── ViewController.h
│ ├── HCDSqlserverUser.h
│ ├── HCDAccessFactory.h
│ ├── HCDSqlserverFactory.h
│ ├── HCDAccessUser.h
│ ├── HCDAccessDepartment.h
│ ├── HCDUser.h
│ ├── HCDSqlserverDepartment.h
│ ├── AppDelegate.h
│ ├── HCDFactory.h
│ ├── HCDDepartment.h
│ ├── main.m
│ ├── HCDAccessUser.m
│ ├── HCDSqlserverUser.m
│ ├── HCDAccessFactory.m
│ ├── HCDAccessDepartment.m
│ ├── HCDSqlserverFactory.m
│ └── HCDSqlserverDepartment.m
└── 10抽象工厂模式.xcodeproj
│ ├── project.xcworkspace
│ ├── xcuserdata
│ │ └── yifan.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── contents.xcworkspacedata
│ └── xcuserdata
│ └── yifan.xcuserdatad
│ └── xcschemes
│ └── xcschememanagement.plist
├── 4代理模式
├── 4代理模式.xcodeproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcuserdata
│ │ │ └── yifan.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcuserdata
│ │ └── yifan.xcuserdatad
│ │ └── xcschemes
│ │ └── xcschememanagement.plist
└── 4代理模式
│ ├── HCDschoolGirl.m
│ ├── ViewController.h
│ ├── HCDschoolGirl.h
│ ├── AppDelegate.h
│ ├── HCDgiveGift.h
│ ├── HCDproxy.h
│ ├── HCDpursuit.h
│ ├── main.m
│ ├── HCDpursuit.m
│ └── Images.xcassets
│ └── AppIcon.appiconset
│ └── Contents.json
├── 7外观模式
├── 7外观模式.xcodeproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcuserdata
│ │ │ └── yifan.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcuserdata
│ │ └── yifan.xcuserdatad
│ │ └── xcschemes
│ │ └── xcschememanagement.plist
└── 7外观模式
│ ├── ViewController.h
│ ├── HCDstock1.h
│ ├── HCDstock2.h
│ ├── HCDstock3.h
│ ├── HCDFound.h
│ ├── HCDstock1.m
│ ├── HCDstock2.m
│ ├── HCDstock3.m
│ ├── AppDelegate.h
│ ├── main.m
│ ├── ViewController.m
│ └── Images.xcassets
│ └── AppIcon.appiconset
│ └── Contents.json
├── 14组合模式
├── 14组合模式.xcodeproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcuserdata
│ │ │ └── huangchengdu.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcuserdata
│ │ └── huangchengdu.xcuserdatad
│ │ └── xcschemes
│ │ └── xcschememanagement.plist
└── 14组合模式
│ ├── ViewController.h
│ ├── AppDelegate.h
│ ├── HCDCompany.h
│ ├── HCDHRDepartment.h
│ ├── main.m
│ ├── HCDConcreteCompany.h
│ ├── HCDFinanceDepartment.h
│ ├── HCDHRDepartment.m
│ ├── HCDFinanceDepartment.m
│ └── Images.xcassets
│ └── AppIcon.appiconset
│ └── Contents.json
├── 16单列模式
├── 16单列模式.xcodeproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcuserdata
│ │ │ └── yifan.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcuserdata
│ │ └── yifan.xcuserdatad
│ │ └── xcschemes
│ │ └── xcschememanagement.plist
└── 16单列模式
│ ├── ViewController.h
│ ├── HCDSingleton.h
│ ├── AppDelegate.h
│ ├── main.m
│ ├── HCDSingleton.m
│ ├── ViewController.m
│ └── Images.xcassets
│ └── AppIcon.appiconset
│ └── Contents.json
├── 18命令模式
├── 18命令模式.xcodeproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcuserdata
│ │ │ └── yifan.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcuserdata
│ │ ├── yifan.xcuserdatad
│ │ └── xcschemes
│ │ │ └── xcschememanagement.plist
│ │ └── huangchengdu.xcuserdatad
│ │ └── xcschemes
│ │ └── xcschememanagement.plist
└── 18命令模式
│ ├── HCDDuckOrder.h
│ ├── HCDMuttonOrder.h
│ ├── HCDChickenOrder.h
│ ├── ViewController.h
│ ├── AppDelegate.h
│ ├── HCDDuckOrder.m
│ ├── HCDMuttonOrder.m
│ ├── HCDChickenOrder.m
│ ├── main.m
│ ├── HCDOrder.m
│ ├── HCDWorker.h
│ ├── HCDWaiter.h
│ ├── HCDOrder.h
│ ├── HCDCustomr.h
│ ├── HCDWorker.m
│ └── Images.xcassets
│ └── AppIcon.appiconset
│ └── Contents.json
├── 24原型模式
├── 24原型模式.xcodeproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcuserdata
│ │ │ └── huangchengdu.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcuserdata
│ │ └── huangchengdu.xcuserdatad
│ │ └── xcschemes
│ │ └── xcschememanagement.plist
└── 24原型模式
│ ├── ViewController.h
│ ├── Dot.h
│ ├── Verter.h
│ ├── AppDelegate.h
│ ├── main.m
│ └── Mark.h
├── 8建造者模式
├── 8建造者模式.xcodeproj
│ ├── project.xcworkspace
│ │ ├── xcuserdata
│ │ │ └── yifan.xcuserdatad
│ │ │ │ └── UserInterfaceState.xcuserstate
│ │ └── contents.xcworkspacedata
│ └── xcuserdata
│ │ └── yifan.xcuserdatad
│ │ └── xcschemes
│ │ └── xcschememanagement.plist
└── 8建造者模式
│ ├── HCDArm.h
│ ├── HCDBody.h
│ ├── HCDLeg.h
│ ├── HCDHeader.h
│ ├── ViewController.h
│ ├── HCDArm.m
│ ├── HCDLeg.m
│ ├── HCDBody.m
│ ├── HCDHeader.m
│ ├── HCDPersonFatBuilder.h
│ ├── HCDPersonThinBuilder.h
│ ├── AppDelegate.h
│ ├── main.m
│ ├── HCDPersonBuilderDirector.h
│ ├── HCDPersonBuilderDirector.m
│ ├── HCDPresionBuilder.h
│ └── Images.xcassets
│ └── AppIcon.appiconset
│ └── Contents.json
├── 12适配器模式
├── 12适配器模式.xcodeproj
│ ├── project.xcworkspace
│ │ ├── xcuserdata
│ │ │ ├── yifan.xcuserdatad
│ │ │ │ └── UserInterfaceState.xcuserstate
│ │ │ └── huangchengdu.xcuserdatad
│ │ │ │ └── UserInterfaceState.xcuserstate
│ │ └── contents.xcworkspacedata
│ └── xcuserdata
│ │ ├── yifan.xcuserdatad
│ │ └── xcschemes
│ │ │ └── xcschememanagement.plist
│ │ └── huangchengdu.xcuserdatad
│ │ └── xcschemes
│ │ └── xcschememanagement.plist
└── 12适配器模式
│ ├── HCDForwards.h
│ ├── ViewController.h
│ ├── HCDTranslator.h
│ ├── AppDelegate.h
│ ├── HCDForwards.m
│ ├── HCDPlayer.h
│ ├── main.m
│ ├── HCDPlayer.m
│ ├── HCDForeignCenter.h
│ ├── HCDForeignCenter.m
│ └── HCDTranslator.m
├── 15迭代器模式
├── 15迭代器模式.xcodeproj
│ ├── project.xcworkspace
│ │ ├── xcuserdata
│ │ │ ├── yifan.xcuserdatad
│ │ │ │ └── UserInterfaceState.xcuserstate
│ │ │ └── huangchengdu.xcuserdatad
│ │ │ │ └── UserInterfaceState.xcuserstate
│ │ └── contents.xcworkspacedata
│ └── xcuserdata
│ │ ├── yifan.xcuserdatad
│ │ └── xcschemes
│ │ │ └── xcschememanagement.plist
│ │ └── huangchengdu.xcuserdatad
│ │ └── xcschemes
│ │ └── xcschememanagement.plist
└── 15迭代器模式
│ ├── ViewController.h
│ ├── AppDelegate.h
│ ├── main.m
│ └── ViewController.m
├── 6模板方法模式
├── 6模板方法模式.xcodeproj
│ ├── project.xcworkspace
│ │ ├── xcuserdata
│ │ │ └── yifan.xcuserdatad
│ │ │ │ └── UserInterfaceState.xcuserstate
│ │ └── contents.xcworkspacedata
│ └── xcuserdata
│ │ └── yifan.xcuserdatad
│ │ └── xcschemes
│ │ └── xcschememanagement.plist
└── 6模板方法模式
│ ├── HCDtextPaperA.h
│ ├── HCDtextPaperB.h
│ ├── ViewController.h
│ ├── AppDelegate.h
│ ├── HCDtextPaperA.m
│ ├── HCDtextPaperB.m
│ ├── HCDtextPaper.h
│ ├── main.m
│ └── HCDtextPaper.m
├── 22解释器模式
├── 22解释器模式.xcodeproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcuserdata
│ │ │ └── huangchengdu.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcuserdata
│ │ └── huangchengdu.xcuserdatad
│ │ └── xcschemes
│ │ └── xcschememanagement.plist
└── 22解释器模式
│ ├── ViewController.h
│ ├── HCDTerminalExpression.h
│ ├── HCDNonterminalExpression.h
│ ├── HCDAbstractExpression.m
│ ├── AppDelegate.h
│ ├── HCDAbstractExpression.h
│ ├── HCDTerminalExpression.m
│ ├── main.m
│ ├── HCDContext.h
│ ├── HCDNonterminalExpression.m
│ └── HCDContext.m
└── 23访问者模式
├── 23访问者模式.xcodeproj
├── project.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcuserdata
│ │ └── huangchengdu.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
└── xcuserdata
│ └── huangchengdu.xcuserdatad
│ └── xcschemes
│ └── xcschememanagement.plist
└── 23访问者模式
├── HCDConcreteVisitor1.h
├── HCDConcreteVisitor2.h
├── ViewController.h
├── HCDConcreteElementB.h
├── HCDConcreteElementA.h
├── HCDElements.m
├── HCDElements.h
├── AppDelegate.h
├── main.m
├── HCDConcreteElementB.m
├── HCDConcreteElementA.m
├── HCDVisitors.h
├── HCDVisitors.m
├── HCDConcreteVisitor2.m
├── HCDObjectStructure.h
└── HCDConcreteVisitor1.m
/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | .DS_Store
3 |
--------------------------------------------------------------------------------
/设计图/中介者模式.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huang303513/Design-Pattern-For-iOS/HEAD/设计图/中介者模式.png
--------------------------------------------------------------------------------
/设计图/享元模式.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huang303513/Design-Pattern-For-iOS/HEAD/设计图/享元模式.png
--------------------------------------------------------------------------------
/设计图/代理模式.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huang303513/Design-Pattern-For-iOS/HEAD/设计图/代理模式.png
--------------------------------------------------------------------------------
/设计图/单列模式.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huang303513/Design-Pattern-For-iOS/HEAD/设计图/单列模式.png
--------------------------------------------------------------------------------
/设计图/原型模式.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huang303513/Design-Pattern-For-iOS/HEAD/设计图/原型模式.png
--------------------------------------------------------------------------------
/设计图/命令模式.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huang303513/Design-Pattern-For-iOS/HEAD/设计图/命令模式.png
--------------------------------------------------------------------------------
/设计图/备忘录模式.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huang303513/Design-Pattern-For-iOS/HEAD/设计图/备忘录模式.png
--------------------------------------------------------------------------------
/设计图/外观模式.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huang303513/Design-Pattern-For-iOS/HEAD/设计图/外观模式.png
--------------------------------------------------------------------------------
/设计图/工厂方法模式.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huang303513/Design-Pattern-For-iOS/HEAD/设计图/工厂方法模式.png
--------------------------------------------------------------------------------
/设计图/建造者模式.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huang303513/Design-Pattern-For-iOS/HEAD/设计图/建造者模式.png
--------------------------------------------------------------------------------
/设计图/抽象工厂模式.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huang303513/Design-Pattern-For-iOS/HEAD/设计图/抽象工厂模式.png
--------------------------------------------------------------------------------
/设计图/桥接模式.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huang303513/Design-Pattern-For-iOS/HEAD/设计图/桥接模式.png
--------------------------------------------------------------------------------
/设计图/模板方法模式.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huang303513/Design-Pattern-For-iOS/HEAD/设计图/模板方法模式.png
--------------------------------------------------------------------------------
/设计图/状态模式.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huang303513/Design-Pattern-For-iOS/HEAD/设计图/状态模式.png
--------------------------------------------------------------------------------
/设计图/策略模式.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huang303513/Design-Pattern-For-iOS/HEAD/设计图/策略模式.png
--------------------------------------------------------------------------------
/设计图/简单工厂模式.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huang303513/Design-Pattern-For-iOS/HEAD/设计图/简单工厂模式.png
--------------------------------------------------------------------------------
/设计图/组合模式.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huang303513/Design-Pattern-For-iOS/HEAD/设计图/组合模式.png
--------------------------------------------------------------------------------
/设计图/装饰模式.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huang303513/Design-Pattern-For-iOS/HEAD/设计图/装饰模式.jpg
--------------------------------------------------------------------------------
/设计图/观察者模式.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huang303513/Design-Pattern-For-iOS/HEAD/设计图/观察者模式.png
--------------------------------------------------------------------------------
/设计图/解释器模式.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huang303513/Design-Pattern-For-iOS/HEAD/设计图/解释器模式.png
--------------------------------------------------------------------------------
/设计图/访问者模式.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huang303513/Design-Pattern-For-iOS/HEAD/设计图/访问者模式.png
--------------------------------------------------------------------------------
/设计图/责任链模式.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huang303513/Design-Pattern-For-iOS/HEAD/设计图/责任链模式.png
--------------------------------------------------------------------------------
/设计图/迭代器模式.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huang303513/Design-Pattern-For-iOS/HEAD/设计图/迭代器模式.png
--------------------------------------------------------------------------------
/设计图/适配器模式.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huang303513/Design-Pattern-For-iOS/HEAD/设计图/适配器模式.png
--------------------------------------------------------------------------------
/2策略模式/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huang303513/Design-Pattern-For-iOS/HEAD/2策略模式/.DS_Store
--------------------------------------------------------------------------------
/3装饰模式/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huang303513/Design-Pattern-For-iOS/HEAD/3装饰模式/.DS_Store
--------------------------------------------------------------------------------
/1简单工厂模式/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huang303513/Design-Pattern-For-iOS/HEAD/1简单工厂模式/.DS_Store
--------------------------------------------------------------------------------
/5工厂方法模式/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huang303513/Design-Pattern-For-iOS/HEAD/5工厂方法模式/.DS_Store
--------------------------------------------------------------------------------
/17桥接模式/17桥接模式/桥接模式.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huang303513/Design-Pattern-For-iOS/HEAD/17桥接模式/17桥接模式/桥接模式.png
--------------------------------------------------------------------------------
/21享元模式/21享元模式/享元模式.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huang303513/Design-Pattern-For-iOS/HEAD/21享元模式/21享元模式/享元模式.png
--------------------------------------------------------------------------------
/3装饰模式/3装饰模式/装饰模式图片.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huang303513/Design-Pattern-For-iOS/HEAD/3装饰模式/3装饰模式/装饰模式图片.jpg
--------------------------------------------------------------------------------
/11状态模式/11状态模式/状态模式结构图.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huang303513/Design-Pattern-For-iOS/HEAD/11状态模式/11状态模式/状态模式结构图.png
--------------------------------------------------------------------------------
/13备忘录模式/13备忘录模式/备忘录模式.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huang303513/Design-Pattern-For-iOS/HEAD/13备忘录模式/13备忘录模式/备忘录模式.png
--------------------------------------------------------------------------------
/19职责链模式/19职责链模式/职责链模式.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huang303513/Design-Pattern-For-iOS/HEAD/19职责链模式/19职责链模式/职责链模式.png
--------------------------------------------------------------------------------
/20中介者模式/20中介者模式/中介者模式.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huang303513/Design-Pattern-For-iOS/HEAD/20中介者模式/20中介者模式/中介者模式.png
--------------------------------------------------------------------------------
/9观察者模式/9观察者模式/观察者模式类图.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huang303513/Design-Pattern-For-iOS/HEAD/9观察者模式/9观察者模式/观察者模式类图.png
--------------------------------------------------------------------------------
/21享元模式/21享元模式/HCDUser.m:
--------------------------------------------------------------------------------
1 | //
2 | // HCDUser.m
3 | // 21享元模式
4 | //
5 | // Created by yifan on 15/8/27.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDUser.h"
10 |
11 | @implementation HCDUser
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/17桥接模式/17桥接模式/HCDPhone.m:
--------------------------------------------------------------------------------
1 | //
2 | // HCDPhone.m
3 | // 17桥接模式
4 | //
5 | // Created by yifan on 15/8/15.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDPhone.h"
10 |
11 | @implementation HCDPhone
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/10抽象工厂模式/10抽象工厂模式/SQLUser.m:
--------------------------------------------------------------------------------
1 | //
2 | // SQLUser.m
3 | // 10抽象工厂模式
4 | //
5 | // Created by yifan on 15/8/14.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "SQLUser.h"
10 |
11 | @implementation SQLUser
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/1简单工厂模式/1简单工厂模式/CommonTool.m:
--------------------------------------------------------------------------------
1 | //
2 | // CommonTool.m
3 | // 1简单工厂模式
4 | //
5 | // Created by 黄成都 on 15/8/10.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "CommonTool.h"
10 |
11 | @implementation CommonTool
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/20中介者模式/20中介者模式/Mediator.m:
--------------------------------------------------------------------------------
1 | //
2 | // Mediator.m
3 | // 20中介者模式
4 | //
5 | // Created by huangchengdu on 17/5/22.
6 | // Copyright © 2017年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "Mediator.h"
10 |
11 | @implementation Mediator
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/2策略模式/2策略模式.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/2策略模式/2策略模式.xcodeproj/project.xcworkspace/xcuserdata/yifan.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huang303513/Design-Pattern-For-iOS/HEAD/2策略模式/2策略模式.xcodeproj/project.xcworkspace/xcuserdata/yifan.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/3装饰模式/3装饰模式.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/3装饰模式/3装饰模式.xcodeproj/project.xcworkspace/xcuserdata/yifan.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huang303513/Design-Pattern-For-iOS/HEAD/3装饰模式/3装饰模式.xcodeproj/project.xcworkspace/xcuserdata/yifan.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/4代理模式/4代理模式.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/4代理模式/4代理模式.xcodeproj/project.xcworkspace/xcuserdata/yifan.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huang303513/Design-Pattern-For-iOS/HEAD/4代理模式/4代理模式.xcodeproj/project.xcworkspace/xcuserdata/yifan.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/5工厂方法模式/5工厂方法模式/HCDfactory.m:
--------------------------------------------------------------------------------
1 | //
2 | // HCDfactory.m
3 | // 5工厂方法模式
4 | //
5 | // Created by yifan on 15/8/12.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDfactory.h"
10 |
11 | @implementation HCDfactory
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/7外观模式/7外观模式.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/7外观模式/7外观模式.xcodeproj/project.xcworkspace/xcuserdata/yifan.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huang303513/Design-Pattern-For-iOS/HEAD/7外观模式/7外观模式.xcodeproj/project.xcworkspace/xcuserdata/yifan.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/11状态模式/11状态模式.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/11状态模式/11状态模式.xcodeproj/project.xcworkspace/xcuserdata/yifan.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huang303513/Design-Pattern-For-iOS/HEAD/11状态模式/11状态模式.xcodeproj/project.xcworkspace/xcuserdata/yifan.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/14组合模式/14组合模式.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/16单列模式/16单列模式.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/16单列模式/16单列模式.xcodeproj/project.xcworkspace/xcuserdata/yifan.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huang303513/Design-Pattern-For-iOS/HEAD/16单列模式/16单列模式.xcodeproj/project.xcworkspace/xcuserdata/yifan.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/17桥接模式/17桥接模式.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/17桥接模式/17桥接模式.xcodeproj/project.xcworkspace/xcuserdata/yifan.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huang303513/Design-Pattern-For-iOS/HEAD/17桥接模式/17桥接模式.xcodeproj/project.xcworkspace/xcuserdata/yifan.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/18命令模式/18命令模式.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/18命令模式/18命令模式.xcodeproj/project.xcworkspace/xcuserdata/yifan.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huang303513/Design-Pattern-For-iOS/HEAD/18命令模式/18命令模式.xcodeproj/project.xcworkspace/xcuserdata/yifan.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/19职责链模式/19职责链模式/HCDReuquest.m:
--------------------------------------------------------------------------------
1 | //
2 | // HCDReuquest.m
3 | // 19职责链模式
4 | //
5 | // Created by yifan on 15/8/15.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDReuquest.h"
10 |
11 | @implementation HCDReuquest
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/20中介者模式/20中介者模式/Colleague.m:
--------------------------------------------------------------------------------
1 | //
2 | // Colleague.m
3 | // 20中介者模式
4 | //
5 | // Created by huangchengdu on 17/5/22.
6 | // Copyright © 2017年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "Colleague.h"
10 |
11 | @implementation Colleague
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/21享元模式/21享元模式.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/21享元模式/21享元模式.xcodeproj/project.xcworkspace/xcuserdata/yifan.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huang303513/Design-Pattern-For-iOS/HEAD/21享元模式/21享元模式.xcodeproj/project.xcworkspace/xcuserdata/yifan.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/24原型模式/24原型模式.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/8建造者模式/8建造者模式.xcodeproj/project.xcworkspace/xcuserdata/yifan.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huang303513/Design-Pattern-For-iOS/HEAD/8建造者模式/8建造者模式.xcodeproj/project.xcworkspace/xcuserdata/yifan.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/9观察者模式/9观察者模式.xcodeproj/project.xcworkspace/xcuserdata/yifan.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huang303513/Design-Pattern-For-iOS/HEAD/9观察者模式/9观察者模式.xcodeproj/project.xcworkspace/xcuserdata/yifan.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/12适配器模式/12适配器模式.xcodeproj/project.xcworkspace/xcuserdata/yifan.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huang303513/Design-Pattern-For-iOS/HEAD/12适配器模式/12适配器模式.xcodeproj/project.xcworkspace/xcuserdata/yifan.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/12适配器模式/12适配器模式/HCDForwards.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDForwards.h
3 | // 12适配器模式
4 | //
5 | // Created by 黄成都 on 15/8/14.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDPlayer.h"
10 |
11 | @interface HCDForwards : HCDPlayer
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/13备忘录模式/13备忘录模式/HCDGameState.m:
--------------------------------------------------------------------------------
1 | //
2 | // HCDGameState.m
3 | // 13备忘录模式
4 | //
5 | // Created by 黄成都 on 15/8/14.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDGameState.h"
10 |
11 | @implementation HCDGameState
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/15迭代器模式/15迭代器模式.xcodeproj/project.xcworkspace/xcuserdata/yifan.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huang303513/Design-Pattern-For-iOS/HEAD/15迭代器模式/15迭代器模式.xcodeproj/project.xcworkspace/xcuserdata/yifan.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/17桥接模式/17桥接模式/HCDNokiaPhone.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDNokiaPhone.h
3 | // 17桥接模式
4 | //
5 | // Created by yifan on 15/8/15.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDPhone.h"
10 |
11 | @interface HCDNokiaPhone : HCDPhone
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/19职责链模式/19职责链模式.xcodeproj/project.xcworkspace/xcuserdata/yifan.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huang303513/Design-Pattern-For-iOS/HEAD/19职责链模式/19职责链模式.xcodeproj/project.xcworkspace/xcuserdata/yifan.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/1简单工厂模式/1简单工厂模式.xcodeproj/project.xcworkspace/xcuserdata/yifan.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huang303513/Design-Pattern-For-iOS/HEAD/1简单工厂模式/1简单工厂模式.xcodeproj/project.xcworkspace/xcuserdata/yifan.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/20中介者模式/20中介者模式.xcodeproj/project.xcworkspace/xcuserdata/yifan.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huang303513/Design-Pattern-For-iOS/HEAD/20中介者模式/20中介者模式.xcodeproj/project.xcworkspace/xcuserdata/yifan.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/4代理模式/4代理模式/HCDschoolGirl.m:
--------------------------------------------------------------------------------
1 | //
2 | // HCDschoolGirl.m
3 | // 4代理模式
4 | //
5 | // Created by yifan on 15/8/12.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDschoolGirl.h"
10 |
11 | @implementation HCDschoolGirl
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/5工厂方法模式/5工厂方法模式.xcodeproj/project.xcworkspace/xcuserdata/yifan.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huang303513/Design-Pattern-For-iOS/HEAD/5工厂方法模式/5工厂方法模式.xcodeproj/project.xcworkspace/xcuserdata/yifan.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/6模板方法模式/6模板方法模式.xcodeproj/project.xcworkspace/xcuserdata/yifan.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huang303513/Design-Pattern-For-iOS/HEAD/6模板方法模式/6模板方法模式.xcodeproj/project.xcworkspace/xcuserdata/yifan.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/8建造者模式/8建造者模式.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/9观察者模式/9观察者模式.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/10抽象工厂模式/10抽象工厂模式.xcodeproj/project.xcworkspace/xcuserdata/yifan.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huang303513/Design-Pattern-For-iOS/HEAD/10抽象工厂模式/10抽象工厂模式.xcodeproj/project.xcworkspace/xcuserdata/yifan.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/10抽象工厂模式/10抽象工厂模式/SQLDepartment.m:
--------------------------------------------------------------------------------
1 | //
2 | // SQLDepartment.m
3 | // 10抽象工厂模式
4 | //
5 | // Created by yifan on 15/8/14.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "SQLDepartment.h"
10 |
11 | @implementation SQLDepartment
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/10抽象工厂模式/10抽象工厂模式/SQLUser.h:
--------------------------------------------------------------------------------
1 | //
2 | // SQLUser.h
3 | // 10抽象工厂模式
4 | //
5 | // Created by yifan on 15/8/14.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface SQLUser : NSObject
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/12适配器模式/12适配器模式.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/13备忘录模式/13备忘录模式.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/15迭代器模式/15迭代器模式.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/18命令模式/18命令模式/HCDDuckOrder.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDDuckOrder.h
3 | // 18命令模式
4 | //
5 | // Created by huangchengdu on 17/6/1.
6 | // Copyright © 2017年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDOrder.h"
10 |
11 | @interface HCDDuckOrder : HCDOrder
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/18命令模式/18命令模式/HCDMuttonOrder.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDMuttonOrder.h
3 | // 18命令模式
4 | //
5 | // Created by yifan on 15/8/15.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDOrder.h"
10 |
11 | @interface HCDMuttonOrder : HCDOrder
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/19职责链模式/19职责链模式.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/20中介者模式/20中介者模式.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/22解释器模式/22解释器模式.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/23访问者模式/23访问者模式.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/2策略模式/2策略模式.xcodeproj/project.xcworkspace/xcuserdata/huangchengdu.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huang303513/Design-Pattern-For-iOS/HEAD/2策略模式/2策略模式.xcodeproj/project.xcworkspace/xcuserdata/huangchengdu.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/14组合模式/14组合模式.xcodeproj/project.xcworkspace/xcuserdata/huangchengdu.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huang303513/Design-Pattern-For-iOS/HEAD/14组合模式/14组合模式.xcodeproj/project.xcworkspace/xcuserdata/huangchengdu.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/18命令模式/18命令模式/HCDChickenOrder.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDChickenOrder.h
3 | // 18命令模式
4 | //
5 | // Created by yifan on 15/8/15.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDOrder.h"
10 |
11 | @interface HCDChickenOrder : HCDOrder
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/1简单工厂模式/1简单工厂模式.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/21享元模式/21享元模式.xcodeproj/project.xcworkspace/xcuserdata/huangchengdu.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huang303513/Design-Pattern-For-iOS/HEAD/21享元模式/21享元模式.xcodeproj/project.xcworkspace/xcuserdata/huangchengdu.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/24原型模式/24原型模式.xcodeproj/project.xcworkspace/xcuserdata/huangchengdu.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huang303513/Design-Pattern-For-iOS/HEAD/24原型模式/24原型模式.xcodeproj/project.xcworkspace/xcuserdata/huangchengdu.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/5工厂方法模式/5工厂方法模式.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/5工厂方法模式/5工厂方法模式/HCDfactoryAdd.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDfactoryAdd.h
3 | // 5工厂方法模式
4 | //
5 | // Created by yifan on 15/8/12.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDfactory.h"
10 |
11 | @interface HCDfactoryAdd : HCDfactory
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/6模板方法模式/6模板方法模式.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/10抽象工厂模式/10抽象工厂模式.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/12适配器模式/12适配器模式.xcodeproj/project.xcworkspace/xcuserdata/huangchengdu.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huang303513/Design-Pattern-For-iOS/HEAD/12适配器模式/12适配器模式.xcodeproj/project.xcworkspace/xcuserdata/huangchengdu.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/13备忘录模式/13备忘录模式.xcodeproj/project.xcworkspace/xcuserdata/huangchengdu.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huang303513/Design-Pattern-For-iOS/HEAD/13备忘录模式/13备忘录模式.xcodeproj/project.xcworkspace/xcuserdata/huangchengdu.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/15迭代器模式/15迭代器模式.xcodeproj/project.xcworkspace/xcuserdata/huangchengdu.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huang303513/Design-Pattern-For-iOS/HEAD/15迭代器模式/15迭代器模式.xcodeproj/project.xcworkspace/xcuserdata/huangchengdu.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/19职责链模式/19职责链模式/HCDCommonManager.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDCommonManager.h
3 | // 19职责链模式
4 | //
5 | // Created by yifan on 15/8/15.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDMnager.h"
10 |
11 | @interface HCDCommonManager : HCDMnager
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/19职责链模式/19职责链模式/HCDMajorManager.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDMajorManager.h
3 | // 19职责链模式
4 | //
5 | // Created by yifan on 15/8/15.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDMnager.h"
10 |
11 | @interface HCDMajorManager : HCDMnager
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/1简单工厂模式/1简单工厂模式.xcodeproj/project.xcworkspace/xcuserdata/huangchengdu.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huang303513/Design-Pattern-For-iOS/HEAD/1简单工厂模式/1简单工厂模式.xcodeproj/project.xcworkspace/xcuserdata/huangchengdu.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/20中介者模式/20中介者模式.xcodeproj/project.xcworkspace/xcuserdata/huangchengdu.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huang303513/Design-Pattern-For-iOS/HEAD/20中介者模式/20中介者模式.xcodeproj/project.xcworkspace/xcuserdata/huangchengdu.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/22解释器模式/22解释器模式.xcodeproj/project.xcworkspace/xcuserdata/huangchengdu.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huang303513/Design-Pattern-For-iOS/HEAD/22解释器模式/22解释器模式.xcodeproj/project.xcworkspace/xcuserdata/huangchengdu.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/23访问者模式/23访问者模式.xcodeproj/project.xcworkspace/xcuserdata/huangchengdu.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huang303513/Design-Pattern-For-iOS/HEAD/23访问者模式/23访问者模式.xcodeproj/project.xcworkspace/xcuserdata/huangchengdu.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/5工厂方法模式/5工厂方法模式/HCDfactoryDivide.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDfactoryAdd.h
3 | // 5工厂方法模式
4 | //
5 | // Created by yifan on 15/8/12.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDfactory.h"
10 |
11 | @interface HCDfactoryDivide : HCDfactory
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/5工厂方法模式/5工厂方法模式/HCDfactoryMinus.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDfactoryMinus.h
3 | // 5工厂方法模式
4 | //
5 | // Created by yifan on 15/8/12.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDfactory.h"
10 |
11 | @interface HCDfactoryMinus : HCDfactory
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/6模板方法模式/6模板方法模式/HCDtextPaperA.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDtextPaperA.h
3 | // 6模板方法模式
4 | //
5 | // Created by yifan on 15/8/12.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDtextPaper.h"
10 |
11 | @interface HCDtextPaperA : HCDtextPaper
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/6模板方法模式/6模板方法模式/HCDtextPaperB.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDtextPaperB.h
3 | // 6模板方法模式
4 | //
5 | // Created by yifan on 15/8/12.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDtextPaper.h"
10 |
11 | @interface HCDtextPaperB : HCDtextPaper
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/10抽象工厂模式/10抽象工厂模式/SQLDepartment.h:
--------------------------------------------------------------------------------
1 | //
2 | // SQLDepartment.h
3 | // 10抽象工厂模式
4 | //
5 | // Created by yifan on 15/8/14.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface SQLDepartment : NSObject
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/19职责链模式/19职责链模式/HCDGenaralManager.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDGenaralManager.h
3 | // 19职责链模式
4 | //
5 | // Created by yifan on 15/8/15.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDMnager.h"
10 |
11 | @interface HCDGenaralManager : HCDMnager
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/3装饰模式/3装饰模式/ConcreteComponent.h:
--------------------------------------------------------------------------------
1 | //
2 | // ConcreteComponent.h
3 | // 3装饰模式
4 | //
5 | // Created by huangchengdu on 17/5/25.
6 | // Copyright © 2017年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "Component.h"
10 |
11 | @interface ConcreteComponent : Component
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/3装饰模式/3装饰模式/ConcreteDecoratorB.h:
--------------------------------------------------------------------------------
1 | //
2 | // ConcreteDecoratorB.h
3 | // 3装饰模式
4 | //
5 | // Created by huangchengdu on 17/5/25.
6 | // Copyright © 2017年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "Decorator.h"
10 |
11 | @interface ConcreteDecoratorB : Decorator
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/5工厂方法模式/5工厂方法模式/HCDfactoryMultiply.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDfactoryMinus.h
3 | // 5工厂方法模式
4 | //
5 | // Created by yifan on 15/8/12.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDfactory.h"
10 |
11 | @interface HCDfactoryMultiply : HCDfactory
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/9观察者模式/9观察者模式/HCDSecreteSubject.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDSecreteSubject.h
3 | // 9观察者模式
4 | //
5 | // Created by yifan on 15/8/13.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDSubject.h"
10 |
11 | @interface HCDSecreteSubject : HCDSubject
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/14组合模式/14组合模式/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // 14组合模式
4 | //
5 | // Created by 黄成都 on 15/8/15.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ViewController : UIViewController
12 |
13 |
14 | @end
15 |
16 |
--------------------------------------------------------------------------------
/20中介者模式/20中介者模式/ConcreteColleague1.h:
--------------------------------------------------------------------------------
1 | //
2 | // ConcreteColleague1.h
3 | // 20中介者模式
4 | //
5 | // Created by huangchengdu on 17/5/22.
6 | // Copyright © 2017年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "Colleague.h"
10 |
11 | @interface ConcreteColleague1 : Colleague
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/20中介者模式/20中介者模式/ConcreteColleague2.h:
--------------------------------------------------------------------------------
1 | //
2 | // ConcreteColleague2.h
3 | // 20中介者模式
4 | //
5 | // Created by huangchengdu on 17/5/22.
6 | // Copyright © 2017年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "Colleague.h"
10 |
11 | @interface ConcreteColleague2 : Colleague
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/23访问者模式/23访问者模式/HCDConcreteVisitor1.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDConcreteVisitor1.h
3 | // 23访问者模式
4 | //
5 | // Created by 黄成都 on 15/8/27.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDVisitors.h"
10 |
11 | @interface HCDConcreteVisitor1 : HCDVisitors
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/23访问者模式/23访问者模式/HCDConcreteVisitor2.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDConcreteVisitor2.h
3 | // 23访问者模式
4 | //
5 | // Created by 黄成都 on 15/8/27.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDVisitors.h"
10 |
11 | @interface HCDConcreteVisitor2 : HCDVisitors
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/2策略模式/2策略模式/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // 2策略模式
4 | //
5 | // Created by 黄成都 on 15/8/11.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ViewController : UIViewController
12 |
13 |
14 | @end
15 |
16 |
--------------------------------------------------------------------------------
/3装饰模式/3装饰模式/Component.m:
--------------------------------------------------------------------------------
1 | //
2 | // Component.m
3 | // 3装饰模式
4 | //
5 | // Created by huangchengdu on 17/5/25.
6 | // Copyright © 2017年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "Component.h"
10 |
11 | @implementation Component
12 |
13 | - (void)operation{
14 |
15 | }
16 | @end
17 |
--------------------------------------------------------------------------------
/3装饰模式/3装饰模式/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // 3装饰模式
4 | //
5 | // Created by yifan on 15/8/12.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ViewController : UIViewController
12 |
13 |
14 | @end
15 |
16 |
--------------------------------------------------------------------------------
/4代理模式/4代理模式/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // 4代理模式
4 | //
5 | // Created by yifan on 15/8/12.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ViewController : UIViewController
12 |
13 |
14 | @end
15 |
16 |
--------------------------------------------------------------------------------
/7外观模式/7外观模式/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // 7外观模式
4 | //
5 | // Created by yifan on 15/8/13.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ViewController : UIViewController
12 |
13 |
14 | @end
15 |
16 |
--------------------------------------------------------------------------------
/8建造者模式/8建造者模式/HCDArm.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDArm.h
3 | // 8建造者模式
4 | //
5 | // Created by huangchengdu on 17/5/17.
6 | // Copyright © 2017年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface HCDArm : NSObject
12 |
13 | -(void)work;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/8建造者模式/8建造者模式/HCDBody.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDBody.h
3 | // 8建造者模式
4 | //
5 | // Created by huangchengdu on 17/5/17.
6 | // Copyright © 2017年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface HCDBody : NSObject
12 |
13 | -(void)work;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/8建造者模式/8建造者模式/HCDLeg.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDLeg.h
3 | // 8建造者模式
4 | //
5 | // Created by huangchengdu on 17/5/17.
6 | // Copyright © 2017年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface HCDLeg : NSObject
12 |
13 | -(void)work;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/11状态模式/11状态模式/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // 11状态模式
4 | //
5 | // Created by yifan on 15/8/14.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ViewController : UIViewController
12 |
13 |
14 | @end
15 |
16 |
--------------------------------------------------------------------------------
/12适配器模式/12适配器模式/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // 12适配器模式
4 | //
5 | // Created by yifan on 15/8/14.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ViewController : UIViewController
12 |
13 |
14 | @end
15 |
16 |
--------------------------------------------------------------------------------
/13备忘录模式/13备忘录模式/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // 13备忘录模式
4 | //
5 | // Created by 黄成都 on 15/8/14.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ViewController : UIViewController
12 |
13 |
14 | @end
15 |
16 |
--------------------------------------------------------------------------------
/15迭代器模式/15迭代器模式/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // 15迭代器模式
4 | //
5 | // Created by 黄成都 on 15/8/15.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ViewController : UIViewController
12 |
13 |
14 | @end
15 |
16 |
--------------------------------------------------------------------------------
/16单列模式/16单列模式/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // 16单列模式
4 | //
5 | // Created by yifan on 15/8/15.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ViewController : UIViewController
12 |
13 |
14 | @end
15 |
16 |
--------------------------------------------------------------------------------
/17桥接模式/17桥接模式/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // 17桥接模式
4 | //
5 | // Created by yifan on 15/8/15.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ViewController : UIViewController
12 |
13 |
14 | @end
15 |
16 |
--------------------------------------------------------------------------------
/18命令模式/18命令模式/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // 18命令模式
4 | //
5 | // Created by yifan on 15/8/15.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ViewController : UIViewController
12 |
13 |
14 | @end
15 |
16 |
--------------------------------------------------------------------------------
/19职责链模式/19职责链模式/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // 19职责链模式
4 | //
5 | // Created by yifan on 15/8/15.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ViewController : UIViewController
12 |
13 |
14 | @end
15 |
16 |
--------------------------------------------------------------------------------
/1简单工厂模式/1简单工厂模式/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // 1简单工厂模式
4 | //
5 | // Created by 黄成都 on 15/8/10.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ViewController : UIViewController
12 |
13 |
14 | @end
15 |
16 |
--------------------------------------------------------------------------------
/20中介者模式/20中介者模式/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // 20中介者模式
4 | //
5 | // Created by yifan on 15/8/15.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ViewController : UIViewController
12 |
13 |
14 | @end
15 |
16 |
--------------------------------------------------------------------------------
/21享元模式/21享元模式/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // 21享元模式
4 | //
5 | // Created by yifan on 15/8/15.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ViewController : UIViewController
12 |
13 |
14 | @end
15 |
16 |
--------------------------------------------------------------------------------
/22解释器模式/22解释器模式/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // 22解释器模式
4 | //
5 | // Created by 黄成都 on 15/8/27.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ViewController : UIViewController
12 |
13 |
14 | @end
15 |
16 |
--------------------------------------------------------------------------------
/23访问者模式/23访问者模式/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // 23访问者模式
4 | //
5 | // Created by 黄成都 on 15/8/27.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ViewController : UIViewController
12 |
13 |
14 | @end
15 |
16 |
--------------------------------------------------------------------------------
/3装饰模式/3装饰模式/Component.h:
--------------------------------------------------------------------------------
1 | //
2 | // Component.h
3 | // 3装饰模式
4 | //
5 | // Created by huangchengdu on 17/5/25.
6 | // Copyright © 2017年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface Component : NSObject
12 |
13 | -(void)operation;
14 | @end
15 |
--------------------------------------------------------------------------------
/5工厂方法模式/5工厂方法模式/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // 5工厂方法模式
4 | //
5 | // Created by yifan on 15/8/12.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ViewController : UIViewController
12 |
13 |
14 | @end
15 |
16 |
--------------------------------------------------------------------------------
/6模板方法模式/6模板方法模式/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // 6模板方法模式
4 | //
5 | // Created by yifan on 15/8/12.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ViewController : UIViewController
12 |
13 |
14 | @end
15 |
16 |
--------------------------------------------------------------------------------
/7外观模式/7外观模式/HCDstock1.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDstock1.h
3 | // 7外观模式
4 | //
5 | // Created by yifan on 15/8/13.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface HCDstock1 : NSObject
12 | -(void)buy;
13 | -(void)sell;
14 | @end
15 |
--------------------------------------------------------------------------------
/7外观模式/7外观模式/HCDstock2.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDstock2.h
3 | // 7外观模式
4 | //
5 | // Created by yifan on 15/8/13.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface HCDstock2 : NSObject
12 | -(void)buy;
13 | -(void)sell;
14 | @end
15 |
--------------------------------------------------------------------------------
/7外观模式/7外观模式/HCDstock3.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDstock3.h
3 | // 7外观模式
4 | //
5 | // Created by yifan on 15/8/13.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface HCDstock3 : NSObject
12 | -(void)buy;
13 | -(void)sell;
14 | @end
15 |
--------------------------------------------------------------------------------
/8建造者模式/8建造者模式/HCDHeader.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDHeader.h
3 | // 8建造者模式
4 | //
5 | // Created by huangchengdu on 17/5/17.
6 | // Copyright © 2017年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface HCDHeader : NSObject
12 |
13 | -(void)work;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/8建造者模式/8建造者模式/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // 8建造者模式
4 | //
5 | // Created by yifan on 15/8/13.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ViewController : UIViewController
12 |
13 |
14 | @end
15 |
16 |
--------------------------------------------------------------------------------
/9观察者模式/9观察者模式/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // 9观察者模式
4 | //
5 | // Created by yifan on 15/8/13.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ViewController : UIViewController
12 |
13 |
14 | @end
15 |
16 |
--------------------------------------------------------------------------------
/10抽象工厂模式/10抽象工厂模式/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // 10抽象工厂模式
4 | //
5 | // Created by yifan on 15/8/14.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ViewController : UIViewController
12 |
13 |
14 | @end
15 |
16 |
--------------------------------------------------------------------------------
/23访问者模式/23访问者模式/HCDConcreteElementB.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDElementB.h
3 | // 23访问者模式
4 | //
5 | // Created by 黄成都 on 15/8/27.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDElements.h"
10 |
11 | @interface HCDConcreteElementB : HCDElements
12 | -(void)operationB;
13 | @end
14 |
--------------------------------------------------------------------------------
/7外观模式/7外观模式/HCDFound.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDFound.h
3 | // 7外观模式
4 | //
5 | // Created by yifan on 15/8/13.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface HCDFound : NSObject
12 | -(void)buyFund;
13 | -(void)sellFund;
14 | @end
15 |
--------------------------------------------------------------------------------
/9观察者模式/9观察者模式/HCDObserver.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDObserver.h
3 | // 9观察者模式
4 | //
5 | // Created by yifan on 15/8/13.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @protocol HCDObserver
12 | @optional
13 | -(void)update;
14 | @end
15 |
--------------------------------------------------------------------------------
/11状态模式/11状态模式/HCDNoonState.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDNoonState.h
3 | // 11状态模式
4 | //
5 | // Created by yifan on 15/8/14.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "HCDState.h"
11 | @interface HCDNoonState : NSObject
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/11状态模式/11状态模式/HCDRestState.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDRestState.h
3 | // 11状态模式
4 | //
5 | // Created by yifan on 15/8/14.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "HCDState.h"
11 | @interface HCDRestState : NSObject
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/16单列模式/16单列模式/HCDSingleton.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDSingleton.h
3 | // 16单列模式
4 | //
5 | // Created by yifan on 15/8/15.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface HCDSingleton : NSObject
12 | +(instancetype)sharedInstance;
13 | @end
14 |
--------------------------------------------------------------------------------
/21享元模式/21享元模式/HCDUser.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDUser.h
3 | // 21享元模式
4 | //
5 | // Created by yifan on 15/8/27.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface HCDUser : NSObject
12 | @property(nonatomic,strong)NSString *name;
13 | @end
14 |
--------------------------------------------------------------------------------
/24原型模式/24原型模式/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // 24原型模式
4 | //
5 | // Created by huangchengdu on 17/5/16.
6 | // Copyright © 2017年 huangchengdu. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ViewController : UIViewController
12 |
13 |
14 | @end
15 |
16 |
--------------------------------------------------------------------------------
/11状态模式/11状态模式/HCDSleepState.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDSleepState.h
3 | // 11状态模式
4 | //
5 | // Created by yifan on 15/8/14.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "HCDState.h"
11 | @interface HCDSleepState : NSObject
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/22解释器模式/22解释器模式/HCDTerminalExpression.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDTerminalExpression.h
3 | // 22解释器模式
4 | //
5 | // Created by 黄成都 on 15/8/27.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDAbstractExpression.h"
10 |
11 | @interface HCDTerminalExpression : HCDAbstractExpression
12 | @end
13 |
--------------------------------------------------------------------------------
/23访问者模式/23访问者模式/HCDConcreteElementA.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDConcreteElementA.h
3 | // 23访问者模式
4 | //
5 | // Created by 黄成都 on 15/8/27.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDElements.h"
10 |
11 | @interface HCDConcreteElementA : HCDElements
12 | -(void)operationA;
13 | @end
14 |
--------------------------------------------------------------------------------
/2策略模式/2策略模式/HCDCashNormal.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDCashNormal.h
3 | // 2策略模式
4 | //
5 | // Created by 黄成都 on 15/8/11.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "HCDCashBase.h"
11 | @interface HCDCashNormal : NSObject
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/11状态模式/11状态模式/HCDState.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDState.h
3 | // 11状态模式
4 | //
5 | // Created by yifan on 15/8/14.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | @class HCDWork;
11 | @protocol HCDState
12 | -(void)writeProgram:(HCDWork *)work;
13 | @end
14 |
--------------------------------------------------------------------------------
/21享元模式/21享元模式/HCDWebSite.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDWebSite.h
3 | // 21享元模式
4 | //
5 | // Created by yifan on 15/8/27.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "HCDUser.h"
11 | @protocol HCDWebSite
12 | -(void)use:(HCDUser *)user;
13 | @end
14 |
--------------------------------------------------------------------------------
/8建造者模式/8建造者模式/HCDArm.m:
--------------------------------------------------------------------------------
1 | //
2 | // HCDArm.m
3 | // 8建造者模式
4 | //
5 | // Created by huangchengdu on 17/5/17.
6 | // Copyright © 2017年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDArm.h"
10 |
11 | @implementation HCDArm
12 |
13 | -(void)work{
14 | NSLog(@"成功构建了手臂------HCDArm");
15 | }
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/8建造者模式/8建造者模式/HCDLeg.m:
--------------------------------------------------------------------------------
1 | //
2 | // HCDLeg.m
3 | // 8建造者模式
4 | //
5 | // Created by huangchengdu on 17/5/17.
6 | // Copyright © 2017年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDLeg.h"
10 |
11 | @implementation HCDLeg
12 |
13 | -(void)work{
14 | NSLog(@"成功构建了腿------HCDLeg");
15 | }
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/11状态模式/11状态模式/HCDAfternoonState.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDAfternoonState.h
3 | // 11状态模式
4 | //
5 | // Created by yifan on 15/8/14.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "HCDState.h"
11 | @interface HCDAfternoonState : NSObject
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/11状态模式/11状态模式/HCDForenoonState.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDForenoonState.h
3 | // 11状态模式
4 | //
5 | // Created by yifan on 15/8/14.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "HCDState.h"
11 | @interface HCDForenoonState : NSObject
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/23访问者模式/23访问者模式/HCDElements.m:
--------------------------------------------------------------------------------
1 | //
2 | // HCDElements.m
3 | // 23访问者模式
4 | //
5 | // Created by 黄成都 on 15/8/27.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDElements.h"
10 |
11 | @implementation HCDElements
12 | -(void)accept:(HCDVisitors *)visitor{
13 | return;
14 | }
15 | @end
16 |
--------------------------------------------------------------------------------
/4代理模式/4代理模式/HCDschoolGirl.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDschoolGirl.h
3 | // 4代理模式
4 | //
5 | // Created by yifan on 15/8/12.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface HCDschoolGirl : NSObject
12 | @property(nonatomic,strong)NSString *name;
13 | @end
14 |
--------------------------------------------------------------------------------
/8建造者模式/8建造者模式/HCDBody.m:
--------------------------------------------------------------------------------
1 | //
2 | // HCDBody.m
3 | // 8建造者模式
4 | //
5 | // Created by huangchengdu on 17/5/17.
6 | // Copyright © 2017年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDBody.h"
10 |
11 | @implementation HCDBody
12 |
13 | -(void)work{
14 | NSLog(@"成功构建了身体-----HCDBody");
15 | }
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/9观察者模式/9观察者模式/HCDNBAObserver.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDNBAObserver.h
3 | // 9观察者模式
4 | //
5 | // Created by yifan on 15/8/13.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "HCDObserver.h"
11 | @interface HCDNBAObserver : NSObject
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/10抽象工厂模式/10抽象工厂模式/HCDSqlserverUser.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDSqlserverUser.h
3 | // 10抽象工厂模式
4 | //
5 | // Created by yifan on 15/8/14.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "HCDUser.h"
11 | @interface HCDSqlserverUser : NSObject
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/20中介者模式/20中介者模式/ConcreteMediator.h:
--------------------------------------------------------------------------------
1 | //
2 | // ConcreteMediator.h
3 | // 20中介者模式
4 | //
5 | // Created by huangchengdu on 17/5/22.
6 | // Copyright © 2017年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "Mediator.h"
10 |
11 | @class Colleague;
12 |
13 | @interface ConcreteMediator : Mediator
14 |
15 |
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/22解释器模式/22解释器模式/HCDNonterminalExpression.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDNonterminalEXPRESSION.h
3 | // 22解释器模式
4 | //
5 | // Created by 黄成都 on 15/8/27.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDAbstractExpression.h"
10 |
11 | @interface HCDNonterminalExpression : HCDAbstractExpression
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/5工厂方法模式/5工厂方法模式/HCDCalculateAdd.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDCalculateAdd.h
3 | // 1简单工厂模式
4 | //
5 | // Created by 黄成都 on 15/8/10.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "HCDCalculate.h"
11 | @interface HCDCalculateAdd : NSObject
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/8建造者模式/8建造者模式/HCDHeader.m:
--------------------------------------------------------------------------------
1 | //
2 | // HCDHeader.m
3 | // 8建造者模式
4 | //
5 | // Created by huangchengdu on 17/5/17.
6 | // Copyright © 2017年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDHeader.h"
10 |
11 | @implementation HCDHeader
12 |
13 | -(void)work{
14 | NSLog(@"成功构建了头-----HCDHead");
15 | }
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/9观察者模式/9观察者模式/HCDStockObserver.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDStockObserver.h
3 | // 9观察者模式
4 | //
5 | // Created by yifan on 15/8/13.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "HCDObserver.h"
11 | @interface HCDStockObserver : NSObject
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/10抽象工厂模式/10抽象工厂模式/HCDAccessFactory.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDAccessFactory.h
3 | // 10抽象工厂模式
4 | //
5 | // Created by yifan on 15/8/14.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "HCDFactory.h"
11 | @interface HCDAccessFactory : NSObject
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/1简单工厂模式/1简单工厂模式/HCDCalculateAdd.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDCalculateAdd.h
3 | // 1简单工厂模式
4 | //
5 | // Created by 黄成都 on 15/8/10.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "HCDCalculate.h"
11 |
12 | @interface HCDCalculateAdd : NSObject
13 |
14 | @end
15 |
--------------------------------------------------------------------------------
/1简单工厂模式/1简单工厂模式/HCDCalculateMinus.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDCalculateMinus.h
3 | // 1简单工厂模式
4 | //
5 | // Created by 黄成都 on 15/8/10.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "HCDCalculate.h"
11 | @interface HCDCalculateMinus : NSObject
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/24原型模式/24原型模式/Dot.h:
--------------------------------------------------------------------------------
1 | //
2 | // Dot.h
3 | // 24原型模式
4 | //
5 | // Created by huangchengdu on 17/5/16.
6 | // Copyright © 2017年 huangchengdu. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 | #import "Mark.h"
12 |
13 | @interface Dot : NSObject
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/3装饰模式/3装饰模式/Decorator.h:
--------------------------------------------------------------------------------
1 | //
2 | // Decorator.h
3 | // 3装饰模式
4 | //
5 | // Created by huangchengdu on 17/5/25.
6 | // Copyright © 2017年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "Component.h"
10 |
11 | @interface Decorator : Component
12 | //装饰对象需要装饰的原始对象
13 | @property(nonatomic, strong)Component *component;
14 | @end
15 |
--------------------------------------------------------------------------------
/5工厂方法模式/5工厂方法模式/HCDCalculateMinus.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDCalculateMinus.h
3 | // 1简单工厂模式
4 | //
5 | // Created by 黄成都 on 15/8/10.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "HCDCalculate.h"
11 | @interface HCDCalculateMinus : NSObject
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/9观察者模式/9观察者模式/HCDNBAObserver.m:
--------------------------------------------------------------------------------
1 | //
2 | // HCDNBAObserver.m
3 | // 9观察者模式
4 | //
5 | // Created by yifan on 15/8/13.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDNBAObserver.h"
10 |
11 | @implementation HCDNBAObserver
12 | -(void)update{
13 | NSLog(@"擦,老板回来了,待会儿继续看NBA");
14 | }
15 | @end
16 |
--------------------------------------------------------------------------------
/10抽象工厂模式/10抽象工厂模式/HCDSqlserverFactory.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDUserFactory.h
3 | // 10抽象工厂模式
4 | //
5 | // Created by yifan on 15/8/14.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "HCDFactory.h"
11 | @interface HCDSqlserverFactory : NSObject
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/17桥接模式/17桥接模式/HCDGameSoftware.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDGameSoftware.h
3 | // 17桥接模式
4 | //
5 | // Created by yifan on 15/8/15.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "HCDSoftware.h"
11 |
12 |
13 | @interface HCDGameSoftware : NSObject
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/17桥接模式/17桥接模式/HCDPlaySoftWare.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDPlaySoftWare.h
3 | // 17桥接模式
4 | //
5 | // Created by huangchengdu on 17/5/18.
6 | // Copyright © 2017年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "HCDSoftware.h"
11 |
12 | @interface HCDPlaySoftWare : NSObject
13 |
14 | @end
15 |
--------------------------------------------------------------------------------
/17桥接模式/17桥接模式/HCDWorkSoftWare.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDWorkSoftWare.h
3 | // 17桥接模式
4 | //
5 | // Created by huangchengdu on 17/5/18.
6 | // Copyright © 2017年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "HCDSoftware.h"
11 |
12 | @interface HCDWorkSoftWare : NSObject
13 |
14 | @end
15 |
--------------------------------------------------------------------------------
/1简单工厂模式/1简单工厂模式/HCDCalculateDivide.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDCalculateDivide.h
3 | // 1简单工厂模式
4 | //
5 | // Created by 黄成都 on 15/8/10.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "HCDCalculate.h"
11 | @interface HCDCalculateDivide : NSObject
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/1简单工厂模式/1简单工厂模式/HCDCalcuteMultiply.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDCalcuteMultiply.h
3 | // 1简单工厂模式
4 | //
5 | // Created by 黄成都 on 15/8/10.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "HCDCalculate.h"
11 | @interface HCDCalcuteMultiply : NSObject
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/5工厂方法模式/5工厂方法模式/HCDCalculateDivide.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDCalculateDivide.h
3 | // 1简单工厂模式
4 | //
5 | // Created by 黄成都 on 15/8/10.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "HCDCalculate.h"
11 | @interface HCDCalculateDivide : NSObject
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/5工厂方法模式/5工厂方法模式/HCDCalcuteMultiply.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDCalcuteMultiply.h
3 | // 1简单工厂模式
4 | //
5 | // Created by 黄成都 on 15/8/10.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "HCDCalculate.h"
11 | @interface HCDCalcuteMultiply : NSObject
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/9观察者模式/9观察者模式/HCDStockObserver.m:
--------------------------------------------------------------------------------
1 | //
2 | // HCDStockObserver.m
3 | // 9观察者模式
4 | //
5 | // Created by yifan on 15/8/13.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDStockObserver.h"
10 |
11 | @implementation HCDStockObserver
12 | -(void)update{
13 | NSLog(@"操。。老板回来了,带会儿再看");
14 | }
15 | @end
16 |
--------------------------------------------------------------------------------
/10抽象工厂模式/10抽象工厂模式/HCDAccessUser.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDAccessUser.h
3 | // 10抽象工厂模式
4 | //
5 | // Created by yifan on 15/8/14.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "HCDUser.h"
11 | #import "SQLUser.h"
12 | @interface HCDAccessUser : NSObject
13 |
14 | @end
15 |
--------------------------------------------------------------------------------
/7外观模式/7外观模式/HCDstock1.m:
--------------------------------------------------------------------------------
1 | //
2 | // HCDstock1.m
3 | // 7外观模式
4 | //
5 | // Created by yifan on 15/8/13.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDstock1.h"
10 |
11 | @implementation HCDstock1
12 | -(void)buy{
13 | NSLog(@"买入股票1");
14 | }
15 | -(void)sell{
16 | NSLog(@"卖出股票1");
17 | }
18 | @end
19 |
--------------------------------------------------------------------------------
/7外观模式/7外观模式/HCDstock2.m:
--------------------------------------------------------------------------------
1 | //
2 | // HCDstock2.m
3 | // 7外观模式
4 | //
5 | // Created by yifan on 15/8/13.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDstock2.h"
10 |
11 | @implementation HCDstock2
12 | -(void)buy{
13 | NSLog(@"买入股票2");
14 | }
15 | -(void)sell{
16 | NSLog(@"卖出股票2");
17 | }
18 | @end
19 |
--------------------------------------------------------------------------------
/7外观模式/7外观模式/HCDstock3.m:
--------------------------------------------------------------------------------
1 | //
2 | // HCDstock3.m
3 | // 7外观模式
4 | //
5 | // Created by yifan on 15/8/13.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDstock3.h"
10 |
11 | @implementation HCDstock3
12 | -(void)buy{
13 | NSLog(@"买入股票3");
14 | }
15 | -(void)sell{
16 | NSLog(@"卖出股票3");
17 | }
18 | @end
19 |
--------------------------------------------------------------------------------
/10抽象工厂模式/10抽象工厂模式/HCDAccessDepartment.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDAccessDepartment.h
3 | // 10抽象工厂模式
4 | //
5 | // Created by yifan on 15/8/14.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "HCDDepartment.h"
11 | @interface HCDAccessDepartment : NSObject
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/10抽象工厂模式/10抽象工厂模式/HCDUser.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDUser.h
3 | // 10抽象工厂模式
4 | //
5 | // Created by yifan on 15/8/14.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "SQLUser.h"
11 | @protocol HCDUser
12 | -(void)insertUser:(SQLUser *)user;
13 | -(SQLUser *)getUser;
14 | @end
15 |
--------------------------------------------------------------------------------
/23访问者模式/23访问者模式/HCDElements.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDElements.h
3 | // 23访问者模式
4 | //
5 | // Created by 黄成都 on 15/8/27.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @class HCDVisitors;
12 |
13 | @interface HCDElements : NSObject
14 | -(void)accept:(HCDVisitors *)visitor;
15 | @end
16 |
--------------------------------------------------------------------------------
/5工厂方法模式/5工厂方法模式/HCDfactory.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDfactory.h
3 | // 5工厂方法模式
4 | //
5 | // Created by yifan on 15/8/12.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "HCDCalculate.h"
11 | @interface HCDfactory : NSObject
12 | -(id)createFactory;
13 | @end
14 |
--------------------------------------------------------------------------------
/24原型模式/24原型模式/Verter.h:
--------------------------------------------------------------------------------
1 | //
2 | // Verter.h
3 | // 24原型模式
4 | //
5 | // Created by huangchengdu on 17/5/16.
6 | // Copyright © 2017年 huangchengdu. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 | #import "Mark.h"
12 |
13 |
14 | @interface Verter : NSObject
15 |
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/8建造者模式/8建造者模式/HCDPersonFatBuilder.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDPersonFatBuilder.h
3 | // 8建造者模式
4 | //
5 | // Created by yifan on 15/8/13.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "HCDPresionBuilder.h"
11 |
12 | @interface HCDPersonFatBuilder : NSObject
13 |
14 | @end
15 |
--------------------------------------------------------------------------------
/10抽象工厂模式/10抽象工厂模式/HCDSqlserverDepartment.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDSqlserverDepartment.h
3 | // 10抽象工厂模式
4 | //
5 | // Created by yifan on 15/8/14.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "HCDDepartment.h"
11 | @interface HCDSqlserverDepartment : NSObject
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/12适配器模式/12适配器模式/HCDTranslator.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDTranslator.h
3 | // 12适配器模式
4 | //
5 | // Created by 黄成都 on 15/8/14.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDPlayer.h"
10 | @class HCDForeignCenter;
11 | @interface HCDTranslator : HCDPlayer
12 | @property(nonatomic,strong)HCDForeignCenter *foreigncenter;
13 | @end
14 |
--------------------------------------------------------------------------------
/2策略模式/2策略模式/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // 2策略模式
4 | //
5 | // Created by 黄成都 on 15/8/11.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 |
16 | @end
17 |
18 |
--------------------------------------------------------------------------------
/8建造者模式/8建造者模式/HCDPersonThinBuilder.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDPersonThinBuilder.h
3 | // 8建造者模式
4 | //
5 | // Created by yifan on 15/8/13.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "HCDPresionBuilder.h"
11 |
12 | @interface HCDPersonThinBuilder : NSObject
13 |
14 | @end
15 |
--------------------------------------------------------------------------------
/11状态模式/11状态模式/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // 11状态模式
4 | //
5 | // Created by yifan on 15/8/14.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 |
16 | @end
17 |
18 |
--------------------------------------------------------------------------------
/14组合模式/14组合模式/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // 14组合模式
4 | //
5 | // Created by 黄成都 on 15/8/15.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 |
16 | @end
17 |
18 |
--------------------------------------------------------------------------------
/16单列模式/16单列模式/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // 16单列模式
4 | //
5 | // Created by yifan on 15/8/15.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 |
16 | @end
17 |
18 |
--------------------------------------------------------------------------------
/17桥接模式/17桥接模式/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // 17桥接模式
4 | //
5 | // Created by yifan on 15/8/15.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 |
16 | @end
17 |
18 |
--------------------------------------------------------------------------------
/18命令模式/18命令模式/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // 18命令模式
4 | //
5 | // Created by yifan on 15/8/15.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 |
16 | @end
17 |
18 |
--------------------------------------------------------------------------------
/21享元模式/21享元模式/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // 21享元模式
4 | //
5 | // Created by yifan on 15/8/15.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 |
16 | @end
17 |
18 |
--------------------------------------------------------------------------------
/22解释器模式/22解释器模式/HCDAbstractExpression.m:
--------------------------------------------------------------------------------
1 | //
2 | // HCDAbstractExpression.m
3 | // 22解释器模式
4 | //
5 | // Created by 黄成都 on 15/8/27.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDAbstractExpression.h"
10 |
11 | @implementation HCDAbstractExpression
12 | -(void)interpret:(HCDContext *)context{
13 | return;
14 | }
15 | @end
16 |
--------------------------------------------------------------------------------
/3装饰模式/3装饰模式/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // 3装饰模式
4 | //
5 | // Created by yifan on 15/8/12.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 |
16 | @end
17 |
18 |
--------------------------------------------------------------------------------
/4代理模式/4代理模式/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // 4代理模式
4 | //
5 | // Created by yifan on 15/8/12.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 |
16 | @end
17 |
18 |
--------------------------------------------------------------------------------
/7外观模式/7外观模式/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // 7外观模式
4 | //
5 | // Created by yifan on 15/8/13.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 |
16 | @end
17 |
18 |
--------------------------------------------------------------------------------
/8建造者模式/8建造者模式/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // 8建造者模式
4 | //
5 | // Created by yifan on 15/8/13.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 |
16 | @end
17 |
18 |
--------------------------------------------------------------------------------
/9观察者模式/9观察者模式/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // 9观察者模式
4 | //
5 | // Created by yifan on 15/8/13.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 |
16 | @end
17 |
18 |
--------------------------------------------------------------------------------
/12适配器模式/12适配器模式/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // 12适配器模式
4 | //
5 | // Created by yifan on 15/8/14.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 |
16 | @end
17 |
18 |
--------------------------------------------------------------------------------
/13备忘录模式/13备忘录模式/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // 13备忘录模式
4 | //
5 | // Created by 黄成都 on 15/8/14.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 |
16 | @end
17 |
18 |
--------------------------------------------------------------------------------
/15迭代器模式/15迭代器模式/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // 15迭代器模式
4 | //
5 | // Created by 黄成都 on 15/8/15.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 |
16 | @end
17 |
18 |
--------------------------------------------------------------------------------
/19职责链模式/19职责链模式/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // 19职责链模式
4 | //
5 | // Created by yifan on 15/8/15.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 |
16 | @end
17 |
18 |
--------------------------------------------------------------------------------
/1简单工厂模式/1简单工厂模式/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // 1简单工厂模式
4 | //
5 | // Created by 黄成都 on 15/8/10.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 |
16 | @end
17 |
18 |
--------------------------------------------------------------------------------
/20中介者模式/20中介者模式/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // 20中介者模式
4 | //
5 | // Created by yifan on 15/8/15.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 |
16 | @end
17 |
18 |
--------------------------------------------------------------------------------
/22解释器模式/22解释器模式/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // 22解释器模式
4 | //
5 | // Created by 黄成都 on 15/8/27.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 |
16 | @end
17 |
18 |
--------------------------------------------------------------------------------
/22解释器模式/22解释器模式/HCDAbstractExpression.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDAbstractExpression.h
3 | // 22解释器模式
4 | //
5 | // Created by 黄成都 on 15/8/27.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "HCDContext.h"
11 | @interface HCDAbstractExpression : NSObject
12 | -(void)interpret:(HCDContext *)context;
13 | @end
14 |
--------------------------------------------------------------------------------
/23访问者模式/23访问者模式/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // 23访问者模式
4 | //
5 | // Created by 黄成都 on 15/8/27.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 |
16 | @end
17 |
18 |
--------------------------------------------------------------------------------
/2策略模式/2策略模式/HCDCaseReturn.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDCaseReturn.h
3 | // 2策略模式
4 | //
5 | // Created by 黄成都 on 15/8/11.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "HCDCashBase.h"
11 | @interface HCDCaseReturn : NSObject
12 | -(instancetype)initWithMoneyReturn:(CGFloat)moneyReturn;
13 | @end
14 |
--------------------------------------------------------------------------------
/2策略模式/2策略模式/HCDCashRobate.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDCashRobate.h
3 | // 2策略模式
4 | //
5 | // Created by 黄成都 on 15/8/11.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "HCDCashBase.h"
11 | @interface HCDCashRobate : NSObject
12 | -(instancetype)initWithMoneyRebate:(CGFloat)moneyRebate;
13 | @end
14 |
--------------------------------------------------------------------------------
/5工厂方法模式/5工厂方法模式/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // 5工厂方法模式
4 | //
5 | // Created by yifan on 15/8/12.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 |
16 | @end
17 |
18 |
--------------------------------------------------------------------------------
/6模板方法模式/6模板方法模式/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // 6模板方法模式
4 | //
5 | // Created by yifan on 15/8/12.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 |
16 | @end
17 |
18 |
--------------------------------------------------------------------------------
/10抽象工厂模式/10抽象工厂模式/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // 10抽象工厂模式
4 | //
5 | // Created by yifan on 15/8/14.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 |
16 | @end
17 |
18 |
--------------------------------------------------------------------------------
/11状态模式/11状态模式/HCDEventState.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDEventState.h
3 | // 11状态模式
4 | //
5 | // Created by yifan on 15/8/14.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "HCDState.h"
11 | #import "HCDRestState.h"
12 | #import "HCDSleepState.h"
13 | @interface HCDEventState : NSObject
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/2策略模式/2策略模式/HCDCashNormal.m:
--------------------------------------------------------------------------------
1 | //
2 | // HCDCashNormal.m
3 | // 2策略模式
4 | //
5 | // Created by 黄成都 on 15/8/11.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDCashNormal.h"
10 |
11 | @implementation HCDCashNormal
12 |
13 | //@synthesize money = _money;
14 |
15 | -(CGFloat)acceptCash:(CGFloat)cash{
16 | return cash;
17 | }
18 | @end
19 |
--------------------------------------------------------------------------------
/3装饰模式/3装饰模式/ConcreteComponent.m:
--------------------------------------------------------------------------------
1 | //
2 | // ConcreteComponent.m
3 | // 3装饰模式
4 | //
5 | // Created by huangchengdu on 17/5/25.
6 | // Copyright © 2017年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "ConcreteComponent.h"
10 |
11 | @implementation ConcreteComponent
12 |
13 | - (void)operation{
14 | NSLog(@"ConcreteComponent具体对象的操作,装饰之前");
15 | }
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/3装饰模式/3装饰模式/Decorator.m:
--------------------------------------------------------------------------------
1 | //
2 | // Decorator.m
3 | // 3装饰模式
4 | //
5 | // Created by huangchengdu on 17/5/25.
6 | // Copyright © 2017年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "Decorator.h"
10 |
11 | @implementation Decorator
12 |
13 | -(void)operation{
14 | if (self.component) {
15 | [self.component operation];
16 | }
17 | }
18 |
19 | @end
20 |
--------------------------------------------------------------------------------
/11状态模式/11状态模式/HCDRestState.m:
--------------------------------------------------------------------------------
1 | //
2 | // HCDRestState.m
3 | // 11状态模式
4 | //
5 | // Created by yifan on 15/8/14.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDRestState.h"
10 | #import "HCDWork.h"
11 | @implementation HCDRestState
12 | - (void)writeProgram:(HCDWork *)work {
13 | NSLog(@"当前时间:{%.f}点,下班回家了", work.hour);
14 | }
15 | @end
16 |
--------------------------------------------------------------------------------
/19职责链模式/19职责链模式/HCDReuquest.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDReuquest.h
3 | // 19职责链模式
4 | //
5 | // Created by yifan on 15/8/15.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface HCDReuquest : NSObject
12 | @property(nonatomic,copy)NSString *requestType;
13 | @property(nonatomic,assign)NSInteger number;
14 | @end
15 |
--------------------------------------------------------------------------------
/21享元模式/21享元模式/HCDConcreteWebSite.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDConcreteWebSite.h
3 | // 21享元模式
4 | //
5 | // Created by yifan on 15/8/27.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "HCDWebSite.h"
11 | @interface HCDConcreteWebSite : NSObject
12 | @property(nonatomic,strong)NSString *webName;
13 | @end
14 |
--------------------------------------------------------------------------------
/21享元模式/21享元模式/HCDConcreteWebSite.m:
--------------------------------------------------------------------------------
1 | //
2 | // HCDConcreteWebSite.m
3 | // 21享元模式
4 | //
5 | // Created by yifan on 15/8/27.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDConcreteWebSite.h"
10 |
11 | @implementation HCDConcreteWebSite
12 | -(void)use:(HCDUser *)user{
13 | NSLog(@"网站分类:%@,用户:%@",self.webName,user.name);
14 | }
15 | @end
16 |
--------------------------------------------------------------------------------
/24原型模式/24原型模式/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // 24原型模式
4 | //
5 | // Created by huangchengdu on 17/5/16.
6 | // Copyright © 2017年 huangchengdu. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 |
16 | @end
17 |
18 |
--------------------------------------------------------------------------------
/2策略模式/2策略模式/HCDCashBase.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDCashBase.h
3 | // 2策略模式
4 | //
5 | // Created by 黄成都 on 15/8/11.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 | @protocol HCDCashBase
12 | //@property(nonatomic,assign)CGFloat money;
13 | -(CGFloat)acceptCash:(CGFloat)cash;
14 | @end
15 |
--------------------------------------------------------------------------------
/3装饰模式/3装饰模式/ConcreteDecoratorA.h:
--------------------------------------------------------------------------------
1 | //
2 | // ConcreteDecoratorA.h
3 | // 3装饰模式
4 | //
5 | // Created by huangchengdu on 17/5/25.
6 | // Copyright © 2017年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "Decorator.h"
10 |
11 | @interface ConcreteDecoratorA : Decorator
12 | //本类独有属性,区别于ConcreteDecoratorB这个装饰者
13 | @property(nonatomic, copy)NSString *addedState;
14 | @end
15 |
--------------------------------------------------------------------------------
/6模板方法模式/6模板方法模式/HCDtextPaperA.m:
--------------------------------------------------------------------------------
1 | //
2 | // HCDtextPaperA.m
3 | // 6模板方法模式
4 | //
5 | // Created by yifan on 15/8/12.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDtextPaperA.h"
10 |
11 | @implementation HCDtextPaperA
12 | -(NSString *)answer1{
13 | return @"b";
14 | }
15 | -(NSString *)answer2{
16 | return @"c";
17 | }
18 | @end
19 |
--------------------------------------------------------------------------------
/6模板方法模式/6模板方法模式/HCDtextPaperB.m:
--------------------------------------------------------------------------------
1 | //
2 | // HCDtextPaperB.m
3 | // 6模板方法模式
4 | //
5 | // Created by yifan on 15/8/12.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDtextPaperB.h"
10 |
11 | @implementation HCDtextPaperB
12 | -(NSString *)answer1{
13 | return @"a";
14 | }
15 | -(NSString *)answer2{
16 | return @"d";
17 | }
18 | @end
19 |
--------------------------------------------------------------------------------
/11状态模式/11状态模式/HCDSleepState.m:
--------------------------------------------------------------------------------
1 | //
2 | // HCDSleepState.m
3 | // 11状态模式
4 | //
5 | // Created by yifan on 15/8/14.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDSleepState.h"
10 | #import "HCDWork.h"
11 | @implementation HCDSleepState
12 | - (void)writeProgram:(HCDWork *)work {
13 | NSLog(@"当前时间:{%.f}点,不行了,睡着了", work.hour);
14 | }
15 | @end
16 |
--------------------------------------------------------------------------------
/12适配器模式/12适配器模式/HCDForwards.m:
--------------------------------------------------------------------------------
1 | //
2 | // HCDForwards.m
3 | // 12适配器模式
4 | //
5 | // Created by 黄成都 on 15/8/14.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDForwards.h"
10 |
11 | @implementation HCDForwards
12 | -(void)attack{
13 | NSLog(@"前锋%@进攻",self.name);
14 | }
15 | -(void)defense{
16 | NSLog(@"前锋%@防守",self.name);
17 | }
18 | @end
19 |
--------------------------------------------------------------------------------
/5工厂方法模式/5工厂方法模式/HCDfactoryAdd.m:
--------------------------------------------------------------------------------
1 | //
2 | // HCDfactoryAdd.m
3 | // 5工厂方法模式
4 | //
5 | // Created by yifan on 15/8/12.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDfactoryAdd.h"
10 | #import "HCDCalculateAdd.h"
11 | @implementation HCDfactoryAdd
12 | -(id)createFactory{
13 | return [[HCDCalculateAdd alloc]init];
14 | }
15 | @end
16 |
--------------------------------------------------------------------------------
/6模板方法模式/6模板方法模式/HCDtextPaper.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDtextPaper.h
3 | // 6模板方法模式
4 | //
5 | // Created by yifan on 15/8/12.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface HCDtextPaper : NSObject
12 | - (void)testQuestion1;
13 | - (NSString *)answer1;
14 | - (void)testQuestion2;
15 | - (NSString *)answer2;
16 | @end
17 |
--------------------------------------------------------------------------------
/18命令模式/18命令模式/HCDDuckOrder.m:
--------------------------------------------------------------------------------
1 | //
2 | // HCDDuckOrder.m
3 | // 18命令模式
4 | //
5 | // Created by huangchengdu on 17/6/1.
6 | // Copyright © 2017年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDDuckOrder.h"
10 |
11 | @implementation HCDDuckOrder
12 |
13 | -(void)executeOrder{
14 | NSLog(@"烤鸭");
15 | [[HCDWorker sharedWorker] doChickenWork:self.orderString];
16 | }
17 | @end
18 |
--------------------------------------------------------------------------------
/10抽象工厂模式/10抽象工厂模式/HCDFactory.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDFactory.h
3 | // 10抽象工厂模式
4 | //
5 | // Created by yifan on 15/8/14.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "HCDUser.h"
11 | #import "HCDDepartment.h"
12 | @protocol HCDFactory
13 | -(id)createUser;
14 | -(id)createDepartment;
15 | @end
16 |
--------------------------------------------------------------------------------
/18命令模式/18命令模式/HCDMuttonOrder.m:
--------------------------------------------------------------------------------
1 | //
2 | // HCDMuttonOrder.m
3 | // 18命令模式
4 | //
5 | // Created by yifan on 15/8/15.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDMuttonOrder.h"
10 |
11 | @implementation HCDMuttonOrder
12 |
13 | -(void)executeOrder{
14 | NSLog(@"烤羊");
15 | [[HCDWorker sharedWorker] doMuttonWork:self.orderString];
16 | }
17 | @end
18 |
--------------------------------------------------------------------------------
/5工厂方法模式/5工厂方法模式/HCDfactoryMinus.m:
--------------------------------------------------------------------------------
1 | //
2 | // HCDfactoryMinus.m
3 | // 5工厂方法模式
4 | //
5 | // Created by yifan on 15/8/12.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDfactoryMinus.h"
10 | #import "HCDCalculateMinus.h"
11 | @implementation HCDfactoryMinus
12 | -(id)createFactory{
13 | return [[HCDCalculateMinus alloc]init];
14 | }
15 | @end
16 |
--------------------------------------------------------------------------------
/10抽象工厂模式/10抽象工厂模式/HCDDepartment.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDDepartment.h
3 | // 10抽象工厂模式
4 | //
5 | // Created by yifan on 15/8/14.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "SQLDepartment.h"
11 | @protocol HCDDepartment
12 | -(void)insertDepartment:(SQLDepartment *)department;
13 | -(SQLDepartment *)getDepartment;
14 | @end
15 |
--------------------------------------------------------------------------------
/12适配器模式/12适配器模式/HCDPlayer.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDPlayer.h
3 | // 12适配器模式
4 | //
5 | // Created by 黄成都 on 15/8/14.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface HCDPlayer : NSObject
12 | @property(nonatomic,copy)NSString *name;
13 | -(void)attack;
14 | -(void)defense;
15 | -(instancetype)initWithName:(NSString *)name;
16 | @end
17 |
--------------------------------------------------------------------------------
/14组合模式/14组合模式/HCDCompany.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDCompany.h
3 | // 14组合模式
4 | //
5 | // Created by 黄成都 on 15/8/15.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @protocol HCDCompany
12 |
13 | -(void)add:(id)company;
14 | -(void)remove:(id)company;
15 | -(void)display;
16 | -(void)lineofDuty;
17 | @end
18 |
--------------------------------------------------------------------------------
/18命令模式/18命令模式/HCDChickenOrder.m:
--------------------------------------------------------------------------------
1 | //
2 | // HCDChickenOrder.m
3 | // 18命令模式
4 | //
5 | // Created by yifan on 15/8/15.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDChickenOrder.h"
10 |
11 | @implementation HCDChickenOrder
12 |
13 | -(void)executeOrder{
14 | NSLog(@"烤鸡");
15 | [[HCDWorker sharedWorker] doChickenWork:self.orderString];
16 | }
17 | @end
18 |
--------------------------------------------------------------------------------
/22解释器模式/22解释器模式/HCDTerminalExpression.m:
--------------------------------------------------------------------------------
1 | //
2 | // HCDTerminalExpression.m
3 | // 22解释器模式
4 | //
5 | // Created by 黄成都 on 15/8/27.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDTerminalExpression.h"
10 |
11 | @implementation HCDTerminalExpression
12 | -(void)interpret:(HCDContext *)context{
13 | NSLog(@"终端解释器,context == %@",context.output);
14 | }
15 | @end
16 |
--------------------------------------------------------------------------------
/2策略模式/2策略模式/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // 2策略模式
4 | //
5 | // Created by 黄成都 on 15/8/11.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "AppDelegate.h"
11 |
12 | int main(int argc, char * argv[]) {
13 | @autoreleasepool {
14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/4代理模式/4代理模式/HCDgiveGift.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDgiveGift.h
3 | // 4代理模式
4 | //
5 | // Created by yifan on 15/8/12.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @protocol HCDgiveGift
12 | /// 送洋娃娃
13 | - (void)giveDolls;
14 |
15 | /// 送鲜花
16 | - (void)giveFlowers;
17 |
18 | /// 送巧克力
19 | - (void)giveChocolate;
20 | @end
21 |
--------------------------------------------------------------------------------
/4代理模式/4代理模式/HCDproxy.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDproxy.h
3 | // 4代理模式
4 | //
5 | // Created by yifan on 15/8/12.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "HCDgiveGift.h"
11 | @class HCDschoolGirl,HCDpursuit;
12 | @interface HCDproxy : NSObject
13 | -(instancetype)initWithSchoolGirl:(HCDschoolGirl *)schoolGirl;
14 | @end
15 |
--------------------------------------------------------------------------------
/5工厂方法模式/5工厂方法模式/HCDfactoryDivide.m:
--------------------------------------------------------------------------------
1 | //
2 | // HCDfactoryAdd.m
3 | // 5工厂方法模式
4 | //
5 | // Created by yifan on 15/8/12.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDfactoryDivide.h"
10 | #import "HCDCalculateDivide.h"
11 | @implementation HCDfactoryDivide
12 | -(id)createFactory{
13 | return [[HCDCalculateDivide alloc]init];
14 | }
15 | @end
16 |
--------------------------------------------------------------------------------
/11状态模式/11状态模式/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // 11状态模式
4 | //
5 | // Created by yifan on 15/8/14.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "AppDelegate.h"
11 |
12 | int main(int argc, char * argv[]) {
13 | @autoreleasepool {
14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/14组合模式/14组合模式/HCDHRDepartment.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDDepartment.h
3 | // 14组合模式
4 | //
5 | // Created by 黄成都 on 15/8/15.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "HCDCompany.h"
11 | @interface HCDHRDepartment : NSObject
12 | @property(nonatomic,copy)NSString *name;
13 | -(instancetype)initWithName:(NSString *)name;
14 | @end
15 |
--------------------------------------------------------------------------------
/14组合模式/14组合模式/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // 14组合模式
4 | //
5 | // Created by 黄成都 on 15/8/15.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "AppDelegate.h"
11 |
12 | int main(int argc, char * argv[]) {
13 | @autoreleasepool {
14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/16单列模式/16单列模式/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // 16单列模式
4 | //
5 | // Created by yifan on 15/8/15.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "AppDelegate.h"
11 |
12 | int main(int argc, char * argv[]) {
13 | @autoreleasepool {
14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/17桥接模式/17桥接模式/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // 17桥接模式
4 | //
5 | // Created by yifan on 15/8/15.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "AppDelegate.h"
11 |
12 | int main(int argc, char * argv[]) {
13 | @autoreleasepool {
14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/18命令模式/18命令模式/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // 18命令模式
4 | //
5 | // Created by yifan on 15/8/15.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "AppDelegate.h"
11 |
12 | int main(int argc, char * argv[]) {
13 | @autoreleasepool {
14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/21享元模式/21享元模式/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // 21享元模式
4 | //
5 | // Created by yifan on 15/8/15.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "AppDelegate.h"
11 |
12 | int main(int argc, char * argv[]) {
13 | @autoreleasepool {
14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/3装饰模式/3装饰模式/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // 3装饰模式
4 | //
5 | // Created by yifan on 15/8/12.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "AppDelegate.h"
11 |
12 | int main(int argc, char * argv[]) {
13 | @autoreleasepool {
14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/4代理模式/4代理模式/HCDpursuit.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDpursuit.h
3 | // 4代理模式
4 | //
5 | // Created by yifan on 15/8/12.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "HCDgiveGift.h"
11 | @class HCDschoolGirl;
12 |
13 | @interface HCDpursuit : NSObject
14 |
15 | -(instancetype)initWithSchoolGirl:(HCDschoolGirl *)schoolGirl;
16 | @end
17 |
--------------------------------------------------------------------------------
/4代理模式/4代理模式/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // 4代理模式
4 | //
5 | // Created by yifan on 15/8/12.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "AppDelegate.h"
11 |
12 | int main(int argc, char * argv[]) {
13 | @autoreleasepool {
14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/5工厂方法模式/5工厂方法模式/HCDfactoryMultiply.m:
--------------------------------------------------------------------------------
1 | //
2 | // HCDfactoryMinus.m
3 | // 5工厂方法模式
4 | //
5 | // Created by yifan on 15/8/12.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDfactoryMultiply.h"
10 | #import "HCDCalcuteMultiply.h"
11 | @implementation HCDfactoryMultiply
12 | -(id)createFactory{
13 | return [[HCDCalcuteMultiply alloc]init];
14 | }
15 | @end
16 |
--------------------------------------------------------------------------------
/7外观模式/7外观模式/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // 7外观模式
4 | //
5 | // Created by yifan on 15/8/13.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "AppDelegate.h"
11 |
12 | int main(int argc, char * argv[]) {
13 | @autoreleasepool {
14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/8建造者模式/8建造者模式/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // 8建造者模式
4 | //
5 | // Created by yifan on 15/8/13.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "AppDelegate.h"
11 |
12 | int main(int argc, char * argv[]) {
13 | @autoreleasepool {
14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/9观察者模式/9观察者模式/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // 9观察者模式
4 | //
5 | // Created by yifan on 15/8/13.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "AppDelegate.h"
11 |
12 | int main(int argc, char * argv[]) {
13 | @autoreleasepool {
14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/12适配器模式/12适配器模式/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // 12适配器模式
4 | //
5 | // Created by yifan on 15/8/14.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "AppDelegate.h"
11 |
12 | int main(int argc, char * argv[]) {
13 | @autoreleasepool {
14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/13备忘录模式/13备忘录模式/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // 13备忘录模式
4 | //
5 | // Created by 黄成都 on 15/8/14.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "AppDelegate.h"
11 |
12 | int main(int argc, char * argv[]) {
13 | @autoreleasepool {
14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/15迭代器模式/15迭代器模式/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // 15迭代器模式
4 | //
5 | // Created by 黄成都 on 15/8/15.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "AppDelegate.h"
11 |
12 | int main(int argc, char * argv[]) {
13 | @autoreleasepool {
14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/19职责链模式/19职责链模式/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // 19职责链模式
4 | //
5 | // Created by yifan on 15/8/15.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "AppDelegate.h"
11 |
12 | int main(int argc, char * argv[]) {
13 | @autoreleasepool {
14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/1简单工厂模式/1简单工厂模式/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // 1简单工厂模式
4 | //
5 | // Created by 黄成都 on 15/8/10.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "AppDelegate.h"
11 |
12 | int main(int argc, char * argv[]) {
13 | @autoreleasepool {
14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/20中介者模式/20中介者模式/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // 20中介者模式
4 | //
5 | // Created by yifan on 15/8/15.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "AppDelegate.h"
11 |
12 | int main(int argc, char * argv[]) {
13 | @autoreleasepool {
14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/22解释器模式/22解释器模式/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // 22解释器模式
4 | //
5 | // Created by 黄成都 on 15/8/27.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "AppDelegate.h"
11 |
12 | int main(int argc, char * argv[]) {
13 | @autoreleasepool {
14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/23访问者模式/23访问者模式/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // 23访问者模式
4 | //
5 | // Created by 黄成都 on 15/8/27.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "AppDelegate.h"
11 |
12 | int main(int argc, char * argv[]) {
13 | @autoreleasepool {
14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/5工厂方法模式/5工厂方法模式/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // 5工厂方法模式
4 | //
5 | // Created by yifan on 15/8/12.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "AppDelegate.h"
11 |
12 | int main(int argc, char * argv[]) {
13 | @autoreleasepool {
14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/6模板方法模式/6模板方法模式/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // 6模板方法模式
4 | //
5 | // Created by yifan on 15/8/12.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "AppDelegate.h"
11 |
12 | int main(int argc, char * argv[]) {
13 | @autoreleasepool {
14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/10抽象工厂模式/10抽象工厂模式/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // 10抽象工厂模式
4 | //
5 | // Created by yifan on 15/8/14.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "AppDelegate.h"
11 |
12 | int main(int argc, char * argv[]) {
13 | @autoreleasepool {
14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/12适配器模式/12适配器模式/HCDPlayer.m:
--------------------------------------------------------------------------------
1 | //
2 | // HCDPlayer.m
3 | // 12适配器模式
4 | //
5 | // Created by 黄成都 on 15/8/14.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDPlayer.h"
10 |
11 | @implementation HCDPlayer
12 | -(instancetype)initWithName:(NSString *)name{
13 | self = [super init];
14 | if (self) {
15 | _name = name;
16 | }
17 | return self;
18 | }
19 | @end
20 |
--------------------------------------------------------------------------------
/22解释器模式/22解释器模式/HCDContext.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDContext.h
3 | // 22解释器模式
4 | //
5 | // Created by 黄成都 on 15/8/27.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface HCDContext : NSObject
12 | -(instancetype)initWithInput:(NSString *)input;
13 | @property(nonatomic,copy)NSString *input;
14 | @property(nonatomic,copy)NSString *output;
15 | @end
16 |
--------------------------------------------------------------------------------
/22解释器模式/22解释器模式/HCDNonterminalExpression.m:
--------------------------------------------------------------------------------
1 | //
2 | // HCDNonterminalEXPRESSION.m
3 | // 22解释器模式
4 | //
5 | // Created by 黄成都 on 15/8/27.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDNonterminalExpression.h"
10 |
11 | @implementation HCDNonterminalExpression
12 | -(void)interpret:(HCDContext *)context {
13 | NSLog(@"非终端解释器,context == %@",context.output);
14 | }
15 | @end
16 |
--------------------------------------------------------------------------------
/5工厂方法模式/5工厂方法模式/HCDCalculateAdd.m:
--------------------------------------------------------------------------------
1 | //
2 | // HCDCalculateAdd.m
3 | // 1简单工厂模式
4 | //
5 | // Created by 黄成都 on 15/8/10.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDCalculateAdd.h"
10 | @implementation HCDCalculateAdd
11 | @synthesize numberA = _numberA;
12 | @synthesize numberB = _numberB;
13 | -(CGFloat)calculate{
14 | return self.numberA + self.numberB;
15 | }
16 | @end
17 |
--------------------------------------------------------------------------------
/13备忘录模式/13备忘录模式/HCDGameState.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDGameState.h
3 | // 13备忘录模式
4 | //
5 | // Created by 黄成都 on 15/8/14.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface HCDGameState : NSObject
12 | @property(nonatomic,assign)NSInteger life;
13 | @property(nonatomic,assign)NSInteger attack;
14 | @property(nonatomic,assign)NSInteger defeat;
15 | @end
16 |
--------------------------------------------------------------------------------
/14组合模式/14组合模式/HCDConcreteCompany.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDConcreteCompany.h
3 | // 14组合模式
4 | //
5 | // Created by 黄成都 on 15/8/15.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "HCDCompany.h"
11 | @interface HCDConcreteCompany : NSObject
12 | @property(nonatomic,copy)NSString *name;
13 | -(instancetype)initWithName:(NSString *)name;
14 | @end
15 |
--------------------------------------------------------------------------------
/14组合模式/14组合模式/HCDFinanceDepartment.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDFinanceDepartment.h
3 | // 14组合模式
4 | //
5 | // Created by 黄成都 on 15/8/15.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "HCDCompany.h"
11 | @interface HCDFinanceDepartment : NSObject
12 | @property(nonatomic,copy)NSString *name;
13 | -(instancetype)initWithName:(NSString *)name;
14 | @end
--------------------------------------------------------------------------------
/1简单工厂模式/1简单工厂模式/HCDCalcuteFactory.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDCalcuteFactory.h
3 | // 1简单工厂模式
4 | //
5 | // Created by 黄成都 on 15/8/10.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "HCDCalculate.h"
11 |
12 |
13 | @class CommonTool;
14 | @interface HCDCalcuteFactory : NSObject
15 |
16 | +(id)createCalcute:(NSString *)calculatetype;
17 | @end
18 |
--------------------------------------------------------------------------------
/24原型模式/24原型模式/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // 24原型模式
4 | //
5 | // Created by huangchengdu on 17/5/16.
6 | // Copyright © 2017年 huangchengdu. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "AppDelegate.h"
11 |
12 | int main(int argc, char * argv[]) {
13 | @autoreleasepool {
14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/5工厂方法模式/5工厂方法模式/HCDCalculate.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDCalculateProtecal.h
3 | // 1简单工厂模式
4 | //
5 | // Created by 黄成都 on 15/8/10.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 | @protocol HCDCalculate
12 |
13 | @property(nonatomic)CGFloat numberA;
14 | @property(nonatomic)CGFloat numberB;
15 | -(CGFloat)calculate;
16 | @end
17 |
--------------------------------------------------------------------------------
/13备忘录模式/13备忘录模式/HCDStateManager.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDStateManager.h
3 | // 13备忘录模式
4 | //
5 | // Created by 黄成都 on 15/8/14.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | @class HCDGameState;
11 | @interface HCDStateManager : NSObject
12 | @property(nonatomic,strong)HCDGameState *gameState;
13 | -(instancetype)initWithGameState:(HCDGameState *)gameState;
14 | @end
15 |
--------------------------------------------------------------------------------
/1简单工厂模式/1简单工厂模式/HCDCalculateMinus.m:
--------------------------------------------------------------------------------
1 | //
2 | // HCDCalculateMinus.m
3 | // 1简单工厂模式
4 | //
5 | // Created by 黄成都 on 15/8/10.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDCalculateMinus.h"
10 |
11 | @implementation HCDCalculateMinus
12 | @synthesize numberA = _numberA;
13 | @synthesize numberB = _numberB;
14 | -(CGFloat)calculate{
15 | return self.numberA - self.numberB;
16 | }
17 | @end
18 |
--------------------------------------------------------------------------------
/5工厂方法模式/5工厂方法模式/HCDCalculateMinus.m:
--------------------------------------------------------------------------------
1 | //
2 | // HCDCalculateMinus.m
3 | // 1简单工厂模式
4 | //
5 | // Created by 黄成都 on 15/8/10.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDCalculateMinus.h"
10 |
11 | @implementation HCDCalculateMinus
12 | @synthesize numberA = _numberA;
13 | @synthesize numberB = _numberB;
14 | -(CGFloat)calculate{
15 | return self.numberA - self.numberB;
16 | }
17 | @end
18 |
--------------------------------------------------------------------------------
/12适配器模式/12适配器模式/HCDForeignCenter.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDForeignCenter.h
3 | // 12适配器模式
4 | //
5 | // Created by 黄成都 on 15/8/14.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface HCDForeignCenter : NSObject
12 | @property(nonatomic,copy)NSString *name;
13 | -(void)foreignAttact;
14 | -(void)foreignDefent;
15 | -(instancetype)initWithName:(NSString *)name;
16 | @end
17 |
--------------------------------------------------------------------------------
/18命令模式/18命令模式/HCDOrder.m:
--------------------------------------------------------------------------------
1 | //
2 | // HCDOrder.m
3 | // 18命令模式
4 | //
5 | // Created by yifan on 15/8/15.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDOrder.h"
10 |
11 | @implementation HCDOrder
12 | -(instancetype)initWithOrderString:(NSString *)orderString{
13 | self = [super init];
14 | if (self) {
15 | _orderString = orderString;
16 | }
17 | return self;
18 | }
19 | @end
20 |
--------------------------------------------------------------------------------
/18命令模式/18命令模式/HCDWorker.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDWorker.h
3 | // 18命令模式
4 | //
5 | // Created by yifan on 15/8/15.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface HCDWorker : NSObject
12 |
13 | +(instancetype)sharedWorker;
14 |
15 | -(void)doMuttonWork:(NSString *)work;
16 | -(void)doChickenWork:(NSString *)work;
17 | -(void)doDuckWork:(NSString *)work;
18 | @end
19 |
--------------------------------------------------------------------------------
/1简单工厂模式/1简单工厂模式/HCDCalcuteMultiply.m:
--------------------------------------------------------------------------------
1 | //
2 | // HCDCalcuteMultiply.m
3 | // 1简单工厂模式
4 | //
5 | // Created by 黄成都 on 15/8/10.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDCalcuteMultiply.h"
10 |
11 | @implementation HCDCalcuteMultiply
12 | @synthesize numberA = _numberA;
13 | @synthesize numberB = _numberB;
14 | -(CGFloat)calculate{
15 | return self.numberA * self.numberB;
16 | }
17 | @end
18 |
--------------------------------------------------------------------------------
/5工厂方法模式/5工厂方法模式/HCDCalcuteMultiply.m:
--------------------------------------------------------------------------------
1 | //
2 | // HCDCalcuteMultiply.m
3 | // 1简单工厂模式
4 | //
5 | // Created by 黄成都 on 15/8/10.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDCalcuteMultiply.h"
10 |
11 | @implementation HCDCalcuteMultiply
12 | @synthesize numberA = _numberA;
13 | @synthesize numberB = _numberB;
14 | -(CGFloat)calculate{
15 | return self.numberA * self.numberB;
16 | }
17 | @end
18 |
--------------------------------------------------------------------------------
/1简单工厂模式/1简单工厂模式/CommonTool.h:
--------------------------------------------------------------------------------
1 | //
2 | // CommonTool.h
3 | // 1简单工厂模式
4 | //
5 | // Created by 黄成都 on 15/8/10.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | typedef NS_ENUM(NSInteger, CalculateType){
12 | calcuteTypeAdd = 0,
13 | calcuteTypeMinus,
14 | calcuteTypdeMultipy,
15 | calcuteTypeDivide
16 | };
17 |
18 | @interface CommonTool : NSObject
19 |
20 | @end
21 |
--------------------------------------------------------------------------------
/17桥接模式/17桥接模式/HCDSoftware.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDSoftware.h
3 | // 17桥接模式
4 | //
5 | // Created by yifan on 15/8/15.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @protocol HCDSoftware
12 | -(void)runQQ;
13 | -(void)runWeixin;
14 | -(void)runWord;
15 | -(void)runXcode;
16 | -(void)runQQDizhu;
17 | -(void)runQQMajiang;
18 | @end
19 |
20 | typedef id HCDSoftware;
21 |
--------------------------------------------------------------------------------
/3装饰模式/3装饰模式/ConcreteDecoratorA.m:
--------------------------------------------------------------------------------
1 | //
2 | // ConcreteDecoratorA.m
3 | // 3装饰模式
4 | //
5 | // Created by huangchengdu on 17/5/25.
6 | // Copyright © 2017年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "ConcreteDecoratorA.h"
10 |
11 | @implementation ConcreteDecoratorA
12 |
13 | -(void)operation{
14 | [super operation];
15 | self.addedState = @"New State";
16 | NSLog(@"ConcreteDecoratorA添加的装饰功能,相当于对Component进行装饰");
17 | }
18 | @end
19 |
--------------------------------------------------------------------------------
/8建造者模式/8建造者模式/HCDPersonBuilderDirector.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDPersonBuilderDirector.h
3 | // 8建造者模式
4 | //
5 | // Created by yifan on 15/8/13.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "HCDPresionBuilder.h"
11 |
12 | @interface HCDPersonBuilderDirector : NSObject
13 |
14 |
15 | @property(nonatomic, strong)HCDPresionBuilder builder;
16 |
17 | -(void)buildPerson;
18 |
19 | @end
20 |
--------------------------------------------------------------------------------
/13备忘录模式/13备忘录模式/HCDStateManager.m:
--------------------------------------------------------------------------------
1 | //
2 | // HCDStateManager.m
3 | // 13备忘录模式
4 | //
5 | // Created by 黄成都 on 15/8/14.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDStateManager.h"
10 |
11 | @implementation HCDStateManager
12 | -(instancetype)initWithGameState:(HCDGameState *)gameState{
13 | self = [super init];
14 | if (self) {
15 | _gameState = gameState;
16 | }
17 | return self;
18 | }
19 | @end
20 |
--------------------------------------------------------------------------------
/10抽象工厂模式/10抽象工厂模式/HCDAccessUser.m:
--------------------------------------------------------------------------------
1 | //
2 | // HCDAccessUser.m
3 | // 10抽象工厂模式
4 | //
5 | // Created by yifan on 15/8/14.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDAccessUser.h"
10 |
11 | @implementation HCDAccessUser
12 | -(SQLUser *)getUser{
13 | NSLog(@"新建一个Access的SQLUser对象");
14 | return [[SQLUser alloc]init];
15 | }
16 | -(void)insertUser:(SQLUser *)user{
17 | NSLog(@"插入一个Access的SQLUser对象");
18 | }
19 | @end
20 |
--------------------------------------------------------------------------------
/18命令模式/18命令模式/HCDWaiter.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDWaiter.h
3 | // 18命令模式
4 | //
5 | // Created by yifan on 15/8/15.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "HCDOrder.h"
11 | #import "HCDMuttonOrder.h"
12 | #import "HCDChickenOrder.h"
13 |
14 | @interface HCDWaiter : NSObject
15 |
16 | -(void)addOrder:(HCDOrder *)order;
17 | -(void)deleteOrder:(HCDOrder *)order;
18 | -(void)notifyOrder;
19 | @end
20 |
--------------------------------------------------------------------------------
/23访问者模式/23访问者模式/HCDConcreteElementB.m:
--------------------------------------------------------------------------------
1 | //
2 | // HCDElementB.m
3 | // 23访问者模式
4 | //
5 | // Created by 黄成都 on 15/8/27.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDConcreteElementB.h"
10 | #import "HCDVisitors.h"
11 |
12 |
13 | @implementation HCDConcreteElementB
14 |
15 | -(void)operationB{
16 | return;
17 | }
18 | -(void)accept:(HCDVisitors *)visitor{
19 | [visitor visitConcreteElementB:self];
20 | }
21 | @end
22 |
--------------------------------------------------------------------------------
/23访问者模式/23访问者模式/HCDConcreteElementA.m:
--------------------------------------------------------------------------------
1 | //
2 | // HCDConcreteElementA.m
3 | // 23访问者模式
4 | //
5 | // Created by 黄成都 on 15/8/27.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDConcreteElementA.h"
10 | #import "HCDVisitors.h"
11 |
12 |
13 | @implementation HCDConcreteElementA
14 |
15 | -(void)operationA{
16 | return;
17 | }
18 | -(void)accept:(HCDVisitors *)visitor{
19 | [visitor visitConcreteElementA:self];
20 | }
21 | @end
22 |
--------------------------------------------------------------------------------
/11状态模式/11状态模式/HCDWork.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDWork.h
3 | // 11状态模式
4 | //
5 | // Created by yifan on 15/8/14.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 | #import "HCDState.h"
12 | @interface HCDWork : NSObject
13 | @property(nonatomic,strong)id state;
14 | @property(nonatomic,assign)CGFloat hour;
15 | @property(nonatomic,assign)BOOL finished;
16 | -(void)writeProgram;
17 | @end
18 |
--------------------------------------------------------------------------------
/18命令模式/18命令模式/HCDOrder.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDOrder.h
3 | // 18命令模式
4 | //
5 | // Created by yifan on 15/8/15.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "HCDOrder.h"
11 | #import "HCDWorker.h"
12 |
13 | @interface HCDOrder : NSObject
14 |
15 | @property(nonatomic,copy)NSString *orderString;
16 |
17 | -(instancetype)initWithOrderString:(NSString *)orderString;
18 | //执行命令
19 | -(void)executeOrder;
20 | @end
21 |
--------------------------------------------------------------------------------
/21享元模式/21享元模式/HCDWebSiteFactory.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDWebSiteFactory.h
3 | // 21享元模式
4 | //
5 | // Created by yifan on 15/8/27.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "HCDWebSite.h"
11 |
12 |
13 | @interface HCDWebSiteFactory : NSObject
14 | @property(nonatomic,strong)NSDictionary *flyweights;
15 |
16 | -(id )getWebSiteCategory:(NSString *)webkey;
17 | -(NSInteger)getWebSiteCount;
18 | @end
19 |
--------------------------------------------------------------------------------
/9观察者模式/9观察者模式/HCDSecreteSubject.m:
--------------------------------------------------------------------------------
1 | //
2 | // HCDSecreteSubject.m
3 | // 9观察者模式
4 | //
5 | // Created by yifan on 15/8/13.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDSecreteSubject.h"
10 | #import "HCDObserver.h"
11 |
12 | @implementation HCDSecreteSubject
13 | -(void)notify{
14 | NSLog(@"秘书通知:老板回来了,大家赶紧撤");
15 | for (id observer in [self getobserverList]) {
16 | [observer update];
17 | }
18 | }
19 | @end
20 |
--------------------------------------------------------------------------------
/10抽象工厂模式/10抽象工厂模式/HCDSqlserverUser.m:
--------------------------------------------------------------------------------
1 | //
2 | // HCDSqlserverUser.m
3 | // 10抽象工厂模式
4 | //
5 | // Created by yifan on 15/8/14.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDSqlserverUser.h"
10 |
11 | @implementation HCDSqlserverUser
12 | -(SQLUser *)getUser{
13 | NSLog(@"新建一个Sqlserver的SQLUser对象");
14 | return [[SQLUser alloc]init];
15 | }
16 | -(void)insertUser:(SQLUser *)user{
17 | NSLog(@"插入一个Sqlserver的SQLUser对象");
18 | }
19 | @end
20 |
--------------------------------------------------------------------------------
/3装饰模式/3装饰模式/ConcreteDecoratorB.m:
--------------------------------------------------------------------------------
1 | //
2 | // ConcreteDecoratorB.m
3 | // 3装饰模式
4 | //
5 | // Created by huangchengdu on 17/5/25.
6 | // Copyright © 2017年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "ConcreteDecoratorB.h"
10 |
11 | @implementation ConcreteDecoratorB
12 |
13 | - (void)operation{
14 | [super operation];
15 | [self addedBehavior];
16 | }
17 |
18 | - (void)addedBehavior{
19 | NSLog(@"ConcreteDecoratorB添加的装饰功能,相当于对Component进行装饰");
20 | }
21 | @end
22 |
--------------------------------------------------------------------------------
/19职责链模式/19职责链模式/HCDMnager.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDMnager.h
3 | // 19职责链模式
4 | //
5 | // Created by yifan on 15/8/15.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | @class HCDMnager,HCDReuquest;
11 | @interface HCDMnager : NSObject
12 | @property(nonatomic,copy)NSString *name;
13 | @property(nonatomic,strong)HCDMnager *superior;
14 | -(instancetype)initWithName:(NSString *)name;
15 | -(void)dealRequest:(HCDReuquest *)request;
16 | @end
17 |
--------------------------------------------------------------------------------
/1简单工厂模式/1简单工厂模式/HCDCalculateAdd.m:
--------------------------------------------------------------------------------
1 | //
2 | // HCDCalculateAdd.m
3 | // 1简单工厂模式
4 | //
5 | // Created by 黄成都 on 15/8/10.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDCalculateAdd.h"
10 | @implementation HCDCalculateAdd
11 |
12 | /**
13 | * 下面这两句话会自动生成实现的协议的属性对应的成员变量。如果没有这两句话,则系统会奔溃
14 | */
15 | @synthesize numberA = _numberA;
16 | @synthesize numberB = _numberB;
17 |
18 | -(CGFloat)calculate{
19 | return self.numberA + self.numberB;
20 | }
21 | @end
22 |
--------------------------------------------------------------------------------
/20中介者模式/20中介者模式/Colleague.h:
--------------------------------------------------------------------------------
1 | //
2 | // Colleague.h
3 | // 20中介者模式
4 | //
5 | // Created by huangchengdu on 17/5/22.
6 | // Copyright © 2017年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @class Mediator;
12 | @interface Colleague : NSObject
13 |
14 | @property(nonatomic, strong)Mediator *mediator;
15 |
16 | -(instancetype)initWithMediator:(Mediator *)mediator;
17 |
18 | -(void)notify:(NSString *)message;
19 | -(void)send:(NSString *)message;
20 | @end
21 |
--------------------------------------------------------------------------------
/19职责链模式/19职责链模式/HCDMnager.m:
--------------------------------------------------------------------------------
1 | //
2 | // HCDMnager.m
3 | // 19职责链模式
4 | //
5 | // Created by yifan on 15/8/15.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDMnager.h"
10 | #import "HCDReuquest.h"
11 | @implementation HCDMnager
12 | -(instancetype)initWithName:(NSString *)name{
13 | self = [super init];
14 | if (self) {
15 | _name = name;
16 | }
17 | return self;
18 | }
19 | -(void)dealRequest:(HCDReuquest *)request{
20 |
21 | }
22 | @end
23 |
--------------------------------------------------------------------------------
/20中介者模式/20中介者模式/Mediator.h:
--------------------------------------------------------------------------------
1 | //
2 | // Mediator.h
3 | // 20中介者模式
4 | //
5 | // Created by huangchengdu on 17/5/22.
6 | // Copyright © 2017年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @class Colleague;
12 |
13 | @interface Mediator : NSObject
14 |
15 | @property(nonatomic, strong)Colleague *colleague1;
16 | @property(nonatomic, strong)Colleague *colleague2;
17 |
18 | -(void)send:(NSString *)message colleague:(Colleague *)colleague;
19 |
20 |
21 | @end
22 |
--------------------------------------------------------------------------------
/1简单工厂模式/1简单工厂模式/HCDCalculateDivide.m:
--------------------------------------------------------------------------------
1 | //
2 | // HCDCalculateDivide.m
3 | // 1简单工厂模式
4 | //
5 | // Created by 黄成都 on 15/8/10.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDCalculateDivide.h"
10 |
11 | @implementation HCDCalculateDivide
12 | @synthesize numberA = _numberA;
13 | @synthesize numberB = _numberB;
14 | -(CGFloat)calculate{
15 | if (self.numberB == 0) {
16 | assert(self.numberB);
17 | }
18 | return self.numberA/self.numberB;
19 | }
20 | @end
21 |
--------------------------------------------------------------------------------
/5工厂方法模式/5工厂方法模式/HCDCalculateDivide.m:
--------------------------------------------------------------------------------
1 | //
2 | // HCDCalculateDivide.m
3 | // 1简单工厂模式
4 | //
5 | // Created by 黄成都 on 15/8/10.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDCalculateDivide.h"
10 |
11 | @implementation HCDCalculateDivide
12 | @synthesize numberA = _numberA;
13 | @synthesize numberB = _numberB;
14 | -(CGFloat)calculate{
15 | if (self.numberB == 0) {
16 | assert(self.numberB);
17 | }
18 | return self.numberA/self.numberB;
19 | }
20 | @end
21 |
--------------------------------------------------------------------------------
/17桥接模式/17桥接模式/HCDWorkSoftWare.m:
--------------------------------------------------------------------------------
1 | //
2 | // HCDWorkSoftWare.m
3 | // 17桥接模式
4 | //
5 | // Created by huangchengdu on 17/5/18.
6 | // Copyright © 2017年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDWorkSoftWare.h"
10 | #import "HCDSoftware.h"
11 |
12 | @interface HCDWorkSoftWare ()
13 |
14 | @end
15 |
16 | @implementation HCDWorkSoftWare
17 |
18 | -(void)runWord{
19 | NSLog(@"WorkSoftWare打开办公软件");
20 | }
21 |
22 | -(void)runXcode{
23 | NSLog(@"WorkSoftWare打开Xcode");
24 | }
25 |
26 | @end
27 |
--------------------------------------------------------------------------------
/22解释器模式/22解释器模式/HCDContext.m:
--------------------------------------------------------------------------------
1 | //
2 | // HCDContext.m
3 | // 22解释器模式
4 | //
5 | // Created by 黄成都 on 15/8/27.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDContext.h"
10 |
11 | @implementation HCDContext
12 | -(instancetype)initWithInput:(NSString *)input{
13 | self = [super init];
14 | if (self) {
15 | _input = input;
16 | }
17 | return self;
18 | }
19 | -(NSString *)output{
20 | return [NSString stringWithFormat:@"输入的是%@",_input];
21 | }
22 | @end
23 |
--------------------------------------------------------------------------------
/23访问者模式/23访问者模式/HCDVisitors.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDVisitors.h
3 | // 23访问者模式
4 | //
5 | // Created by 黄成都 on 15/8/27.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "HCDConcreteElementA.h"
11 | #import "HCDConcreteElementB.h"
12 |
13 |
14 | @interface HCDVisitors : NSObject
15 |
16 |
17 | -(void)visitConcreteElementA:(HCDConcreteElementA *)concreteElementA;
18 | -(void)visitConcreteElementB:(HCDConcreteElementB *)concreteElementB;
19 |
20 | @end
21 |
--------------------------------------------------------------------------------
/11状态模式/11状态模式/HCDWork.m:
--------------------------------------------------------------------------------
1 | //
2 | // HCDWork.m
3 | // 11状态模式
4 | //
5 | // Created by yifan on 15/8/14.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDWork.h"
10 | #import "HCDForenoonState.h"
11 | @implementation HCDWork
12 | -(instancetype)init{
13 | self = [super init];
14 | if (self) {
15 | self.state = [[HCDForenoonState alloc]init];
16 | }
17 | return self;
18 | }
19 |
20 | -(void)writeProgram{
21 | [self.state writeProgram:self];
22 | }
23 | @end
24 |
--------------------------------------------------------------------------------
/16单列模式/16单列模式/HCDSingleton.m:
--------------------------------------------------------------------------------
1 | //
2 | // HCDSingleton.m
3 | // 16单列模式
4 | //
5 | // Created by yifan on 15/8/15.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDSingleton.h"
10 |
11 | @implementation HCDSingleton
12 | +(instancetype)sharedInstance{
13 | static HCDSingleton *singleton = nil;
14 | static dispatch_once_t onceToken;
15 | dispatch_once(&onceToken, ^{
16 | singleton = [[HCDSingleton alloc]init];
17 | });
18 | return singleton;
19 | }
20 | @end
21 |
--------------------------------------------------------------------------------
/17桥接模式/17桥接模式/HCDGameSoftware.m:
--------------------------------------------------------------------------------
1 | //
2 | // HCDGameSoftware.m
3 | // 17桥接模式
4 | //
5 | // Created by yifan on 15/8/15.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDGameSoftware.h"
10 | #import "HCDSoftware.h"
11 |
12 | @interface HCDGameSoftware ()
13 |
14 | @end
15 |
16 | @implementation HCDGameSoftware
17 |
18 | -(void)runQQDizhu{
19 | NSLog(@"GameSoftware开始QQ斗地主");
20 | }
21 |
22 | -(void)runQQMajiang{
23 | NSLog(@"GameSoftware开始QQ麻将");
24 | }
25 | @end
26 |
--------------------------------------------------------------------------------
/10抽象工厂模式/10抽象工厂模式/HCDAccessFactory.m:
--------------------------------------------------------------------------------
1 | //
2 | // HCDAccessFactory.m
3 | // 10抽象工厂模式
4 | //
5 | // Created by yifan on 15/8/14.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDAccessFactory.h"
10 | #import "HCDAccessDepartment.h"
11 | #import "HCDAccessUser.h"
12 | @implementation HCDAccessFactory
13 | -(id)createUser{
14 | return [[HCDAccessUser alloc]init];
15 | }
16 | -(id)createDepartment{
17 | return [[HCDAccessDepartment alloc]init];
18 | }
19 | @end
20 |
--------------------------------------------------------------------------------
/17桥接模式/17桥接模式/HCDPlaySoftWare.m:
--------------------------------------------------------------------------------
1 | //
2 | // HCDPlaySoftWare.m
3 | // 17桥接模式
4 | //
5 | // Created by huangchengdu on 17/5/18.
6 | // Copyright © 2017年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDPlaySoftWare.h"
10 | #import "HCDSoftware.h"
11 |
12 | @interface HCDPlaySoftWare ()
13 |
14 | @end
15 |
16 | @implementation HCDPlaySoftWare
17 |
18 | -(void)runQQ{
19 | NSLog(@"PlaySoftWare开始打开QQ");
20 | }
21 |
22 | -(void)runWeixin{
23 | NSLog(@"PlaySoftWare开始打开微信");
24 | }
25 |
26 | @end
27 |
--------------------------------------------------------------------------------
/23访问者模式/23访问者模式/HCDVisitors.m:
--------------------------------------------------------------------------------
1 | //
2 | // HCDVisitors.m
3 | // 23访问者模式
4 | //
5 | // Created by 黄成都 on 15/8/27.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import "HCDVisitors.h"
10 | #import "HCDConcreteElementA.h"
11 | #import "HCDConcreteElementB.h"
12 |
13 | @implementation HCDVisitors
14 |
15 | -(void)visitConcreteElementA:(HCDConcreteElementA *)concreteElementA{
16 | return;
17 | }
18 | -(void)visitConcreteElementB:(HCDConcreteElementB *)concreteElementB{
19 | return;
20 | }
21 | @end
22 |
--------------------------------------------------------------------------------
/9观察者模式/9观察者模式/HCDSubject.h:
--------------------------------------------------------------------------------
1 | //
2 | // HCDSubject.h
3 | // 9观察者模式
4 | //
5 | // Created by yifan on 15/8/13.
6 | // Copyright (c) 2015年 黄成都. All rights reserved.
7 | //
8 |
9 | #import