Showing posts with label watchOS. Show all posts
Showing posts with label watchOS. Show all posts

Saturday, July 21, 2018

What are class library projects in Visual Studio 2017?

In Visual Studio Community 2017 you come across a number of templates of type, class library as shown here only for C# and F#.


ClassLibraryCom2017_0

Well, is there a need for so many of them? Visual Studio 2017 is targeting many more platforms and it is nice to have templates for each of them. Actually templates are the best starting points for any development.

The project folder and the code for the Class Library .NET Core is shown here. It can be used for projects for several platforms where .NET core is supported. Review the dependencies.


The project folder and the code for the Class Library .NET Standard is shown here. The dependency is on .NET Standard Library.


The project folder and the code for the Class Library .NET Framework is shown here. You create .dll with this template.



With the development of projects for the Universal Windows Platform, a class library project that targets UWP is also available in Visual Studio Community 2017 (free).

However there is one detail that needs to be taken into consideration as to which version of Windows platform should be used.

In this present case the following version is chosen.




The template folder and code for the Class Library for creating applications for UWP is as shown. Note the reference to the Microsoft.NETCore.UniversalWindowsPlatform


In addition to the above there are many more template types summarized here for other specific platforms:

Class Library (Android) Creates Xamarin.Android class library

Bindings Library(Android) Xamarin.Android class library that binds to Java jar.

Class Library (watchOS) Xamarin.WatchOS library 

Class Library (tvOS)  Unified library project for tvOS

Class Library (iOS) creates a Xamarin.iOS library project for iOS

Class Library(U-SQL Application) is of type Azure Data Lake, a project for creating class library(.dll) that can run on U-SQL.

Class Library(Legacy Portable) is discontinued. It is suggested to use Class Library .NET Standard.





Saturday, May 14, 2016

How do you fix this argument label error in the SWIFT program?

While trying to compile and run the following (see link at the bottom of post) program using SwiftFor Windows,
---
func sayHello(personName: String) -> String {
        let greeting = "Hello, " + personName + "!"
        return greeting
    }

print(sayHello("Jay"))

--------
The SwiftForWindows compiler spit out this error:

SwiftError_00

The compiler did indicate the location and the missing label.  The change was made in the print statement by providing the missing label (personName)

The program was modified as shown:
-------------------
func sayHello(personName: String) -> String {
        let greeting = "Hello, " + personName + "!"
        return greeting
    }

print(sayHello(personName:"Jay"))

---
With this the compiler produced no errors.


SwiftError_01

Now after hiting the Run button, the program produced the following response:


SwiftError_02
This sample was taken from SWIFT ver2.2 documentation:

https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/Functions.html#//apple_ref/doc/uid/TP40014097-CH10-ID158Is the error due to differences in the SWIFT compiler version?

Thursday, May 12, 2016

How do you compile and run SWIFT programs on Windows 10?

Presently it is possible to compile and run programs written in SWIFT language on Windows 10. You need to download the program as described in this post.

Programs written in SWIFT has the extension .swift. You can use any text editor and here is a simple program written using Notepad and saved to your hard drive. Note that it has to be in the following directory, C:\SwiftForWindows\Swift

//--Function definition
func sayHello(personName: String) -> String {
        let greeting = "Hello, " + personName + "!"
        return greeting
    }
//Function Call
print(sayHello(personName:"Jay"))
//--

Once you download run the Straightforwards.msi (please see the post at the top) file by double clicking it. There may be warnings from the computer not to run it, but ignore and install it.

This leaves a shortcut on your desktop.

When you click on this shortcut the Swift For Windows window opens as shown.


Swift_02

It is simple to use. Select the file and then hit Compile after choosing your platform. A command-line window opens which you can close if there are no compilation errors.

Swift_03

Close the window and have a look at the Logs. Then hit Run. That's it. Again the comand-line window opens displaying the results of your program.

Swift_04

In summary:
1. Create the Swift program file on a text editor and save it with the extension .swift to a specific directory.
2. Choose the platform you are using
Swift_05

3. Hit Run

That's it.