Skip to content

Instantly share code, notes, and snippets.

View ihak's full-sized avatar
🦅
Working

Hassan Ahmed Khan ihak

🦅
Working
View GitHub Profile
# launch app in the simulator
xcrun simctl launch "iPhone 11 Pro Max" com.ihak.Example
# instal app in the simulator
xcrun simctl install \
"iPhone 11 Pro Max" \
./build/Build/Products/Debug-iphonesimulator/Example.app
# if you have a project
xcodebuild -project Example.xcodeproj \
-scheme Example \
-configuration Debug \
-destination 'platform=iOS Simulator,name=iPhone 11 Pro Max,OS=13.1' \
-derivedDataPath build
# if you have a workspace
xcodebuild -workspace Example.xcworkspace \
-scheme Example \
@ihak
ihak / runscript.sh
Last active December 11, 2019 05:46
Run script to run Xcode project on iOS Simulator
#!/bin/bash
# Clean the build
rm -rf ./build
# Build the project
xcodebuild -project \
Example.xcodeproj \
-scheme Example \
-configuration Debug \
// This is a class method that instantiates the MealListingVC
// using the Meal storyboard in which it resides
// with the "MealListingVC" storyboard identifier
static func instantiate() -> MealListingVC? {
return Storyboard.Meal.viewController(withIdentifier: "MealListingVC") as? MealListingVC
}
@ihak
ihak / Storyboard.swift
Last active January 13, 2019 07:22
Basic storyboard enum
enum Storyboard: String {
case Main, Meal
var instance: UIStoryboard {
return UIStoryboard(name: self.rawValue, bundle: nil)
}
// Instantiates the default initial
// viewcontroller for current storybaord
func initialViewController() -> UIViewController? {
render() {
const ratingObj = {
ratings: 3,
views: 34000
}
return (
<View style={styles.container}>
<StarRating ratingObj={ratingObj}/>
</View>
render() {
// Recieve the ratings object from the props
let ratingObj = this.props.ratingObj;
return (
<View style={ styles.container }>
<Image
style={styles.image}
source={require('./star-filled.png')}
render() {
// Recieve the ratings object from the props
let ratingObj = this.props.ratingObj;
// This array will contain our star tags. We will include this
// array between the view tag.
let stars = [];
// Loop 5 times
for (var i = 1; i <= 5; i++) {
// Set the path to filled stars
import React, { Component } from 'react';
import {
StyleSheet,
View,
Text
} from 'react-native';
type Props = {
};