The New York Times reports on this, and a reader asks whether this is constitutional. Sure: State and federal governments are constitutionally permitted to ban even the possession of alcohol or drugs anywhere, so there's no constitutional barrier to the government's banning of smoking in apartment buildings. (It's possible that such a city law would be preempted by state law, but I don't know California preemption law enough for that.)
This doesn't make it right: It seems to me that it should be up to private landlords to decide whether smoking should be allowed in their buildings, and up to tenants to move to those buildings whose policies they prefer. But that's a matter of libertarian policy, not current U.S. constitutional law.