Skip to content

Instantly share code, notes, and snippets.

@milanpanchal
Forked from paulomcnally/OperatorInfo.swift
Created February 9, 2017 14:37
Show Gist options
  • Save milanpanchal/44def4cf43b69c805741c00eb4986108 to your computer and use it in GitHub Desktop.
Save milanpanchal/44def4cf43b69c805741c00eb4986108 to your computer and use it in GitHub Desktop.
Swift MCCMNC
import Foundation
import CoreTelephony
class OperatorInfo {
func id() -> String {
let networkInfo = CTTelephonyNetworkInfo()
let carrier = networkInfo.subscriberCellularProvider
let mcc = carrier!.mobileCountryCode
let mnc = carrier!.mobileNetworkCode
return NSString(format: "%@%@", mcc!, mnc!) as String
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment