Summer Fun with React Native

Hey! Is everyone sick of the pool and ready to do a little summer coding!?!?

I was recently just working my way through the main React Native tutorial found here:

https://facebook.github.io/react-native/docs/getting-started

…and I thought I would push my little app up to GitHub and share it with you girls to see if you want to work with React Native during the upcoming year or perhaps at an upcoming event… ahem… overnight event… er… in July… in CHICAGO… ?  I think you know what I am talking about!

screenshot-1530234853134Here is my repo – but you don’t have to fork it or even clone it, but you can if you want to. Alternatively, you can just do the tutorial. My repo is loosely based on the tutorial and you can do the same! 🙂  If you get stuck, ping me in Slack!

https://github.com/robintschroeder/hello-fvgcc-react-native

For the IDE, I was using VSCode, which is free and you can use it on a Mac or PC. You can download it here:

https://code.visualstudio.com/ 

It has a built in terminal panel to do your npm commands. Go to View > Integrated Terminal to open it.

HAVE FUN!

 

Advertisements

April 20, 2018 Meeting

Tonight we will meet in the boardroom in 25N.

This is our last working meeting of the 2017-2018 school year!

We will discuss our weather wear project and what the next steps should be, including deploying to azure and providing a web API endpoint to the Swift team.

We can also discuss plans for next year – schedule, meeting room, etc.

We will also continue with gadgets:

 

April 6, 2018 Meeting

April is ‘Gadget Month’!

Tonight we will kick off Gadget Month with a little Arduino programming as well as some fun with the Hololens. Tonight, we will play a little RoboRaid!

For Arduino programming, we can either use the online IDE or the desktop IDE – find them here: https://www.arduino.cc/en/Main/Software

We have a few Arduinos with added hardware, such as Snapino.

We also have two Awesome Shields. Here is a video of what is possible with the Awesome Shield:

Looking forward to our meeting tonight!

March 23, 2018 Meeting

Coding Tonight!

Tonight’s meeting will focus on continuing the development of the WeatherWear Web Service and the Swift app to consume the Web Service.

Notes on Swift String Interpolation Issue with Optional variables:

String Interpolation in Swift: the term “string interpolation” refers to creating a character string that pulls values out of one or more variables and combines those values with other characters to form a string. The entire expression is enclosed in double quotes and each variable within the string is preceded by a backslash and enclosed in parentheses. Example “Hello \(name)”  will print “Hello Gandalf” if Gandalf is the value in the variable name.

Optional Variables in Swift: Swift is strongly typed and insists that if there is a possibility that a variable (or constant) may not have a value at some point when the program is running, then it must be declared as optional. The variable may then  either contain a value of the declared type or may be nil.  The purpose is to avoid the null reference errors that can occur in other languages when someone tries to use a variable without a value. Declare a variable as optional by putting a question mark at the end of the type such as our WeatherForecast:

var forecast: WeatherForecast?

When using the values in an optional variable, the variable needs to be “unwrapped”, like removing it from a box. Consider a cardboard box labelled “Weather Forecast”; you can open it up to find a forecast object or you can find nothing, so you can’t treat it as if there is always a value there.  There are several ways to unwrap and to check what is in the box, but for this problem we will force unwrapping explicitly.

The Problem with String Interpolation with Optionals:

When we tried to display the temperature in either Fahrenheit or Celsius by drilling down through the many nested levels of objects in our WeatherForecast we were getting this warning and the text on screen was gibberish:

Swift String Interpolation Warning

The fix is to explicitly unwrap the values at each object level by putting an exclamation point in place of the question mark in multiple places, i.e., after each object name within the long nested object:

Swift String Interpolation Fix

March 16, 2018 Meeting

Continue working on project teams for:

  • Weather Wear Web Service in C#
  • Swift client to consume the Web service and display results

Data Model Classes so far:

  • Both of our projects already have Class definitions that we created to represent the results of the Web Service call to Weather Underground’s Web API for the forecast
  • To allow the automatic decoding of the response to map to our defined Classes, the Property names in these class definitions must match the exact names of the names in the JSON object coming from the Web API Response, including Case sensitivity
  • If a Property name conflicts with that of a reserved word in the language we are using (C# or Swift) the name must be “escaped” using a special character. An example is “in”, used for inches in the API Response
      • In C# precede the name with “@”, so use “@in”
      • In Swift enclose the name in back-ticks, ‵in‵

     

  • WeatherWear C#:
    • In the C# solution “WeatherWear”, the Class Library project “WWClassLib” has a Models folder to hold our Class definition(s) for the Web API data models.  These data model classes correspond exactly to the JSON object(s) returned in the API Response
    • Forecast.cs is the C Sharp file that defines the classes for the Forecast API response in a fairly complex nested class structure with multiple layers of classes within classes
    • The top-level class is named “RootObject” in our model
  • Weather Swift:
    • In the Swift solution “Weather”,  we also created a Models folder to hold our Class definitions for the Web API data models corresponding to the JSON
    • WeatherForecast.swift is the Swift file that defines the model classes, using the exact same nesting structure as in the Web API’s Response and in the WeatherWear C# solution
    • The top-level class is named “WeatherForecast” in our model

Should we use Object Inheritance to model the custom API Response?

  • The Web Service team is working on the engine to process the Response from the Weather Underground Forecast API and determine what to wear. This will then be used in our custom Web API to enhance the results from the original Response by adding one or more properties that contain the wardrobe advice
  • The Swift team will need to add a Web Service call to the custom API so the wardrobe advice can be displayed along with selected information from the forecast
  • Both teams already have the “base” Model classes defined, are able to map the “base” API response to the Model, and are displaying selected fields on the console or on the app’s screen
  • Should we agree on a new Model definition that “inherits” the original but adds the custom fields needed for Weather Wear? Both Swift and C# would use the same property names. Inheritance allows us to extend an existing Class, creating a new Class that contains all the same Properties of the base Class but adding new ones.

March 9, 2018 Meeting

Jellyvision Field Trip Debriefing

Last Friday, on a day off from school,  9 of our members enjoyed an amazing day at Jellyvision, getting an inside look at what it is like to work at this tech company in a very wide variety of different roles, technical, business, and creative. Many of the brilliant and talented people at Jellyvision gave their time to make this a very special event for all of us.  Kate from Jellyvision will be attending our meeting this Friday and we will have an open discussion about the experience and insights gained. How were you inspired?  What did you learn?

Continue Developing Web Service and Client

We will work in our Web Service and Swift teams to continue developing the Weather Wear Service and the Swift client app to send a request to the service and display results.

Some notes on what we have so far in our Swift Client:

Consuming a Web Service in Swift