Skip to content

Instantly share code, notes, and snippets.

View CFNull's full-sized avatar

pq CFNull

  • ShenZhen
View GitHub Profile
@CFNull
CFNull / ForceEnablingXcodeLLM.md
Created June 18, 2024 01:23 — forked from unixzii/ForceEnablingXcodeLLM.md
A guide to force enabling Xcode LLM feature on China-SKU Macs.

Introduction

Apple restricted the access to Xcode LLM (Predictive code completion) feature on China models of Mac. This guide provides a way to bypass that restriction. It's verified on macOS 15.0 Beta (24A5264n), but there is no guarentee that it will always work on later macOS versions.

Prerequisites

  • Xcode is installed and run at least once.
  • SIP debugging restrictions are disabled (via csrutil enable --without debug command in recovery mode).

Disclaimer

@CFNull
CFNull / UIAlertController+TextField.swift
Created August 17, 2018 03:13 — forked from ole/UIAlertController+TextField.swift
A UIAlertController with a text field and the ability to perform validation on the text the user has entered while the alert is on screen. The OK button is only enabled when the entered text passes validation. More info: https://oleb.net/2018/uialertcontroller-textfield/
import UIKit
/// A validation rule for text input.
public enum TextValidationRule {
/// Any input is valid, including an empty string.
case noRestriction
/// The input must not be empty.
case nonEmpty
/// The enitre input must match a regular expression. A matching substring is not enough.
case regularExpression(NSRegularExpression)

Note

Apple will reject apps that are using private url schemes (Ugh, Apple....) if they are pretty much obvius. Some apps are rejected and others are not, so, be aware of this issue before implementing any of those URL's in your app as a feature.

[UPDATE 4] iOS 10 update: apparently settings now can be reached using App-Pref instead of prefs

[UPDATE 3: For now you just can use url schemes to open your apps's settings with Swift 3.0 (Xcode 8). I'll keep you informed when OS preferences can be reached]

[UPDATE 2:The openURL() method of UIApplication is now deprecated. You should use application(_:open:options:) instead]

[UPDATE : Not yet tested in iOS 10. It will fail because of policies changes in URL scheme handling.]