Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. NSBundle *frameworkBundle = [NSBundle bundleForClass:[FrameworkClass class]];
  2. NSString *resourcePath = [frameworkBundle pathForResource:@"an_image" ofType:@"jpeg"];
  3. UIImage *image = [UIImage imageWithContentsOfFile:resourcePath];
  4.  
  5. [[NSBundle mainBundle] pathForResource:@"FI.framework/Resources/FileName"
  6. ofType:@"fileExtension"];
  7.  
  8. let bundle = Bundle(for: SomeFrameworkClass.self as AnyClass)
  9.  
  10. if let path = bundle.path(forResource: "test", ofType: "png") {
  11. if let image = UIImage(contentsOfFile: path) {
  12. // do stuff
  13. }
  14. }
  15.  
  16. let bundle = Bundle(for: type(of: self))
  17. let path = bundle.path(forResource: "filename", ofType: "json")!
  18. let url = URL(fileURLWithPath: path)
  19. let data = try! Data(contentsOf: url)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement