The connector is patented, as you see here. It contains 57 claims which define what is protected, and 35 USC 116 spells out the logic of claims (which, in a nutshell, says "this can get really complicated"). The set of claims defines what it patented, and infringement is defined in 35 USC 271 as
whoever without authority makes, uses, offers to sell, or sells any
patented invention, within the United States or imports into the
United States any patented invention during the term of the patent
therefor, infringes the patent
that is, there isn't anything statutorily more specific about how similar similar is. Since the claims define what is protected, this generally is taken to refer to things that are the same w.r.t. to all of the claims. "Generally" means that there is a doctrine of equivalents, exemplified by Warner-Jenkinson Co. v. Hilton Davis Chemical Co. 520 U.S. 17, whereby a court may find infringement when there is an insubstantial difference between the allegedly infringing thing and the protected invention.
The Apple patent does not specify a specific number of millimeters between the contacts, so making a connector that is exactly the same as the Apple device (as marketed) but with different spacing on the connectors would be an infringement, because that spacing is not specified in a claim. A similar device that uses chewing gum rather than magnets to keep it together would not likely be found to be infringing since that is a substantial divergence from what Apple claims it has invented.