Skip to content

Instantly share code, notes, and snippets.

View aybarsyalcin's full-sized avatar

Aybars Yalcin aybarsyalcin

View GitHub Profile
@aybarsyalcin
aybarsyalcin / HomeCoordinator.swift
Last active December 22, 2022 16:08
Flow Coordinators - Part 4
import Foundation
import UIKit
final class HomeCoordinator: Coordinator, HomeCoordinatorOutput {
var finishHomeCoordinatorFlow: (() -> Void)?
var onAddressFlow: (() -> Void)?
private let factory: HomeModuleFactory
private let coordinatorFactory: CoordinatorFactory
private let router: Router
@aybarsyalcin
aybarsyalcin / CoordinatorFactory.swift
Created December 19, 2022 11:00
Flow Coordinators - Part 3
protocol CoordinatorFactory {
func makeHomeCoordinator(router: Router) -> Coordinator & HomeCoordinatorOutput
func makeAddressCoordinator(router: Router) -> Coordinator & AddressCoordinatorOutput
}
@aybarsyalcin
aybarsyalcin / SceneDelegate.swift
Last active December 19, 2022 10:56
Flow Coordinators - Part 2
var rootViewController: UINavigationController = UINavigationController()
private lazy var applicationCoordinator: BaseCoordinator = self.makeCoordinator()
.....
.....
if let windowScene = scene as? UIWindowScene {
let window = UIWindow(windowScene: windowScene)
window.rootViewController = rootViewController
self.window = window
window.makeKeyAndVisible()
@aybarsyalcin
aybarsyalcin / ApplicationCoordinator.swift
Last active December 22, 2022 16:00
Flow Coordinators - Part 1
import Foundation
final class ApplicationCoordinator: Coordinator {
private let coordinatorFactory: CoordinatorFactory
private let router: Router
init(router: Router, coordinatorFactory: CoordinatorFactory) {
self.router = router
self.coordinatorFactory = coordinatorFactory
@aybarsyalcin
aybarsyalcin / JavaDateSort.java
Created May 15, 2018 13:04
Sort by Date on Custom Object Array for Android
Collections.sort(messages, new Comparator() {
@Override
public int compare(Object o1, Object o2) {
Message p1 = (Message) o1;
Message p2 = (Message) o2;
if (p1.getCreatedAt().compareTo(p2.getCreatedAt()) > 0) {
return -1;
} else if (p1.getCreatedAt().compareTo(p2.getCreatedAt()) < 0) {
return +1;
} else {
@aybarsyalcin
aybarsyalcin / Date.cs
Created February 17, 2018 19:01
XAML datetime format text
<Label Text="{Binding NotifyDateTime, StringFormat='{0:dd/MM/yyyy HH:mm:ss}'}" FontFamily="Montserrat" TextColor="White" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" VerticalTextAlignment="Start" HorizontalTextAlignment="Start" FontSize="Small" />
@aybarsyalcin
aybarsyalcin / Assembly.cs
Last active February 5, 2018 22:28
Assembly all resources file for xamarin forms GetManifestResourceNames (embeded resource forexample png)
Assembly assembly = Assembly.GetExecutingAssembly();
string[] resources = assembly.GetManifestResourceNames();
foreach (string resource in resources)
{
if (resource.EndsWith(".png"))
{
Stream stream = assembly.GetManifestResourceStream(resource);
if (stream != null)
{
@aybarsyalcin
aybarsyalcin / Calculator.cs
Created December 28, 2017 14:54
Xamarin Forms Education
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="EduSample.EduSamplePage"
Title = "Calculator - XAML"
BackgroundColor="#404040">
<ContentPage.Resources>
<ResourceDictionary>
<Style x:Key="plainButton" TargetType="Button">
<Setter Property="BackgroundColor" Value="#eee"/>
<Setter Property="TextColor" Value="Black" />
@aybarsyalcin
aybarsyalcin / Datetime.cs
Last active December 28, 2017 07:16
Convert Timestamp to Datetime with Format
long unixDate = (long)item.createdDate;
DateTime start = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
DateTime date = start.AddMilliseconds(unixDate).ToLocalTime();
var dateString = date.ToString("dd/MM/yyyy");
@aybarsyalcin
aybarsyalcin / View.cs
Created December 20, 2017 11:15
The Problem : during listview is unvisible, we want to change padding. but not is changed view.
The Problem : during listview is unvisible, we want to change padding. but not is changed view.
listview.Padding = new Thickness(10,105,10,60 + 275);
listview.ForceLayout();