View Feature.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
enum Feature: String, CaseIterable { | |
case newThing | |
case otherThing | |
var isEnabled: Bool { | |
return UserDefaults.standard.bool(forKey: "feature-\(self.rawValue)") | |
} | |
View Screen.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using Xamarin.Essentials; | |
using Xamarin.Forms; | |
namespace NamespaceOfYourApp | |
{ | |
/// <summary> | |
/// Utility to get more information on screen configuration, type and size on iOS devices. | |
/// </summary> | |
public class Screen |
View BaseContentPage.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using Xamarin.Forms; | |
using System.Linq; | |
using System.Threading.Tasks; | |
namespace ExampleApp | |
{ | |
/// <summary> | |
/// Base content page that provides navigation mechanism that | |
/// allows view models to navigate from one view model to another |
View ExtraAnimations.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class ExtraAnimations | |
{ | |
public static async Task<bool> HeightTo(this View view, double height, uint duration = 250, Easing easing = null) | |
{ | |
var tcs = new TaskCompletionSource<bool>(); | |
var heightAnimation = new Animation(x => view.HeightRequest = x, view.Height, height); | |
heightAnimation.Commit(view, "HeightAnimation", 10, duration, easing, (finalValue, finished) => { tcs.SetResult(finished); }); | |
return await tcs.Task; |
View CardView.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Xamarin.Forms; | |
namespace Taimila | |
{ | |
public class CardView : ContentView | |
{ | |
public static readonly BindableProperty CornerRadiusProperty = BindableProperty.Create( | |
propertyName: "CornerRadius", | |
returnType: typeof(int), | |
declaringType: typeof(CardView), |
View SvgIcon.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.IO; | |
using System.Reflection; | |
using System.Collections.Generic; | |
using SkiaSharp; | |
using SkiaSharp.Views.Forms; | |
using Xamarin.Forms; | |
namespace Components | |
{ |
View StateMachine.fsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[<AutoOpen>] | |
module StateMachine = | |
type State = | |
| StateA | |
| StateB | |
| StateC | |
| StateD | |
| End |
View gist:4989046
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class ColorConverter | |
{ | |
public static NSColor FromColor(Color c) | |
{ | |
float red = IntToFloat(c.R); | |
float green = IntToFloat(c.G); | |
float blue = IntToFloat(c.B); | |
return NSColor.FromDeviceRgba(red, green, blue, 1); | |
} |