Skip to content

Commit 970b416

Browse files
committed
Leider schon das erste Problem
1 parent 2484b2b commit 970b416

File tree

6 files changed

+61
-1
lines changed

6 files changed

+61
-1
lines changed

APIClient.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10+
830DA5871CF437F100203B41 /* StarWarsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 830DA5861CF437F100203B41 /* StarWarsViewController.swift */; };
1011
872A275C1CF0D87100A988C4 /* APIResource.swift in Sources */ = {isa = PBXBuildFile; fileRef = 872A275B1CF0D87100A988C4 /* APIResource.swift */; };
1112
874D06591CEF295E009A494D /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 874D06581CEF295E009A494D /* AppDelegate.swift */; };
1213
874D065E1CEF295E009A494D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 874D065C1CEF295E009A494D /* Main.storyboard */; };
@@ -16,6 +17,7 @@
1617
/* End PBXBuildFile section */
1718

1819
/* Begin PBXFileReference section */
20+
830DA5861CF437F100203B41 /* StarWarsViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StarWarsViewController.swift; sourceTree = "<group>"; };
1921
872A275B1CF0D87100A988C4 /* APIResource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = APIResource.swift; sourceTree = "<group>"; };
2022
874D06551CEF295E009A494D /* APIClient.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = APIClient.app; sourceTree = BUILT_PRODUCTS_DIR; };
2123
874D06581CEF295E009A494D /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
@@ -43,6 +45,7 @@
4345
872A27571CF0D4E200A988C4 /* View Controller */ = {
4446
isa = PBXGroup;
4547
children = (
48+
830DA5861CF437F100203B41 /* StarWarsViewController.swift */,
4649
);
4750
name = "View Controller";
4851
sourceTree = "<group>";
@@ -242,6 +245,7 @@
242245
isa = PBXSourcesBuildPhase;
243246
buildActionMask = 2147483647;
244247
files = (
248+
830DA5871CF437F100203B41 /* StarWarsViewController.swift in Sources */,
245249
872A275C1CF0D87100A988C4 /* APIResource.swift in Sources */,
246250
874D06591CEF295E009A494D /* AppDelegate.swift in Sources */,
247251
);

APIClient/APIResource.swift

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,29 @@ extension MoyaProvider where Target: Cacheable {
8383

8484
}
8585

86+
enum YourAPI: Moya.TargetType {
87+
case firstEndpoint (someParameter: String, anotherParameter: Int)
88+
var baseURL:NSURL {return NSURL(string: "http://swapi.co/api/")! }
89+
90+
var path : String {
91+
switch self {
92+
case .firstEndpoint(someParameter: let a, anotherParameter: _): return "/firstEndpoint/\(a)"
93+
}
94+
}
95+
96+
var method: Moya.Method {return .GET}
97+
98+
var parameters: [String : AnyObject]? {
99+
switch self {
100+
default: return nil
101+
}
102+
}
103+
104+
var sampleData: NSData {
105+
return "".dataUsingEncoding(NSUTF8StringEncoding)!
106+
}
107+
}
108+
86109
/// A persistent cache for resources
87110
private let resourceCache = try! Cache<NSData>(name: "APIResource")
88111

APIClient/AppDelegate.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,14 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
1313

1414
var window: UIWindow?
1515

16+
let starWAPI = MoyaProvider<SWAPI>()
1617

1718
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
19+
20+
if let starWarsViewController = (window?.rootViewController as? UINavigationController)?.topViewController as? StarWarsViewController {
21+
22+
}
23+
1824
return true
1925
}
2026

APIClient/Base.lproj/Main.storyboard

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="E10-YL-lxp">
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10116" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="E10-YL-lxp">
33
<dependencies>
44
<deployment identifier="iOS"/>
55
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
//
2+
// StarWarsViewController.swift
3+
// APIClient
4+
//
5+
// Created by Christoph Blattgerste on 24.05.16.
6+
// Copyright © 2016 iOS Dev Kurs Universität Heidelberg. All rights reserved.
7+
//
8+
9+
import Foundation
10+
import UIKit
11+
import Freddy
12+
import Moya
13+
import AlamofireImage
14+
15+
class StarWarsViewController: UIViewController {
16+
17+
var starWAPI : MoyaProvider<SWAPI>!
18+
19+
20+
}

Pods/Pods.xcodeproj/project.xcworkspace/contents.xcworkspacedata

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)