Skip to content
This repository was archived by the owner on Sep 19, 2024. It is now read-only.

Commit 9144145

Browse files
committed
Make NSBundle non-optional
as there where some subtile bugs with this and the bundle should be known for everthing at runtime.
1 parent 33d5754 commit 9144145

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

Library/Core/FileResource.swift

+7-7
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import Foundation
1010

1111
public protocol FileResourceType {
1212

13-
/// Bundle this file is in or nil for main bundle
14-
var bundle: NSBundle? { get }
13+
/// Bundle this file is in
14+
var bundle: NSBundle { get }
1515

1616
/// Name of the file file on disk
1717
var name: String { get }
@@ -27,7 +27,7 @@ public extension FileResourceType {
2727
- returns: The full pathname for this resource or nil if the file could not be located.
2828
*/
2929
func path() -> String? {
30-
return bundle?.pathForResource(self)
30+
return bundle.pathForResource(self)
3131
}
3232

3333
/**
@@ -36,21 +36,21 @@ public extension FileResourceType {
3636
- returns: The file URL for this resource or nil if the file could not be located.
3737
*/
3838
func url() -> NSURL? {
39-
return bundle?.URLForResource(self)
39+
return bundle.URLForResource(self)
4040
}
4141
}
4242

4343
public struct FileResource: FileResourceType {
44-
/// Bundle this file is in or nil for main bundle
45-
public let bundle: NSBundle?
44+
/// Bundle this file is in
45+
public let bundle: NSBundle
4646

4747
/// Name of the file file on disk
4848
public let name: String
4949

5050
/// Extension of the file on disk
5151
public let pathExtension: String
5252

53-
public init(bundle: NSBundle?, name: String, pathExtension: String) {
53+
public init(bundle: NSBundle, name: String, pathExtension: String) {
5454
self.bundle = bundle
5555
self.name = name
5656
self.pathExtension = pathExtension

Library/Core/ImageResource.swift

+5-5
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,22 @@ import Foundation
1010

1111
public protocol ImageResourceType {
1212

13-
/// Bundle this image is in or nil for main bundle
14-
var bundle: NSBundle? { get }
13+
/// Bundle this image is in
14+
var bundle: NSBundle { get }
1515

1616
/// Name of the image
1717
var name: String { get }
1818
}
1919

2020
public struct ImageResource: ImageResourceType {
2121

22-
/// Bundle this image is in or nil for main bundle
23-
public let bundle: NSBundle?
22+
/// Bundle this image is in
23+
public let bundle: NSBundle
2424

2525
/// Name of the image
2626
public let name: String
2727

28-
public init(bundle: NSBundle?, name: String) {
28+
public init(bundle: NSBundle, name: String) {
2929
self.bundle = bundle
3030
self.name = name
3131
}

Library/Core/NibResource.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import Foundation
1212
public protocol NibResourceType {
1313

1414
/// Bundle this nib is in or nil for main bundle
15-
var bundle: NSBundle? { get }
15+
var bundle: NSBundle { get }
1616

1717
/// Name of the nib file on disk
1818
var name: String { get }

Library/Core/StoryboardResource.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import Foundation
1010

1111
public protocol StoryboardResourceType {
1212

13-
/// Bundle this storyboard is in or nil for main bundle
14-
var bundle: NSBundle? { get }
13+
/// Bundle this storyboard is in
14+
var bundle: NSBundle { get }
1515

1616
/// Name of the storyboard file on disk
1717
var name: String { get }

0 commit comments

Comments
 (0)