Skip to main content

Posts

Showing posts from November, 2018

Language Server Protocol (LSP) for Swift

You might already heard “ Apple announced LSP support for Swift ”. This is overwhelming decision by Apple because it’s a great step towards openness from it’s ‘monopoly game’. You can check complete official announcement here by Argyrios Kyrtzidis . What exactly LSP and How it works ? This Post from NSHipster by Matt explains how it works and what are the benefits out of the LSP support. In short, LSP will enable Swift development other than Xcode with below seamless integrated features - Autocompletion Jump to Definition Syntax highlighting Tooltips Automatic formatting and many for editor features. Any editor (say Visual Studio) to understand Swift, it requires Swift package to be integrated. Thus, SourceKit-LSP (Still under development) comes into play. This open source project got contribution from large group of developers and releasing very soon. Later we can easily integrate Swift into any editing tool with the help of any package manager (NodeJS prefer...

Stored Properties vs Computed Properties

We will start with simple a property which can be defined as below : var firstValue : Int let length : Int = 22 We can see it's not defined inside any closure, (A Closure "{ }" is meant for Classes, Structures or Enumerations) Stored Properties are those properties kept inside Classes and Structures. (not enums) . So, it will be always instance of classes or structures. Here is 2 more examples  : struct FixedLengthRange { var firstValue : Int let length : Int } class FixedLengthRange { var firstValue : Int let length : Int } Computed properties are those properties which do not store values, instead it gives getter and optional setter methods to access those property values. struct Circle {   var rad = 0   let pi = 3.14   var area : Float    {      get {        return rad * rad * pi          }   ...