Skip to content

Instantly share code, notes, and snippets.

Avatar

lubiepomaranczki

View GitHub Profile
@lubiepomaranczki
lubiepomaranczki / Forms2Native.cs
Last active May 6, 2020
Solution proposed by Ryan Davis to the problem described here https://twitter.com/lawiluk/status/1257661151258820608 . This sample is for MVVMCross but you should be fine with other Frameworks.
View Forms2Native.cs
public class FormsTestView : BaseViewController<FormsTestViewModel>
{
public override void ViewDidLoad()
{
base.ViewDidLoad();
EdgesForExtendedLayout = UIRectEdge.None;
Xamarin.Forms.Forms.Init();
View Forms2Native
public class FormsTestView : BaseViewController<FormsTestViewModel>
{
public override void ViewDidLoad()
{
base.ViewDidLoad();
EdgesForExtendedLayout = UIRectEdge.None;
View.BackgroundColor = UIColor.Green;
Xamarin.Forms.Forms.Init();
@lubiepomaranczki
lubiepomaranczki / open-db.sh
Last active Nov 1, 2019
Script to open sqlite database from iOS simulator
View open-db.sh
#!/bin/bash
open_database() {
DB_PATH=`lsof -Fn -p $PID| grep "\.sqlite$"`
open ${DB_PATH:1}
}
PID=`pgrep $1`
if [ -z "$1" ]
@lubiepomaranczki
lubiepomaranczki / ExtendedContentView.cs
Last active Jun 16, 2019
ExtendedContentView with navigation and option to add ToolbarItems
View ExtendedContentView.cs
using System;
using System.Collections.Generic;
using Xamarin.Forms;
using XamForms.Enhanced.Extensions;
namespace XamForms.Enhanced.Views
{
public class ExtendedContentView : ContentView
{
private bool _didAppear;
@lubiepomaranczki
lubiepomaranczki / EnhancedUIButton.cs
Last active Mar 19, 2019
Fully custom UIButton for Xamarin.iOS
View EnhancedUIButton.cs
using System;
using Foundation;
using UIKit;
namespace XamForms.Enhanced.iOS.Controls
{
/// <summary>
/// <see cref="T:XamForms.Enhanced.iOS.Controls.EnhancedUIButton"/> class is a button that let's you create fully custom Button with its own layout
/// </summary>
public class EnhancedUIButton : UIButton
@lubiepomaranczki
lubiepomaranczki / SectionItem
Created Feb 17, 2019
SectionItem from SectionedCollectionView
View SectionItem
public class SectionItem
{
public SectionItem(string headerText, IList<Book> collection)
{
HeaderText = headerText;
Collection = collection;
}
public string HeaderText { get; set; }
@lubiepomaranczki
lubiepomaranczki / BooksViewSource
Last active Feb 17, 2019
BooksViewSource from SectionedCollectionView
View BooksViewSource
public class BooksViewSource : MvxCollectionViewSource
{
public IList<SectionItem> SectionedItemsCollection { get; set; }
public BooksViewSource(UICollectionView collectionView)
: base(collectionView, BookCell.Key)
{
CollectionView.RegisterClassForCell(typeof(BookCell), BookCell.Key);
CollectionView.RegisterClassForSupplementaryView(typeof(BookHeader), UICollectionElementKindSection.Header, BookHeader.Key);
ReloadOnAllItemsSourceSets = true;
@lubiepomaranczki
lubiepomaranczki / BookHeader
Created Feb 17, 2019
BookHeader for SectionedCollectionView
View BookHeader
public class BookHeader : UICollectionReusableView
{
public static readonly NSString Key = new NSString("BookHeader");
private UILabel headerText;
public string HeaderText
{
get { return headerText.Text; }
set
@lubiepomaranczki
lubiepomaranczki / BookCell
Last active Feb 17, 2019
BookCell from SectionedCollectionView
View BookCell
public class BookCell : MvxCollectionViewCell
{
public static NSString Key = new NSString("BookCell");
private UILabel bookName;
private UILabel bookAuthor;
private MvxCachedImageView bookThumbnail;
public BookCell(IntPtr handle) : base(string.Empty, handle)
{
View runSonnar.sh
#!/bin/bash
PATH_TO_PROJECT="$1"
SONAR_TOKEN="{YOUR-TOKEN}"
PROJECT_NAME="$( echo "$1" | sed 's@.*/@@' )"
if [[ -z "$PROJECT_NAME" ]]; then
echo "Project name can't be null. Either project does not exist or you have / at the end of path"
exit;
fi
You can’t perform that action at this time.