View SetEN_US_POSIX_IN_IOS.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func toGmtDate(year: Int, month: Int, date: Int, hour: Int, minute: Int, second: Int) -> Date? { | |
let str = String(format: "%04d-%02d-%02d %02d:%02d:%02d+0800", | |
year, month, date, | |
hour, minute, second) | |
let dateFormatter = DateFormatter() | |
dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ssZ" | |
dateFormatter.locale = Locale(identifier: "en_US_POSIX") // Set locale to POSIX | |
if let date = dateFormatter.date(from: str) { |
View ChatGPT_HTML_Test1.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>App 頁面</title> | |
<style> | |
body { | |
margin: 0; | |
display: flex; |
View ChatGPT AndroidActivityTest1.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import androidx.appcompat.app.AppCompatActivity; | |
import android.graphics.Color; | |
import android.graphics.drawable.GradientDrawable; | |
import android.os.Bundle; | |
import android.view.View; | |
import android.webkit.WebView; | |
import android.webkit.WebViewClient; | |
import android.widget.Button; | |
public class MainActivity extends AppCompatActivity { |
View XMLTest1.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
tools:context=".MainActivity"> | |
<WebView | |
android:id="@+id/webview" |
View ChatGPTGenerateSwiftUITest1.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
struct ContentView: View { | |
@State private var username: String = "" | |
@State private var password: String = "" | |
var body: some View { | |
VStack { | |
Spacer(minLength: 20) | |
View SwiftUILoginPage.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
struct LoginView: View { | |
@State private var username = "" | |
@State private var password = "" | |
var body: some View { | |
VStack { | |
Image("logo") | |
.resizable() |
View SwiftUILoginPage2.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct LoginPage: View { | |
@State private var username: String = "" | |
@State private var password: String = "" | |
var body: some View { | |
VStack { | |
Image("your_image_name_here") | |
.resizable() | |
.frame(width: 300, height: 300) | |
.padding(.top, 20) |
View LoginPageUI.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
import Auth0 | |
struct LoginView: View { | |
@State private var email = "" | |
@State private var password = "" | |
@State private var profile: UserInfo? | |
var body: some View { | |
VStack { |
View observerPatternExample.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Subject { | |
var list: [Adventurer] = [] | |
func add(adventurer: Adventurer) { | |
list.append(adventurer) | |
} | |
func remove(adventurer: Adventurer) { | |
if let index = list.firstIndex(where: { $0 == adventurer}) { | |
list.remove(at: index) | |
} |
View IOS_Swift_Message_Dispatch_with_closure.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DataModel: NSObject { | |
var data = 1 | |
var callback: ((Any?) -> Unmanaged<AnyObject>?)? | |
} | |
class CustomClass: NSObject { | |
@objc func getValue(_ model: DataModel, completion callback: Any!) { | |
print("get Value for CustomClass") |
NewerOlder