diff --git a/chatter.xcodeproj/project.pbxproj b/chatter.xcodeproj/project.pbxproj index ba69cdc..3f6dd5e 100644 --- a/chatter.xcodeproj/project.pbxproj +++ b/chatter.xcodeproj/project.pbxproj @@ -32,6 +32,7 @@ A016F8D41CCE76A80039184B /* Nathan.swift in Sources */ = {isa = PBXBuildFile; fileRef = A016F8D31CCE76A80039184B /* Nathan.swift */; }; A2AB56621CD35B40006999FD /* Homer.swift in Sources */ = {isa = PBXBuildFile; fileRef = A2AB56611CD35B40006999FD /* Homer.swift */; }; BF5A90431CD6C5A00033DBD8 /* Batman.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF5A90421CD6C5A00033DBD8 /* Batman.swift */; }; + C27C6D9E1E9CCEF100379A2D /* Pooh.swift in Sources */ = {isa = PBXBuildFile; fileRef = C27C6D9D1E9CCEF100379A2D /* Pooh.swift */; }; DC161D081CD60CE7001ADBC4 /* Seneca.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC161D071CD60CE7001ADBC4 /* Seneca.swift */; }; E9DD170D1CD6C2DA004F614F /* MagicConchShell.swift in Sources */ = {isa = PBXBuildFile; fileRef = E9DD170C1CD6C2DA004F614F /* MagicConchShell.swift */; }; /* End PBXBuildFile section */ @@ -66,6 +67,7 @@ A016F8D31CCE76A80039184B /* Nathan.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Nathan.swift; sourceTree = ""; }; A2AB56611CD35B40006999FD /* Homer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Homer.swift; sourceTree = ""; }; BF5A90421CD6C5A00033DBD8 /* Batman.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Batman.swift; sourceTree = ""; }; + C27C6D9D1E9CCEF100379A2D /* Pooh.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Pooh.swift; sourceTree = ""; }; DC161D071CD60CE7001ADBC4 /* Seneca.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Seneca.swift; sourceTree = ""; }; E9DD170C1CD6C2DA004F614F /* MagicConchShell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MagicConchShell.swift; sourceTree = ""; }; /* End PBXFileReference section */ @@ -174,6 +176,7 @@ 3284A1351CD3FD4500A5DD4F /* Minion.swift */, 3284A13B1CD4010200A5DD4F /* Barney.swift */, 79A8A7621CD0072100C7A040 /* Sherlock.swift */, + C27C6D9D1E9CCEF100379A2D /* Pooh.swift */, 77989E491CCFDB0F00AB13A3 /* Hodor.swift */, 7730A5311CD6614B0064B499 /* Redneck.swift */, 7730A5331CD668D10064B499 /* Trump.swift */, @@ -268,6 +271,7 @@ 87468FD71CCD3B3500DB4A03 /* Chatter.swift in Sources */, A016F8D41CCE76A80039184B /* Nathan.swift in Sources */, DC161D081CD60CE7001ADBC4 /* Seneca.swift in Sources */, + C27C6D9E1E9CCEF100379A2D /* Pooh.swift in Sources */, 1716AF9F1CCE8A7600264EBE /* Obama.swift in Sources */, 879EC5471AF29DD600F36F1C /* ChatViewController.swift in Sources */, E9DD170D1CD6C2DA004F614F /* MagicConchShell.swift in Sources */, diff --git a/chatter/Images.xcassets/pooh.imageset/Contents.json b/chatter/Images.xcassets/pooh.imageset/Contents.json new file mode 100644 index 0000000..7d53c95 --- /dev/null +++ b/chatter/Images.xcassets/pooh.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "pooh.jpg", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/chatter/Images.xcassets/pooh.imageset/pooh.jpg b/chatter/Images.xcassets/pooh.imageset/pooh.jpg new file mode 100644 index 0000000..b51e08d Binary files /dev/null and b/chatter/Images.xcassets/pooh.imageset/pooh.jpg differ diff --git a/chatter/Pooh.swift b/chatter/Pooh.swift new file mode 100644 index 0000000..4189306 --- /dev/null +++ b/chatter/Pooh.swift @@ -0,0 +1,54 @@ +// +// Pooh.swift +// chatter +// +// Created by Katja D on 11.04.17. +// Copyright © 2017 Universität Heidelberg. All rights reserved. +// + +import Foundation +import UIKit + +class Pooh: Chatter { + + required init() { + super.init(image: UIImage(named: "pooh")) + } + + override func nextMessage() -> Message { + return [ + Message(content: "What day is today?", type: .statement), + Message(content: "What day is tomorrow?", type: .questionWhy), + Message(content: "Are we going out tonight?", type: .questionBool), + Message(content: "Is Piglet my best friend?", type: .joke), + ].randomElement() + } + + override func responseForMessage(_ message: Message) -> Message { + switch message.type { + case .statement: + return [ + Message(content: "My favorite day", type: .statement), + ].randomElement() + case .questionBool: + return [ + Message(content: "I think so.", type: .statement), + Message(content: "Not at all.", type: .statement), + Message(content: "Precisely.", type: .statement), + ].randomElement() + case .questionWhy: + return [ + Message(content: "Monday.", type: .statement), + Message(content: "Tuesday.", type: .statement), + Message(content: "Wednesday.", type: .statement) + ].randomElement() + case .joke: + return [ + Message(content: "Yes", type: .questionBool), + Message(content: "I nearly had to laugh", type: .statement) + ].randomElement() + } + } + + +}