You can't install Xcode. The nearest you can get is to install Swift Playgrounds, which will allow you to write fairly sophisticated code, though you're limited to running from the environment you develop in.