public static Binder <TSource, UIImageView> ImageAsync <TSource>(this Binder <TSource, UIImageView> binder, Expression <Func <TSource, string> > property, TimeSpan cacheExpiration = default(TimeSpan), UIImage loading = null) where TSource : class { if (cacheExpiration == default(TimeSpan)) { cacheExpiration = TimeSpan.FromDays(1); } return(binder.ImageAsync(property, PlatformConverters.AsyncStringToCachedImage(cacheExpiration), loading)); }
static UIExtensions() { //Native casts Converters.Register(new RelayConverter <int, nint>(x => x, x => (int)x)); Converters.Register(new RelayConverter <uint, nuint>(x => x, x => (uint)x)); Converters.Register(new RelayConverter <float, nfloat>(x => x, x => (float)x)); Converters.Register(new RelayConverter <double, nfloat>(x => (nfloat)x, x => x)); Converters.Register(new RelayConverter <int, nfloat>(x => x, x => (int)x)); // Registering all converters Converters.Register(PlatformConverters.IntToColor); Converters.Register(PlatformConverters.StringToColor); Converters.Register(PlatformConverters.StringToImage); Converters.Register(PlatformConverters.AsyncStringToCachedImage(TimeSpan.FromDays(1))); Converters.Register(PlatformConverters.DateTimeToNSDate); }