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
#!/Users/prafulla/miniconda2/bin/python | |
# path for python | |
# give exc permission | |
# -*- coding: utf-8 -*- | |
#to read cvs execell etc | |
import pandas | |
#get file from : https://drive.google.com/open?id=0B_P-kZ2NQv5aZWNSYUR2b2VrbFE | |
dataset = pandas.read_csv('50_Startups.csv') |
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
class ViewController: UIViewController { | |
var userInterfaceStyle: UIUserInterfaceStyle? | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
// Do any additional setup after loading the view. | |
userInterfaceStyle = self.traitCollection.userInterfaceStyle | |
setupUI() | |
} | |
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 'dart:ui'; | |
import 'package:flutter/material.dart'; | |
class FrostedDemo extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return new Scaffold( | |
body: Center ( | |
child: Stack( | |
children: <Widget>[ |
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 'package:flutter/material.dart'; | |
import 'toast.dart'; | |
void main() => runApp(new MyApp()); | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return new MaterialApp( | |
title: 'Toast', |
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
struct TextView: UIViewRepresentable { | |
//enum to define keyboard or input view handeling will be done in coorinator later | |
enum PickerType { | |
case keyboard(type: UIKeyboardType) | |
case datePicker(minDate: Date, maxDate: Date) | |
case customList(list: [String]) | |
} | |
var pickerType: TextView.PickerType | |
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
final class Coordinator: NSObject { | |
var text: Binding<String> | |
var pickerType: TextView.PickerType | |
init(text: Binding<String>, pickerType: TextView.PickerType) { | |
self.pickerType = pickerType | |
self.text = text | |
} | |
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 SwiftUI | |
import Combine | |
struct KeyboardProperty { | |
var currentHeight: CGFloat = 0 | |
var animationDuration: Double = 0 | |
//keyboard notification also gives UIKeyboardAnimationCurveUserInfoKey using which we can completly sync keyboard animation with Scrollview move but In SwiftUI I cannot find any way to use the same. | |
} |
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
class WebViewStateModel: ObservableObject { | |
@Published var pageTitle: String = "Web View" | |
@Published var loading: Bool = false | |
@Published var canGoBack: Bool = false | |
@Published var goBack: Bool = false | |
} | |
struct WebView: View { | |
enum NavigationAction { | |
case decidePolicy(WKNavigationAction, (WKNavigationActionPolicy) -> Void) //mendetory |
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
struct ContentView: View { | |
@ObservedObject var webViewStateModel: WebViewStateModel = WebViewStateModel() | |
var body: some View { | |
NavigationView { | |
LoadingView(isShowing: .constant(webViewStateModel.loading)) { //loading logic taken from https://stackoverflow.com/a/56496896/9838937 | |
//Add onNavigationAction if callback needed | |
WebView(url: URL.init(string: "https://www.google.com")!, webViewStateModel: self.webViewStateModel) // add | |
} | |
.navigationBarTitle(Text(webViewStateModel.pageTitle), displayMode: .inline) |
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
final class WebViewWrapper : UIViewRepresentable { | |
... | |
final class Coordinator: NSObject { | |
@ObservedObject var webViewStateModel: WebViewStateModel | |
let action: ((_ navigationAction: WebView.NavigationAction) -> Void)? | |
init(action: ((_ navigationAction: WebView.NavigationAction) -> Void)?, | |
webViewStateModel: WebViewStateModel) { | |
self.action = action | |
self.webViewStateModel = webViewStateModel |
OlderNewer