How to upgrade Xcode 9 to Xcode 10.1 in mac OS Sierra 10.12.6 (16G1815) I've an Early 2011 MacBook and I am not able to upgrade the operating system beyond macOS Sierra 10.12.6 (16G1815) on it. I am working with Xcode and in my current project I need to integrate Auto-renewable Subscriptions functionality, but discount features such as free trail period, pay as you go, and pay upfront are linked in introductory pricing API class. This is available in Xcode 10, and I really needs to install it on my Mac, because iOS 12 and greater requires this feature in Auto-renewable Subscription modules in order to approve app from iTunes App Store team.

So anyone could help me install Xcode 10.1 or even Xcode 10 on my Mac running macOS Sierra 10.12.6 (16G1815)?
Xcode 10.1 is not supported in macOS Sierra. You’ll need macOS High Sierra it later to run Xcode 10.1.

Since your model of MacBook Pro supports running macOS High Sierra, it's recommended that you upgrade to it. You can install current latest version of Xcode 10.2 in macOS High Sierra 10.13.6.