Skip to content

Instantly share code, notes, and snippets.

View lubiepomaranczki's full-sized avatar

lubiepomaranczki

View GitHub Profile
@lubiepomaranczki
lubiepomaranczki / Forms2Native.cs
Last active May 6, 2020 06:53
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.
public class FormsTestView : BaseViewController<FormsTestViewModel>
{
public override void ViewDidLoad()
{
base.ViewDidLoad();
EdgesForExtendedLayout = UIRectEdge.None;
Xamarin.Forms.Forms.Init();
@lubiepomaranczki
lubiepomaranczki / Forms2Native
Created May 6, 2020 06:45
Solution to the problem described here https://twitter.com/lawiluk/status/1257661151258820608 Solution proposed
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 June 28, 2023 10:41
Script to open sqlite database from iOS simulator
#!/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 June 16, 2019 18:53
ExtendedContentView with navigation and option to add ToolbarItems
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 March 19, 2019 21:06
Fully custom UIButton for Xamarin.iOS
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 February 17, 2019 18:20
SectionItem from SectionedCollectionView
public class SectionItem
{
public SectionItem(string headerText, IList<Book> collection)
{
HeaderText = headerText;
Collection = collection;
}
public string HeaderText { get; set; }
@lubiepomaranczki
lubiepomaranczki / BooksViewSource
Last active February 17, 2019 18:41
BooksViewSource from SectionedCollectionView
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 February 17, 2019 18:08
BookHeader for SectionedCollectionView
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 February 17, 2019 18:09
BookCell from SectionedCollectionView
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)
{
#!/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