I have a Xamarin Android application in which I've bundled up some files as assets and I can access them like this: Android.App.Application.Context.Assets.Open(fileName))
.
How would I go about doing this in an iOS application?
The NSBundle
class is the closest equivalent with using a BundleResource
build action:
var path = NSBundle.MainBundle.BundlePath;
var filePath = Path.Combine(path, "someDataFile.xml");
var someFileContents = File.ReadAllBytes(filePath);
There are also FromBundle
overloads on some classes:
var image = UIImage.FromBundle("myimage.png");