Skip to content

Commit d81d5ad

Browse files
author
Chris
committed
Add Builder.
1 parent f73614f commit d81d5ad

File tree

4 files changed

+22
-4
lines changed

4 files changed

+22
-4
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Bucket
3+
type = "1"
4+
version = "2.0">
5+
</Bucket>

Creational/AbstractFactory/swift/AbstractFactoryDemo/AbstractFactoryDemo/CalendarFactory.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ protocol CalendarFactory {
3333
class GoogleCalendarFactory: CalendarFactory {
3434

3535
func createCalendar() -> Calendar? {
36-
return Google(accessToken: "Google", refreshToken: "", userName: "")
36+
return Google(accessToken: "Google-Access-Token", refreshToken: "Google-Refresh-Token", userName: "Google")
3737
}
3838
}
3939

4040
class MicrosoftCalendarFactory: CalendarFactory {
4141
func createCalendar() -> Calendar? {
42-
return Microsoft(accessToken: "Microsoft", refreshToken: "", userName: "")
42+
return Microsoft(accessToken: "Microsoft-Access-Token", refreshToken: "Microsoft-Refresh-Token", userName: "Microsoft")
4343
}
4444
}
4545

Creational/AbstractFactory/swift/AbstractFactoryDemo/AbstractFactoryDemo/ViewController.swift

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,21 @@ import UIKit
1010

1111
class ViewController: UIViewController {
1212

13+
let googleCalendarBuilder: CalendarBuilder = CalendarBuilder(platform: CalType.google.rawValue)
14+
let microsoftCalendarBuildr: CalendarBuilder = CalendarBuilder(platform: CalType.microsoft.rawValue)
15+
1316
override func viewDidLoad() {
14-
super.viewDidLoad()
17+
super.viewDidLoad()
18+
19+
let googleCalendar = googleCalendarBuilder.buildCalendar()
20+
let microsoftCalendar = microsoftCalendarBuildr.buildCalendar()
21+
22+
print(googleCalendar.userName)
23+
print(googleCalendar.accessToken)
24+
print(googleCalendar.refreshToken)
25+
26+
print(microsoftCalendar.userName)
27+
print(microsoftCalendar.accessToken)
28+
print(microsoftCalendar.refreshToken)
1529
}
1630
}
17-

0 commit comments

Comments
 (0)